Thursday, March 24, 2016

Arduino Output Project

This article will cover some basic arduino design, layout, and coding. The parameters for this project was to do a sample project that comes with the arduino kit. The sample project was a basic blinking LED circuit and then modify the code and/or the design. It is composed of five components, not including the bread board and arduino itself. Here is the project:

Several weeks ago Dr. Harris told the class to order an arduino kit from SparkFun, an online electronics supplier. The choices for kits were these: the SparkFun Inventor's Kit for $100 or the SparkFun Mini Inventor's kit for $50. As the name suggests, the mini kit was simply a smaller version for half of the price. However, the regular kit include 2.5 to 3 times as much stuff as the mini.

First I had to download the arduino software. It is simple to install and straight forward to use. Once the software was installed the correct type of board had to be selected. In this case it was an Arduino Uno, the SparkFun RedBoard is an equivalent board. The basic programming for the project was already done, it was an example called 'Blinking an LED'. This is in the example program files and can be easily found.

There was one hiccup with the software, the program could not be uploaded to the board. This was due to the drivers for the arduino board not being installed properly. The proper drivers had to be downloaded and installed. The drivers can be found (here).

Now that all of the software was working correctly and the program could be uploaded, the hardware was next. The example that the class was told to use includes a diagram of the board set up. Here is the diagram and the board.

Source: SparkFun PDF, page 22

The arduino kit included a small tray to hold both the bread board and the arduino itself. The arduino has numerous output and input pins. The bread board is interesting, it is simply a group of contacts that can hold onto a pin or a lead. This allows simple and quick prototyping of a circuit as it does not need to be soldered together. The board's rows are number top to bottom and the lettered from left to right. This gives a concise way to notate where each component should go. These are essentially coordinates, like a10 or f5  In this case pin #13 was used as the output. The output wire, a green wire was used, was plugged into hole e2. The LED was plugged into c2 - c3. The negative leg of an LED is the shorter one and that side of the LED has a flat ridged. A small 300 Ω resistor was also used. The board set up can be seen the videos below.

The power for the board can be an external power supply or supplied through the USB port. In this case, the power was supplied through the USB port. The positive and negative wires were plugged into the proper holes and the circuit was complete.

Once the set up was done the test code was then uploaded. Here is the test code working:



The code makes the arduino send a signal through pin 13. This signal is then relaid to the bread board through the green wire. The code emits a signal through pin 13 that makes the LED blink for one second intervals.

Once the basic code was working it could then be modified. I tried to determine what would be a good project or challenge to code. I decided to stick with the single LED, but make it blink a pattern. I wanted the pattern to actually mean something, so SOS was chosen. The Morse code for SOS is this: dot-dot-dot-dash-dash-dash-dot-dot-dot. This is fairly simple and code could actually be useful. There are numerous brands of flashlights that can flash SOS.

Here is the SOS flash:



The board set up is the same as before, but the code was changed. Here is a link to the code used. The code has been saved as a .txt file type which can be copied and pasted to the arduino software.

This project was not too hard. The programming for the unit converters and beam calculator prepared the class for this project. As is typical with this type of project, the hardest part was getting the interface software to work, arduino to computer. But once that was squared away, everything else went smoothly. Another interesting, but tedious, project. I am looking forward to programming further for an arduino.

No comments:

Post a Comment