Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Looking for simple CW encoder and decoder projects

Status
Not open for further replies.

neazoi

Advanced Member level 6
Advanced Member level 6
Joined
Jan 5, 2008
Messages
4,155
Helped
13
Reputation
26
Reaction score
15
Trophy points
1,318
Location
Greece
Activity points
37,164

The decoder link you show uses a micro, thats the easiest way of
handling decode, especially in light of speed variation, pulse variation.

Could port this to a newer family, like PSOC 4 or 5LP (attached).


Regards, Dana.
 

Attachments

  • an2124.pdf
    267.8 KB · Views: 204

I developed my own morse decoder years ago for my Commodore computers. It successfully translated beeps into English text onscreen.

The job is easier with a computer of course. Otherwise you need to create artificial memory cells and artificial binary words.

To encode without a computer:

Each character (dots and dashes) can be stored as a series of diode-resistor pull up networks. To make a gap apply a pull-down resistor. Apply a network to a shift register (as an alternative, one or two 4017 decade counters). The output is a series of dots and dashes. Vary clock speed to change keying rate. The switching becomes complex, but it's one way to pursue proof of concept.

To decode without a computer:

Create an electronic branching structure based on whether a dot or a dash is encountered at each step. (There are at most 5 steps or levels, assuming you make do with 32 characters.) Follow the left path when a beep is a dot (less than, say 12 milliSecond). Follow the right when a beep is a dash (greater than 12 mSec).
End a character when the gap is 25 mSec. The timeframes depend on keying rate. (I pressed my keyboard keys to increase or decrease timeframes.)

Example, if the first beep is a dot followed by a gap, you have letter E.
If dot-dot-gap, then letter I.
If dot-dash-gap, then letter A.
Etc.
When you detect a gap, stop the action. Where the last choice stops is the result of the unique series of dots and dashes for that letter.

To display each letter is the second challenge. The obvious way is to light an led behind a translucent panel with the letter painted on it.
The letter appears only momentarily as the next letter comes in with little pause.

Or, create a binary lookup array (in the form of electronic memory cells, or diode-resistor pullup pairs). This may be used for 7-segment display (maybe scrolling, maybe stationary). Or to translate to ascii in case you want to send to a computer.
 
Last edited:

    neazoi

    Points: 2
    Helpful Answer Positive Rating
I developed my own morse decoder years ago for my Commodore computers. It successfully translated beeps into English text onscreen.

The job is easier with a computer of course. Otherwise you need to create artificial memory cells and artificial binary words.

To encode without a computer:

Each character (dots and dashes) can be stored as a series of diode-resistor pull up networks. To make a gap apply a pull-down resistor. Apply a network to a shift register (as an alternative, one or two 4017 decade counters). The output is a series of dots and dashes. Vary clock speed to change keying rate. The switching becomes complex, but it's one way to pursue proof of concept.

To decode without a computer:

Create an electronic branching structure based on whether a dot or a dash is encountered at each step. (There are at most 5 steps or levels, assuming you make do with 32 characters.) Follow the left path when a beep is a dot (less than, say 12 milliSecond). Follow the right when a beep is a dash (greater than 12 mSec).
End a character when the gap is 25 mSec. The timeframes depend on keying rate. (I pressed my keyboard keys to increase or decrease timeframes.)

Example, if the first beep is a dot followed by a gap, you have letter E.
If dot-dot-gap, then letter I.
If dot-dash-gap, then letter A.
Etc.
When you detect a gap, stop the action. Where the last choice stops is the result of the unique series of dots and dashes for that letter.

To display each letter is the second challenge. The obvious way is to light an led behind a translucent panel with the letter painted on it.
The letter appears only momentarily as the next letter comes in with little pause.

Or, create a binary lookup array (in the form of electronic memory cells, or diode-resistor pullup pairs). This may be used for 7-segment display (maybe scrolling, maybe stationary). Or to translate to ascii in case you want to send to a computer.

In this computer **broken link removed** (there is nothing to attach) I have struggled measuring the timing so as to decide if to set a dot or a dit.

I also wonder if the decoding can be done with an EPROM. very quickly scanning through the EPROM addresses and try to match the incoming data to any row in the EPROM. I mght talk nonsense, or be too complex.
 

You have to have adaptive timing based on CW speed.

You can do most designs with a lot of discrete parts, or some code and a processor
and its internal HW.


Regards, Dana.
 

quickly scanning through the EPROM addresses and try to match the incoming data to any row in the EPROM.
Along this line...
Use a shift register to measure beeps and record their length.

The switch was pressed to create morse letter A (dit-dah) as shown in the scope trace.

The LED pattern shifted L-to-R. Thus starting at the right we read dit-dah (letter A).
shift register 8 DFF records length of dot or dash.png


I have struggled measuring the timing so as to decide if to set a dot or a dit

Set your cutoff so that roughly half the beeps register as dots and the other half as dashes.

Any given broadcast requires that you match its speed of keying. Some broadcasts go slowly because the keyer is a beginner.

Other broadcasts are so rapid I could swear Superman was at the key. Then I had to set my VIC-20 program to wait only a few mSec between beeps.
 

    neazoi

    Points: 2
    Helpful Answer Positive Rating
Are a lot of CW decoders on the internet available, and I tested (just for fun) many of them.
All these decoders works somehow, but two of them are the best in my opinion, mainly because they use complex DSP algorithms.
Just blind decoding of random speed Morse code, without using smart DSP algorithms, don't get good results.

First one is OZ1JHM project (based on Arduino) which use a Goertzel digital signal processing algorithm:

Second one, which is a PC program, is CW Skimmer, based on Bayesian algorithm:
 

    neazoi

    Points: 2
    Helpful Answer Positive Rating
Are a lot of CW decoders on the internet available, and I tested (just for fun) many of them.
All these decoders works somehow, but two of them are the best in my opinion, mainly because they use complex DSP algorithms.
Just blind decoding of random speed Morse code, without using smart DSP algorithms, don't get good results.

First one is OZ1JHM project (based on Arduino) which use a Goertzel digital signal processing algorithm:

Any links from the projects from the internet you mention?
It is weird I cannot find many that are non arduino-based. Also I cannot find any encoders (apart from the one I posted), either with matrix keyboard or with PS/2. I mean opensource, because there are commercial products of course.
More interestingly I have found a few 70's-80's non-MCU projects (with many chips) that do the job.

This one with arduino is interesting but I do not want to buy an arduino board. It is not clear to me if I can program somehow the atmega328 chip myself (I have a programmer) and then use this standalone for the project.
--- Updated ---

Along this line...
Use a shift register to measure beeps and record their length.

The switch was pressed to create morse letter A (dit-dah) as shown in the scope trace.

The LED pattern shifted L-to-R. Thus starting at the right we read dit-dah (letter A).
View attachment 167453

Interesting!
This gives me an idea. How about, not distinguishing between dots and dashes at all, but instead use the shift register outputs as address inputs for the EPROM? The EPROM address that matches the shift register outputs will be set and the EPROM data will be read.

Then some kind of circuit (what would that be?) would decide to lit up a led with a letter mark on it (there will be a led matrix of letters).

Also with such a circuit (what would that be?) an EPROM could be avoided. You could directly decode (demultiplexer?) the shift register outputs and lit up leds.

There should be a timint pulse, set by a separate oscillator (code speed) connected to the clock maybe, which when it comes in will allow the shift register outputs to the demultiplexer, and maybe provide some reset functionality for the shift register.

Any ideas would be interesting, this could turn up to be a very small mcu-less decoder at the end!
 
Last edited:


Programming Arduino chips -




You can use a NANO board to do this, its a $ 2 kind of board, usb attached to PC,
and you use the free Arduino IDE as the programming interface.

Regards, Dana.

I already have a programer as said. The problem is that it is not clear to me what firmware to burn into the 328. There is some kind of boot loader I think and then you load your programs onto it. can both be programmed at once into the chip using an external MCU programmer?
 

If you wanted to try BradtheRads approach, this can be done with a single chip.

All but R's and LEDs and Switch are onchip. Board is $ 10. Compiler and IDE is free.
Note this is a codeless design. Only code needed is chip startup code, and that is
auto generated for you. Board has programming interface on it (USB to PC).
Basically you drag and drop chip resources out of its catalog, wire up with a wizard,
and hit the build button.

Note most of chip resources unused in this design, see right hand window used/available
for general overview.

Onchip debouncer used to condition the switch. Also you could play with clock speed
to optimize for user capability. Or change # stages, those changes are all trivial.

Chip has ARM processor, so if you want to use more of its resources and create more
complex designs thats "normal" embedded work that is done with its IDE (PSOC Creator).

Basically think of chip as a box of diverse parts, both analog (A/D, OpAmp, Comparator, PGA, DAC....)
and digital (from simple gates to LUT, PWM, Timers, DDS, Quaddecoders...), and a tool that allows you
to drag and drop them onto schematic, wire them up, and write code if necessary (this design
no code needed).

1612957854880.png




Regards, Dana.
--- Updated ---

I already have a programer as said. The problem is that it is not clear to me what firmware to burn into the 328. There is some kind of boot loader I think and then you load your programs onto it. can both be programmed at once into the chip using an external MCU programmer?


Yes in case of Arduino you program its firmware into it, most boards already shipped with that,
and then use an Arduino board, like Nano, to act as an interface to BL to do the programming.

So if your board already has BL in it the IDE just talks to that to program your "sketch", your project
code. Otherwise you need a programmer or another Arduino board configed as a programmer
by IDE) to do the work.

What programmer do you have ?

Regards, Dana.
 
Last edited:

If you wanted to try BradtheRads approach, this can be done with a single chip.

All but R's and LEDs and Switch are onchip. Board is $ 10. Compiler and IDE is free.
Note this is a codeless design. Only code needed is chip startup code, and that is
auto generated for you. Board has programming interface on it (USB to PC).
Basically you drag and drop chip resources out of its catalog, wire up with a wizard,
and hit the build button.


What programmer do you have ?

I have the GQ-4X.
This is for the arduino project that VFONE posted above.

The BradtheRads approach is very interesting, but I was thinking of it as an MCU-less design. One or more shift registers that "record" the CW pulses. The clock sets the speed. Then now parallel output of the shift registers to go to demultiplexers. Since there will be a unique sequence for each letter/number a specific output of the demiltiplexers will be set. Then the specific LED will light up, representing the specific letter. for a input an LM567 can be used to convert audio tones to data. Every few clock cycles a reset pulse must be present so as to reset everything and receive the next letter.

The problem is that you would need lots of demultiplexers for 36 symbols. This is why I have thought of the EPROM solution. In this one, the EPROM parallel inputs will be connected to the shift registers and the EPROM output to some circuit, maybe a demultiplexer? to light up the relevant led. I am not sure about this second approach.

How does this sound to you?
 
Last edited:

The PSOC has a LUT resource that could be used. It is constrained to 5 inputs, 8 out. Possibly
one LUT to handle alphabet, another the rest of the symbols.....Note the LUT can be used as a registered
LUT allowing it to become a state machine.

The other possibility is use DMA where address into its memory and build a pseudo LUT large enough to
handle whole problem. But the we are into programming the DMA.....The part has flash and a resource
that looks like EEPROM (FLASH acting as EE)

1612963008547.png


Also part has digital comparator capability to use as address decode, up to 32 bits wide, you only need
6 bits .....you could use this to switch between LUTs....

1612963497986.png


I still think this is a design that has to adapt to varying speeds.....its easy to do PW measurement internal
and adapt the system for changes. eg. sampling of input.

Note part has demuxes, and enough I/O you could do 36 symbols, using 2 16 bit and 1 4 bit demux. Again
onbooard. Not you would have to use a larger board, roughly $ 25, to get enough I/O to do this. If you want
to drive LEDs you have to consult datasheet for port I/O total current limits.....and chip total limits.

Your question yes a general purpose memory is a natural decoder.....

1612961912121.png


Regards, Dana.
 
Last edited:

    neazoi

    Points: 2
    Helpful Answer Positive Rating
The problem isn't the look up table or the shift registers, its knowing when to do the shifting. It would take some careful filtering to pick out the gaps between characters (3 x dit time) and words (5 x dit time) to synchronize start of the shift. Even working out the shift rate (clock speed) would be quite difficult based on Morse that might also contain interference and other tones. It is even further complicated by the Morse characters having different lengths, thinking of it as nicely structured serial data probably wont work.

Brian.
 

The problem isn't the look up table or the shift registers, its knowing when to do the shifting. It would take some careful filtering to pick out the gaps between characters (3 x dit time) and words (5 x dit time) to synchronize start of the shift. Even working out the shift rate (clock speed) would be quite difficult based on Morse that might also contain interference and other tones. It is even further complicated by the Morse characters having different lengths, thinking of it as nicely structured serial data probably wont work.

Brian.

I think its all these issues. The classic receive chain for CW is AM followed by a BFO to generate audible tone.
The whole receive path could be tackled with all its issues, which more than I think the poster wants to do.
Its clear he does not want a micro, when in fact one should be present just because of the width discrimination and
tone detection mand speed changes from sender. So the thread at times accommodates posters desires to stay
discrete, thereby needing a raft of discretes (or a more integrated solution as shown) and then thread reaffirms
more horsepower is needed that just a simple one freq clock and a SR.

Hopefully we can convince poster current and many past solutions were done with micros for very
good reasons. But if he wants a crude display, an indicator for each symbol, we will accommodate
him without needing to create a huge rats nest of components and wires.


Regards, Dana.
 

Morse is difficult to decode with machines. But Brian none of these decoders should work if it was that tricky on the air. Sure the brain can distinguish lower S/N but I do not think it is impossible with machines to do a pretty good work. Apart from the LM567, there are other better techniques too, never as good as the brain.
I just liked the idea of shift registers, it seemed neat. Anyway the goal is a simple CW decoder AND encoder. There are quite lot arduino things and less and less PIC or ATMEGA. And I still have not figured out how on earth can I take an atmega328p and make a custom arduino. Perhaps I am looking on the wrong places and I really do not want to buy an arduino board, not at all.
 

1. Buy the Arduino board and the LCD display (about $5 all) and build the circuit from the OZ1JHM link (takes few minutes to build it).
2. Install into the PC the Arduino USB driver:
3. Install into the PC the Arduino IDE software:
4. Connect the Arduino board to the USB of the PC, and upload the .ino file provided by OZ1JHM:

In less than an hour you will have one of the best Morse code decoder ever designed.

You can build the same decoder using Arduino nano which is even cheaper:
 

1. Buy the Arduino board and the LCD display (about $5 all) and build the circuit from the OZ1JHM link (takes few minutes to build it).
2. Install into the PC the Arduino USB driver:
3. Install into the PC the Arduino IDE software:
4. Connect the Arduino board to the USB of the PC, and upload the .ino file provided by OZ1JHM:

In less than an hour you will have one of the best Morse code decoder ever designed.

You can build the same decoder using Arduino nano which is even cheaper:
No thanks. But I would take the effort and cost to build it myself using a single chip and burn arduino in it. Where is this info????
 

I appreciate what you are trying to do and the very noble reasons but some tasks just can't be done easily in hardware alone. It is as though you are asking to design a really simple car engine but it must have no moving parts. When a task becomes unreasonably complicated to do in hardware alone sometimes there is no option but to 'think 3D' and introduce some real-time decision making to solve it. Remember that software is free and if it is the right tool for the job, use it.

I've held a Ham license for 50 years and progressed from 6L6 PA tubes to 30GHz HEMT amplifiers, I'm up to speed with latest developments but even with all that experience I wouldn't contemplate a Morse encoder in hardware alone. Move the problem into the digital domain and it becomes a relatively simple task. Also remember that the vast majority of microprocessors these days are electronically re-programmable, you can keep experimenting until you get the results you want and even use them for completely different tasks at a later date. Also consider that for many years there has been a trend towards SMD packaging and that has made home construction a lot more difficult, especially if you want to make your own PCBs as well.

Personally, I would invest in a nodeMCU board, you get Arduino compatibility, an on-board voltage regulator, a USB serial link, a USB programming link, lots of input an output pins, PWM generator, ADC and of course WiFi. Importantly for home use, it also brings the pins out on a 2.54mm DIL outline so you can use cheap 'proto boards'. Programming is easy with a free graphical development package which includes the USB routines to hook up for programming. The price is about the same as the Uno R3.

Please understand I still do a lot of analog design work and have nothing against it whatsoever. Some of my designs are actually very simple ones too, but when a task needs more muscle than discrete components can manage I have no hesitation in using the better tool to complete it. Hardware and software are not opposites, they compliment each other. For your Morse decoder, use an envelope detector or a BFO to make a tone but then analyze the timing and decode the patterns in software.

Brian.
 


I really understand what you are saying Brian. Sometimes it is just challenging to push the limits, that's all :)
I would go for a classic MCU for the shack for this project, but it is nice digging things and sometike a bight idea might come up.

BTW the decoder link I posted in post #1 although old, it is written in assembly and it has adaptive CW speed.
If I knew how to take an atmega328p and "burn" the arduino and his CW program into it, I would consider VFON's recomendation, since it saves one chip. But since I don't, or I can't find a site with clear instructions how to do so...

I have found some information on the internet https://www.electronicshub.org/burn-bootloader-on-atmega328/ but do I really need to burn the bootloader if I have a separate programmer to program the chip directly (remove it from the socket and place it into the programmer)???
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top