USB Arduino Morse Code Key

2,017

37

15

Ever wanted to type on a computer with a morse code key or to learn/teach morse code? You are on the right page!

For my other projects, check out calvinliang.me

Step 1: Gather Materials

• 1 × Arduino/Genuino Micro

• 1 × 3v buzzer

• 1 × morse code key (I got this one: http://www.ebay.com/itm/Morse-code-straight-key-Made-in-Taiwan-/161178779257?hash=item258700fe79:g:aqEAAOxygPtSs5kk)

• 1 × 680Ω resistor

• 1 × 120Ω resistor

• 1 × circuit board

• 4 × M4×0.50 round head machine screws

• 2 × 6-32×1/2" round head machine screws

• 2 × 6-32 machine nuts

• Some mounting tape

• Some jumper wires

• You might also want to learn morse code if you don't already know

Step 2: Code

Upload the code to the Arduino/Genuino Micro

The Keyboard library allows the Arduino/Genuino Micro to act as a keyboard

In my code seven and eight dot("......." & "........") are backspace and a really long dash("-") is space

Step 3: Solder

Solder all the parts onto a perfboard.

I started the project knowing very little about Arduino. I used an analog pin to detect if the morse code key is clicked. You can use any analog or digital pin for this, just be sure to change the "morseKeyInputPin" in the code. If you know what you are doing, you can use the internal pullup(INPUT_PULLUP) resistor to detect the state of the morse code key.

Step 4: 3D Print the Base

You can order one from an online 3D printing service or print one yourself. The 3D model is designed with www.tinkercad.com, it's basically MS paint for 3D modeling.

Online 3D printing services:

www.sculpteo.com

www.shapeways.com

i.materialise.com

more on Google

Step 5: Assemble

1. Wire the two wires sticking out of the circuit board under the morse code key

2. Secure the morse code key onto the base with two 6-32×1/2" round head machine screws and 6-32 machine nuts

3. Tape the circuit board on to the bottom cover with mounting tape

4. Secure the bottom cover with the four M4×0.50 round head machine screws

5. Adjust the bottom screws/bolts to level the morse code key

Step 6: Start Typing

Here's a US navy training video on sending morse code

Plug it into your computer and start typing

Don't forget, in my code seven and eight dot("......." & "........") are backspace and a really long dash("-") is space

Share

    Recommendations

    • Plastics Contest

      Plastics Contest
    • Optics Contest

      Optics Contest
    • Make it Glow Contest 2018

      Make it Glow Contest 2018

    15 Discussions

    0
    None
    SamuelP32

    2 years ago

    Why did you use internel pulldown. Why could you not just use a 10k resistor.

    2 replies
    0
    None
    CalvinL8SamuelP32

    Reply 2 years ago

    Why wouldn't I use internal pulldown?

    0
    None
    SamuelP32CalvinL8

    Reply 2 years ago

    I made a mistake. There is no built in pulldown resistor. there is only a 20k resistor that can be used to pull it high but I would expect that you would not want to pull high, you want to pull low.

    0
    None
    ThomasK19

    2 years ago

    Is there any reason you're reading the morse key analog? This is clearly a digital input, isn't it?

    9 replies
    0
    None
    CalvinL8ThomasK19

    Reply 2 years ago

    Nope, I use analog simply because I didn't know much about Arduino boards and that was the only way I know that can detect changes in voltage.

    0
    None
    ThomasK19CalvinL8

    Reply 2 years ago

    You can use digitalRead(pin) and it will return 0 or 1 (you can use symbolic names LOW and HIGH instead). You need to use a digital instead of an analog pin. Take any from 2 to 13 (0 and 1 are used for Serial). The digital pins have some hysteresis and will switch somewhere around 2.5 V to either 0 or 1. So if you connected your Morse switch to +5V and it pulls down to ground via a (say) 1k resistor you can directly read the digital values.

    As a side note: the way you decoded the Morse code is fine. However, if you store it as binary tree you can go left or right at each short or long puls until you reach a leaf which tells you the found character. You might try coding it this way. It's a bit more challenging and also more esthetically :-)

    0
    None
    CalvinL8ThomasK19

    Reply 2 years ago

    I just changed the code, now it uses digitalRead instead of analogRead. I kept the array instead of using a binary tree so the code is more readable.

    0
    None
    ThomasK19CalvinL8

    Reply 2 years ago

    You have this alternative:

    A) Change the morseInputPin to be 2 and connect the switch as shown in the picture (R is 1k) .

    B) Change the morseInputPin to be 14 and leave the circuit as it is. A0 corresponds to digital input 14 (A1 = 15, etc.).

    The Atmega is quite flexible.

    pic 2016-03-06 um 00.18.56.PNG
    0
    None
    CalvinL8ThomasK19

    Reply 2 years ago

    You can also use the internal pullup resistor and just connect the other end to ground.

    0
    None
    ThomasK19CalvinL8

    Reply 2 years ago

    In that case you need to update the circuit accordingly. Since it connects to A0 it wont work with digitalRead.

    0
    None
    CalvinL8ThomasK19

    Reply 2 years ago

    digitalRead actually works with analog pin. see https://www.arduino.cc/en/Reference/DigitalRead

    0
    None
    CalvinL8ThomasK19

    Reply 2 years ago

    Good points, I am new to this. Didnt know you can do binary trees in Arduino.

    0
    None
    ThomasK19CalvinL8

    Reply 2 years ago

    Yeah. The binary tree is sort of a challenge ;-) You can code b-trees in all languages and there are plenty ways to do it in C (/Arduino). Just if you feel bored some time...

    0
    None

    Ya it is, I got three people interested in morse code the first day when I brought it to school.