For our final project, we built a mechanism that spun a linear array of seven LEDs at a velocity that made it appear as if a message was being displayed using persistence of vision for the human eye. To accomplish this, we first had to design and build the hardware components, which may have been the most difficult portion of this entire final project for reasons discussed in detail later. The hardware mostly consisted of a spinning wood platform, a DC motor, LEDs, any other circuitry (including the microcontroller). We decided to begin with the construction of hardware because there would be no way to test the code without functioning hardware. The code itself uses a modified version of the 7×5 ASCII character set included in a prior lab to create a message across the spinning wood platform. With precise timing of the angular velocity of the platform, an individual byte of data (containing either ON or OFF for each LED) can be sent at the appropriate time so that a visible message appears. Also included in the code is the ability for the user to decide the color of the message (red, blue, or green) and the characters included in the message by using an attached keypad.
The motivation for this project came from multiple sources. We had seen and were impressed by other similar devices as seen on YouTube. However, in those devices the LEDs were not programmable. It seemed reasonable to us that a consumer would most likely buy such a display only if they had control over the message(s) displayed. With that in mind, we also wanted to create a display that had a spinning circumference large enough to display a comprehensible message, not only a small string of characters. And, for added complexity and flare, we decided to make the LEDs tri-color.
From our research, in order to get the effect of persistence of vision, an LED or other light should blink at fractions of a second . Thus, in terms of rotations per minute this meant the motor must have been chosen so it operates at an angular velocity with the additional weight we planned to connect of about 1800rpm. The only other math that needed to be completed was in the construction of a voltage divider for pin2 of the LEDs, but it is discussed in detail in the hardware section of this report.
The main logic used in the spinning LED display was to control the ON or OFF state of the individual LEDs. A 7×5 binary character set was created based on the active-low configuration of the LEDs, so a 1 corresponds to OFF and a 0 to ON. For us it seemed reasonable that each color was controlled by a separate port on the microcontroller, with pin1 (Red), pin3 (Blue), and pin4 (Green) of each of the seven LEDs connected to PORTA, PORTB, and PORTC, respectively. That would leave an empty pin for each port, which we arbitrarily decided would be pin0. Also, in a similar manner, the keypad had seven pins connected to PORTD and left pin0 of PORTD unconnected. Of course, other logic was included to allow use of the keypad, but the details are discussed in the Program Details section below. A complete listing of the code is also available.
Since we were able to find hardware that suited our project goals, there was not a significant amount of hardware/software tradeoffs. The only modification we had to make to software in this entire project as a direct result of hardware was the timing of the LEDs blinking. However, this only occurred because we did not know the exact angular velocity of the motor with all of the components connected to it. But with a small amount of trial and error, and a short test program, we quickly made the modification.
Standards, patents, copyrights, and trademarks were not an issue with this project. The issue of safety was taken into serious consideration and is discussed in the Results section of this report.
The design of the program took a significant amount of time because of the complexity in the different functions we wanted the Spinning LED Display to perform. These functions were to be controlled by the keypad and consisted of:
- Displaying a readable message
- Allowing the user to program the characters displayed
- Allowing the user to decide the color of the display
- Avoid bouncing when pressing the keypad buttons
Before describing the software design we would like to note that some of the code was borrowed and modified from other code. Firstly, the array of letters for used to blink the LEDs is based on the array from video_codeGCC644.c for lab 4 of ECE 4760. It was modified to just use the capital letters and the bits were inverted and the letter is oriented differently in the array for ease of use. Secondly, the debounce state machine used for the key pad was taken and modified from debounceGCC644.c test file from lab 2 of ECE 4760.
The software for this project is split into two sections. The first section is the displaying of the message. This is done in a timer compare match ISR in order to keep the LEDs blinking at a constant rate and prevent distortion of the display. The code in the ISR simply checks for which color the letter is to be displayed in and it outputs each byte from the array for the corresponding letter, where each bit corresponds to a specific LED. The rest of the ISR just increments the variables keeping track of which letter it is displaying and which byte it is displaying (and the variable keeping track of letter color if the user sets the display to display each letter in a different color), the variables are incremented or decremented to allow the software to cycle through the entire message over and over for persistence of vision. The timing for the ISR was done on the guess and check method and remains constant.
The second part of the software is the keypad reading and the creation of the array of the letters to be displayed. The debounce state machine is used to make sure a button is just read as a single push and not several pushes. A set of nested if statements is used to determine what to do. Input from the keypad can be used for three things. Firstly, the letters to be displayed are represented by two digit numbers corresponding to their position in the alphabet (A = 01, Z = 26) which is stored in an array to be used for the displaying ISR. Secondly, if the talk button is pushed on the keypad, the next button pushed corresponds to the color the letters are to be displayed in (1-3 are single colors; 4-6 are multiple colors with each number corresponding to a different starting color). Thirdly, if the reset button is pressed the software switches between the displaying state and the user input state. When in the input state, the LEDs stop blinking.
In order to reach our goal of making a programmable and tri-color spinning LED display, we had to make a platform large enough for all of the components. We decided to use a circular platform of a diameter of about 12 inches to have enough space for all hardware and also have a circumference large enough for a decent sized message. Also, because of the diameter, we needed to use a total of 28 individual wires (four for each LED) to extend to the MCU. The MCU could have been brought closer to the LEDs, but for balancing purposes and torque considerations, we decided to place the MCU near the center on the opposite side of the LEDs.
The hardware may have been the most challenging aspect in completing the final project. Since neither of us have any experience in mechanics, building the actual spinning LED display presented more of a challenge than originally thought.
Our first problem was finding a motor that would be large enough in size, have enough torque, and rotate at the proper rpm range. From our research, the spinning led will appear to display a message to the human eye only if the frequency of rotation is high enough. Also since we planned on placing all of the circuitry on top of a spinning platform on the motor, we needed a motor with enough torque to be able to handle the weight and still rotate faster than the minimum 1800rpm motor we wanted to use. Eventually, we found a motor that has all of the capabilities we needed, but finding one took a significant amount of time.
The next problem we had to deal with was keeping the platform on the motor. The motor has a shaft that spins, but attaching the platform requires welding it on to the shaft. To do this with a wood platform, screwed in TEE nuts to top and bottom of the wood and put the shaft of the motor through the center of the TEE nuts. Then, all we needed to do was to weld the TEE nuts to the shaft of the motor. Unfortunately, neither of us are trained welders, so we had to make several phone calls and ask for favors from friends to get the welding completed. We found a friend of friend who was not exactly a professional welder but had enough experience to do this simple connection free of charge. As a result of our welder’s inexperience, we only asked him to weld the topmost part of the shaft to the top TEE nut.
Another minor difficulty occurred because of all of the soldering we had to do. We did not schedule enough time to solder all of the connections, so we ended up a little bit behind schedule. There were at least 60 connections that we had to make, plus the additional connections for the target board.
|Part||Part #||Vendor||Unit Price||Quantity||Total Price|
|5mm round (RGB) LED||bought at store||RadioShack||2.99||7||20.93|
|SS TEE Nuts-Brad Hole 10||bought at store||Lowes||4.47||1||4.47|
|2×2 Oak||bought at store||Lowes||4.43||1||4.43|
|9V Battery||bought at store||RadioShack||0.99||1||0.99|
|Wing Nuts||bought at store||Lowes||1.21||1 bag||1.21|
|Pipe Straps||bought at store||Lowes||1.43||1 bag||1.43|
|Red Oak Wood||bought at store||Lowes||5.96||1||5.96|
|Cable Ties||bought at store||RadioShack||4.86||1 bag||4.86|
|12V DC Power Supply||PS-1251||allelectronics.com||9.00||1||9.00|
|Variable RPM Motor||DCM-319||allelectronics.com||8.50||1||8.50|
|Tape, Wires, Screws, Resistors, etc||Free||0.00|
For more detail: Programmable RGB Spinning LED Display Using Atmega32