Mon Dec 23
ECE312 Final Project: wireless, yum! -- . --- .--
This started as the final assignment for our ECE 312 microcontrollers class. Our team built both the hardware and firmware to send and receive Morse code using the ATmega328p, an LCD display, a piezo buzzer and infrared transmitter and receiver.
The firmware is all written in C using the AVR-GCC toolchain. It’s pretty straightforward, but getting all the timing right for Morse code took a lot of tweaking.
Transmit Mode
transmit()
reads the hold time using get_timeBUTTON()
and then sends the corresponding IR pulse via IRtransmit()
.Receive Mode
recieve()
. Depending on the timing between pulses, we decode a dot, dash, letter separator, or space.Morse Buffering
morse[]
. When an end-of-character signal arrives, the string is compared against the morse_table
for a match and appended to messageBuffer
.Check out firmware/src/main.c
for all the juicy details.
The schematic below lays everything out. Highlights include:
Check the kicad/
folder which has the schematic if you want to look at exactly how things are connected!
You’ll need AVR-GCC and avrdude
installed. After wiring the circuit, compile and flash (twice if you want the pair) using your favorite make process. The repo doesn’t include a Makefile (we used MPLABX :/), but avr-gcc
with the proper flags works great.
avr-gcc -mmcu=atmega328p -DF_CPU=14745600UL -Os -o main.elf firmware/src/*.c
avr-objcopy -O ihex main.elf main.hex
avrdude -c <programmer> -p m328p -U flash:w:main.hex
Tweak the F_CPU definition in main.h
if you use a different crystal.
You can find below an image of the project, as well as the project schematic.