# Decoding Morse code

**URL:** <https://www.ruby-forum.com/t/decoding-morse-code/234468>\
**Category:** GNU Radio\
**Created:** [March 6, 2015, 8:21pm UTC](https://www.ruby-forum.com/t/decoding-morse-code/234468 "2015-03-06T20:21:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [March 6, 2015, 8:21pm UTC](https://www.ruby-forum.com/t/decoding-morse-code/234468/1 "2015-03-06T20:21:34Z")

</div>

A few weeks ago I started learning my way around gnuradio and am making  
progress, but could use advice from experienced users.

I’ve been making something of an online lab notebook recording my  
efforts in gnuradio at:

[Gnuradio Mini Projects](http://udel.edu/~mm/gr/)

At the very bottom of that page is a section named “Morse Code Decoder”  
where I show a flowgraph I’ve come up with. I can’t figure out how to  
take it farther than that, however. I believe I need to learn how to  
write an out of tree demodulator. If I’m wrong, maybe someone can give  
me a push in the right direction regarding how to use existing blocks.  
If I’m correct, what would be the best modulator to study - BPSK?  
(“Best,” meaning easiest for someone new to gnuradio to understand.)

Thanks very much,  
Mike M.

---

<div class="post-metadata">

**Author:** ![mike-moscow](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/53a042/32.png) [@mike-moscow](https://www.ruby-forum.com/u/mike-moscow)\
**Post date:** [March 6, 2015, 9:31pm UTC](https://www.ruby-forum.com/t/decoding-morse-code/234468/2 "2015-03-06T21:31:41Z")

</div>

Mike,

have you gone through our beginner’s tutorials?

[http://gnuradio.org/redmine/projects/gnuradio/wiki/Guided\_Tutorials](http://gnuradio.org/redmine/projects/gnuradio/wiki/Guided_Tutorials)

M

---

<div class="post-metadata">

**Author:** ![mike-moscow](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/53a042/32.png) [@mike-moscow](https://www.ruby-forum.com/u/mike-moscow)\
**Post date:** [March 6, 2015, 10:11pm UTC](https://www.ruby-forum.com/t/decoding-morse-code/234468/3 "2015-03-06T22:11:01Z")

</div>

On 06/03/15 19:19, Mike M. wrote:

> take it farther than that, however. I believe I need to learn how to  
> write an out of tree demodulator. If I’m wrong, maybe someone can give  
> me a push in the right direction regarding how to use existing blocks.  
> If I’m correct, what would be the best modulator to study - BPSK?  
> (“Best,” meaning easiest for someone new to gnuradio to understand.)

I would pass this through a threshold block, followed by a float to  
char, then out to a file (pipe) or UDP socket.

Then write your own code to take in the stream of 1’s and 0’s, and  
decode the morse that way.

I essentially do this with my SDR radio clocks, but then I’m just  
looking for a pulse of 100, 200, or 500msec, but the concept and the  
theory are the same. I just used getc() and stdin.

For my purposes I dropped it down to a 1kHz stream of 1’s and 0’s  
(actually by use of a Goertzel filter as I was tuning slightly off for  
debug and able to hear it purposes!), but a Rational Re-sampler would  
do just as well.

Auto detecting speed can be done - I actually wrote a prototype for use  
with the CW ID of the Russian BETA Time Stations, that essentially  
took a number of pulse’s and gaps, worked out the differences, then  
decoded the next set of dits and dahs. To be honest it was pretty  
awful, but then I just needed to decode two numbers…

Iain

---

<div class="post-metadata">

**Author:** ![mike-moscow](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/53a042/32.png) [@mike-moscow](https://www.ruby-forum.com/u/mike-moscow)\
**Post date:** [March 7, 2015, 1:30am UTC](https://www.ruby-forum.com/t/decoding-morse-code/234468/4 "2015-03-07T01:30:55Z")

</div>

On 03/06/2015 03:30 PM, Martin B. wrote:

> Mike,
> 
> have you gone through our beginner’s tutorials? […]

Martin, I will revisit them. At this early stage, at each iteration I  
absorb some more. Your note implies my answer is there, so off I go…

On 03/06/2015 04:08 PM, Iain Young, G7III wrote:

> I would pass this through a threshold block, followed by a float to  
> char, then out to a file (pipe) or UDP socket.
> 
> Then write your own code to take in the stream of 1’s and 0’s, and  
> decode the morse that way. […]

Thanks, Iain, I hadn’t thought of passing the info to another program.  
I hope to keep it self-contained in gnuradio, but if that fails I’ll use  
your idea. It would certainly be easy to timestamp each incoming sample  
that way!

Thanks very much, guys,  
Mike
