Bidirectional Morse code communication between a laptop and Arduino — text becomes sound and light; button presses become English.
The Hybrid Morse Code Translator is a two-way communication system bridging a laptop and an Arduino UNO. It operates in two modes:
- Text → Morse: Type any text on your laptop. The Python script encodes it and sends it over serial — the Arduino drives a buzzer and LED to signal the Morse code in real time.
- Morse → Text: Press the physical button on the breadboard to tap out Morse code. The Arduino reads the timing of each press, sends it over serial, and the Python script decodes and displays the English translation on screen.
- 🔁 Bidirectional — works in both directions without switching modes manually
- 💡 Visual + Audio output — LED flashes and buzzer sounds in sync for every dot and dash
- ⌨️ Button input — physical button with debounce logic for accurate timing capture
- 🖥️ Live terminal display — decoded text appears character by character as you type in Morse
- 📡 Serial communication — clean Arduino ↔ Python protocol over USB
| Component | Quantity |
|---|---|
| Arduino UNO | 1 |
| Breadboard | 1 |
| LED (Blue) | 1 |
| Piezo Buzzer | 1 |
| Push Button | 1 |
| Resistor (220Ω) | 1 |
| Jumper Wires | As needed |
Built and simulated in Tinkercad
Pin Connections:
| Component | Arduino Pin |
|---|---|
| LED (+ resistor) | Digital 8 |
| Piezo Buzzer | Digital 9 |
| Push Button | Digital 2 |
- Python 3.x
- Arduino IDE
- PySerial library
pip install pyserial- Clone the repository
git clone https://github.com/deep-chatterjee/hybrid-morse-translator.git
cd hybrid-morse-translator-
Upload Arduino sketch
- Open
arduino/morse_translator.inoin the Arduino IDE - Select your board: Arduino UNO
- Upload to your board
- Open
-
Run the Python script
python morse_translator.py- Select your COM port when prompted (or edit
morse_translator.pyline 5 to set it directly)
User types text
↓
Python encodes to Morse (dots & dashes)
↓
Sends timing signals over Serial
↓
Arduino drives LED + Buzzer accordingly
User presses button (dot = short, dash = long)
↓
Arduino measures press duration
↓
Sends dot/dash pattern over Serial
↓
Python decodes Morse → English, prints to screen
hybrid-morse-translator/
├── arduino/
│ └── morse_translator.ino # Arduino sketch (output + input handling)
├── morse_translator.py # Python script (encoding, decoding, serial comm)
├── morse_code_map.py # Morse code dictionary
└── README.md
| Character | Morse | Character | Morse |
|---|---|---|---|
| A | .- |
N | -. |
| B | -... |
O | --- |
| C | -.-. |
P | .--. |
| D | -.. |
Q | --.- |
| E | . |
R | .-. |
| F | ..-. |
S | ... |
| G | --. |
T | - |
| H | .... |
U | ..- |
| I | .. |
V | ...- |
| J | .--- |
W | .-- |
| K | -.- |
X | -..- |
| L | .-.. |
Y | -.-- |
| M | -- |
Z | --.. |
Full map available in Morse_code_map.md
- Serial communication between Python and Arduino using PySerial
- Timing-based input detection with debounce logic in C++
- Encoding/decoding algorithms for Morse code
- Coordinating hardware outputs (PWM buzzer tones + digital LED) with software signals
- Add GUI with
tkinterfor a cleaner interface - Support full ASCII character set
- Add audio input (microphone) to decode spoken Morse
- Wireless version using Bluetooth module (HC-05)
Deep Chatterjee GitHub
This project is licensed under the MIT License — see LICENSE for details.