I'm not slacking off. My code's compiling.

RSS
Sep 1

Hello All and sorry for not posting in a long time. Much has happened since I last wrote. Classes have started and are already going well. I am currently working on a project from Johns Hopkins University Applied Physics Lab for my senior design class. Through all of this busyness I have built and programmed a Binary Converter.

You may notice that this project was not made with the sun spot. Using the sun spot would have been way to easy for many reason that I will explain later. First, I will talk a bit about my new micro controller, the Arduino. This micro controller has an ATMega328 AVR micro chip controlling the whole thing. It has many digital input and output pins. Some of these pins can also create a pulse width which is what was used to control my previous projects. The Arduino also has several pins to take in an analog input signal which is how many different types of sensors interface with it. The Arduino also supports serial communication with a computer or another device as well as I2C communication. All in all, this is a nice micro controller for prototyping!

The circuit attached to the Arduino is what I have called a Binary Converter. Basically this circuit will take in a number from my computer using serial communication and then displays it using eight LEDs. Since there are only eight LEDs the highest number it can display is 2^8 - 1 or 255. That limitation aside, the number being displayed can also be controlled by the two switches that are on the breadboard. The changes you make using the switches is also displayed on the computer. 

I am sure you may have many questions about how this actually works since there are only three wires controlling eight LEDs. You also may have noticed a little black circuit that is taking on all of these wires. This circuit is called a shift register. The shift register sets eight pins high or low depending on a number that you lock into the circuit. This number is from 0 to 255 which also coincides with the numbers that can be represented by the LEDs. The number controls the shift register by taking its binary representation and using each bit of the number to control the state of the corresponding pin. If the bit is 1, then the LED in that position is turned on, but if the bit is 0, then the LED in that position is turned off. 

Here is an example: 147 in decimal => 10010011 in binary. This means that pins 1,2,5,and 8 are set high. (Remember that binary numbers are read right most bit first) If you look at the picture of 147 represented in binary, you will see that LEDs 1,2,5, and 8 are turned on.

Now that we know how the shift register works, lets talk about the switches. I have worked with the switches on the sun spots, but these ones are completely different. These switches give off a constant voltage when they are not pressed, therefore, when the switch is pressed the voltage lowers. This was really simple to program considering the main method of the Arduino code loops over and over again. This basically becomes a listener for the switches.

The last bit I have to talk about is serial communication. The Arduino connects to the computer using a USB cable and has a serial communication interface built in. One of the pictures included with the post shows the interface. As you can see, there is a place to enter in text and send it to the Arduino. This is also where the Arduino will print out if I want it to. 

This was a fun project to build because I got the Arduino in a developers kit which included several electrical components which was used to build this project. It took me awhile to think of something fun to do with all of these. I figured an easy to use binary converter would make my life easier as well as help teach some of my friends binary!