A robust, bidirectional Morse code terminal built with AVR C programming for Arduino Uno. This project implements both encoding (text to Morse) and decoding (Morse to text) capabilities with real-time LED and buzzer feedback.
This Morse Communicator was developed for the CO321 Embedded Systems course at the University of Peradeniya. It features:
- Encoding Mode: Convert text input to Morse code with LED/buzzer output
- Decoding Mode: Convert button presses to decoded text on LCD
- Automatic Mode Switching: Alternates between encoding/decoding every 5 seconds
- Real-time Feedback: LED and buzzer provide visual/audio Morse code output
- Non-blocking Design: Uses timer interrupts instead of system delays
- Arduino Uno (ATmega328P)
- 16x2 LCD Display (HD44780 compatible)
- Push Button
- LED (with 220ฮฉ resistor)
- Piezo Buzzer
- Breadboard
- Jumper Cables
- 10kฮฉ Resistor (for button pull-up)
LCD Display:
- Pin 1 (VSS) โ GND
- Pin 2 (VDD) โ 5V
- Pin 3 (V0) โ Potentiometer (contrast)
- Pin 4 (RS) โ Arduino A0
- Pin 5 (RW) โ Arduino A1
- Pin 6 (E) โ Arduino A2
- Pin 11 (D4) โ Arduino A3
- Pin 12 (D5) โ Arduino A4
- Pin 13 (D6) โ Arduino A5
- Pin 14 (D7) โ Arduino D7
- Pin 15 (A) โ 5V (backlight)
- Pin 16 (K) โ GND (backlight)
Button:
- Terminal 1 โ Arduino D2
- Terminal 2 โ GND
- 10kฮฉ Resistor โ D2 to 5V
LED:
- Anode โ 220ฮฉ Resistor โ Arduino D9
- Cathode โ GND
Buzzer:
- Positive โ Arduino D10
- Negative โ GND
โโโ include/ # Header files
โ โโโ morse_config.h # Pin definitions and constants
โ โโโ lcd_driver.h # LCD interface functions
โ โโโ serial_comm.h # UART communication
โ โโโ morse_encoder.h # Morse encoding functions
โ โโโ morse_decoder.h # Morse decoding functions
โโโ src/ # Source files
โ โโโ main.c # Main program and state machine
โ โโโ system_utils.c # Hardware initialization
โ โโโ lcd_driver.c # LCD driver implementation
โ โโโ serial_comm.c # UART implementation
โ โโโ morse_encoder.c # Morse encoding logic
โ โโโ morse_decoder.c # Morse decoding logic
โ โโโ lcd_test.c # LCD component test
โ โโโ button_test.c # Button component test
โ โโโ led_test.c # LED component test
โ โโโ buzzer_test.c # Buzzer component test
โ โโโ serial_test.c # Serial communication test
โโโ docs/ # Documentation
โ โโโ hardware_setup.md # Detailed wiring instructions
โ โโโ lcd_troubleshooting.md # LCD troubleshooting guide
โ โโโ project_report.md # Project report template
โโโ Makefile # Build configuration
โโโ README.md # This file
- AVR-GCC toolchain
- AVRDUDE
- Make
# Build main project
make all
# Build individual component tests
make lcd-test
make button-test
make led-test
make buzzer-test
make serial-test
# Upload to Arduino
make upload
# Upload individual tests
make upload-lcd
make upload-button
make upload-led
make upload-buzzer
make upload-serial
# Clean build files
make clean
# Show help
make helpEach component can be tested independently:
-
LCD Test:
make upload-lcd- Displays text patterns, scrolling, special characters
-
Button Test:
make upload-button- Tests button press/release detection and counting
-
LED Test:
make upload-led- Tests LED blinking patterns and SOS sequence
-
Buzzer Test:
make upload-buzzer- Tests buzzer beeping patterns and SOS sequence
-
Serial Test:
make upload-serial- Tests UART communication with echo functionality
- Upload main project:
make upload - Open Serial Monitor (9600 baud)
- Test encoding mode: Type characters (A-Z, 0-9)
- Test decoding mode: Press button for dots/dashes
- Verify mode switching: Automatic 5-second alternation
- LCD displays: "Encoding Mode" โ "Send via serial"
- Type characters via Serial Monitor (9600 baud)
- LED and buzzer output Morse code patterns
- Supported characters: A-Z, 0-9
- LCD displays: "Decoding Mode" โ "Press button"
- Press button for dots (short press) and dashes (long press)
- LCD shows decoded characters
- End message with AR sequence (ยท โ ยท โ ยท)
- Dot duration: 100ms
- Dash duration: 300ms (3x dot)
- Symbol gap: 100ms
- Letter gap: 300ms
- Word gap: 700ms
- Uses timer interrupts for timing
- No system delays (
_delay_ms()) - Responsive to user input
- Clean separation between encoding/decoding modes
- Automatic state transitions
- Robust error handling
- Individual test programs for each component
- Easy debugging and troubleshooting
- Modular code structure
- LCD not displaying: Check power connections and contrast
- Button not responding: Verify wiring and pull-up resistor
- LED not lighting: Check resistor value and orientation
- Buzzer not working: Verify power connections
- Serial not working: Check baud rate (9600)
- Test each component individually first
- Verify hardware connections
- Check power supply
- Use multimeter for continuity testing
- Code size: ~3KB (2750 bytes)
- Supported characters: 36 (A-Z, 0-9)
- Modes: 2 (Encoding/Decoding)
- Components: 5 (LCD, Button, LED, Buzzer, Serial)
- Test programs: 5 individual component tests
This project was developed for:
- Course: CO321 Embedded Systems
- Institution: University of Peradeniya
- Department: Computer Engineering
- Semester: 8
- Deadline: August 1st, 2025
This project is developed for educational purposes as part of the CO321 Embedded Systems course.
This is an academic project, but suggestions and improvements are welcome through issues and pull requests.
For questions or issues related to this project:
- Check the troubleshooting guides in the
docs/folder - Review the individual component tests
- Verify hardware connections
- Test components individually before running the main project
Built with โค๏ธ for Embedded Systems Education