Merry Christmas Morse Code

Get Started

Introduction

Our group decided to pair LED lights with the Piezo Buzzer to perform a sequences of buzzes that coincided with Morse Code. In the sections below we will cover the hardware used along with an indepth look at exactly what challenges we ran into and what we learned along the way.

Micro Controller

The Arduino Uno R3 is a microcontroller board based on the ATmega328. It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset button. It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-DC adapter or battery to get started. (info from https://www.trossenrobotics.com/p/arduino-uno.aspx) I found it interesting that certain ports contain a modulator that helps with the buzzers pitch. I also think the test light on the board came in handy when running simple test and definetly saved us time. The Uno differs from all preceding boards in that it does not use the FTDI USB-to-serial driver chip. Instead, it features the Atmega16U2 (Atmega8U2 up to version R2) programmed as a USB-to-serial converter.

Test Device

We used a piezo buzzer that was controlled by the microcontroller for our project. The Piezo buzzer is an electronic device commonly used to produce sound. Light weight, simple construction and low price make it usable in various applications like car/truck reversing indicator, computers, alarms, and more. The Piezo buzzer is based on the inverse principle of piezo electricity, discovered in 1880 by Jacques and Pierre Curie. It is the phenomena of generating electricity when mechanical pressure is applied to certain materials and the vice versa is also true. The faster you bend the material, the higher the pitch of the noise that’s produced. This rate is called frequency.

Development Tools

During the development of our project we used various tools in order to complete our work. In addition to the hardware that was required, there was also additional software that was involved. All of the tools that were used are detailed below.
Hardware:
Arduino Uno R-3 Microcontroller Breadboard 220 Ohm Resistors Power Wires USB Adapter Piezo Buzzer LED Lights
Software:
Arduino IDE mVim GitHub AVR-tools Makefile (by rblack42) CMD Line

Our Experiment

For our experiment we initially picked a servo to work with. We couldn’t find anything we were passionate about to experiment with the servo with the amount of time we had. So, we moved on to working with the piezo buzzer Our initial goal was to play a few Christmas melodies with the piezo buzzer, but the documentation for the tone and digital write function was very hard to find. It became more of a challenge than we had time to complete. We really wanted to get something working in assembly for our project, and converting the Arduino code to C and then assembly for the type of functions we were to perform to play a song was a monumental task. Wanting a finished product to show, we moved on to something we would be able to write and compile given our earlier practice with assembly blinking and led and buzzing a buzzer. Keeping with the Christmas theme we then decided to send a “Merry Christmas” message using Morse code. We could reuse the majority of the code from the homework assignments and modify it to do what we wanted it to do. This took quite a bit of trial and error getting our delay function right to send Morse code, and also to do a slowed down version so we could decipher the Morse code and see that it was correct. Ultimately, we prevailed and the experiment was a success. Consulting we another group we also managed to get a led blinking in tandem with the Morse code signals. Unfortunately, this is not multitasking. But just initiating another function call that happened so fast you don’t see it. In order to connect the devices for our experiment we needed the following: Arduino Uno microcontroller 5 power wires of varying sizes and colors 3 220 ohm resistors (to keep led’s from burning out, and reduce sound output on the buzzer) 1 Piezo Buzzer 2 led lights

Conclusion

The device is very simple, but can do many things with the right instructions. We learned a lot about microcontrollers as we progressed through this experiment. You need first and foremost to identify the ports and pins your devices to be controlled are connected to. Writing this in assembly and C isn’t as intuitive as one would think. We had to look at a diagram of the connections from the CPU to the individuals pins to obtain the information we needed to make our device work. Although the device is simple, it is not forgiving if you give it bad instructions. It took a lot of trial and error to get the device to do what we wanted it to. Hardwiring devices to the controller was another skill no one in our group had. At first we limped our way through not knowing what was going on, but eventually gained the knowledge we needed to wire our devices using the breadboard and the proper resistors. Even something as simple as grounding one rail of the breadboard, and then connecting the devices grounds to that rail was something we learned during our experimentation. A few things we would like to continue on with would be to learn how to multitask with the Arduino. We found code and examples using the Arduino IDE, and that would be a great place to start. We had talked in depth about the possibility of making a Rube Goldberg machine using servos and other devices for the Arduino. That would be a great project to dive into multitasking and the interrupting of the processor, as opposed to delaying with a function call.

Contributions

All 3 group members contributed to the coding of the Arduino, troubleshooting, and researching the various failed and successful experiments. Ryan Galloway: Wiring Board and Hardware setup Report sections: Our Experiment, Conclusions Board diagram (Using http://fritzing.org/home/ diagram generator) Jake Lopez: Final Report build Report Sections: Introduction, MicroController (using https://www.trossenrobotics.com/p/arduino-uno.aspx) Lucian Turk: Report Sections: Test Device, Developmental tools

Sample code

Ryan Galloway


Lucian Turk


Jacob Lopez