USB Arduino Morse Code Key




Introduction: USB Arduino Morse Code Key

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

Step 1: Gather Materials

• 1 × Arduino/Genuino Micro

• 1 × 3v buzzer

• 1 × morse code key (I got this one:

• 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, it's basically MS paint for 3D modeling.

Online 3D printing services:

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



    • Furniture Contest 2018

      Furniture Contest 2018
    • Metalworking Contest

      Metalworking Contest
    • Tiny Home Contest

      Tiny Home Contest

    15 Discussions

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

    2 replies

    Why wouldn't I use internal pulldown?

    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.

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

    9 replies

    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.

    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 :-)

    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.

    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

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

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

    digitalRead actually works with analog pin. see

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

    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...

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