Arduino LED Light strip | PHASE 2
Hey! Welcome back. Here is the next part where I continue to stumble my way through my first LED light project.
- It told me that it could be done!
- There were a couple issues I needed to sort out before phase 2.
- I didn't need to break the piggy bank to make something awesome.
One issue I had to overcome was getting the command to the Arduino. In the previous section I had just resulted to reprogramming the Arduino every time I wanted the lights to change. This method comes with a couple issues.
- The transition between light schemes is pretty choppy and noticeably clunky.
- Reprogramming a device is not an elegant solution and reduces the device's life span.
Since the Arduino was already connected via USB connection I thought that utilizing this connection could be a good method for sending commands to the Arduino. I learned a few things.
WARNING! TECHNICAL BITS AND ISSUES ENCOUNTERED TO FOLLOW!
Scroll to the bottom if you're just looking for the pretty pictures from the project.
The way I was going to communicate to the Arduino was over a USB connection using something called a serial connection. The serial connection protocol is a little tricky to use because the data is passed to and from the device is in a raw unprocessed format. It is also sent at a rate measured by something called "baud". This rate is cleverly named "baud" rate.
I didn't name it.
One downfall of this system is that if the baud rate on the receiving device does not match the baud rate of the sending device then the data will appear as garbage. Meaning the device doing the interpreting of said data won't be able to make any sense of it.
It's a lot like this.
Its like if an English speaking person understood English but only if the English being spoken was spoken backwards. Its still technically English but can't be understood because English spoken backwards sounds completely different than regular English not spoken backwards. Some might call this magic.
For example: Computer A sends the word "hello" via USB serial connection at a baud rate of 14400 to an Arduino. The Arduino receives data over USB serial connection at a baud rate of 9600. The Arduino receives the information but cannot see the word "hello" as intended by computer A. The Arduino can still understand that "Yes, this is text that I'm receiving!" but when it goes to interpret the text it instead sees a mishmash-ed random jumble of characters. Much like the backwards English example, the Arduino can't make sense of the received data.
!Read sculpture below
The Arduino would need to know that the data being received from Computer A is to be interpreted in a certain way so that the commands can be understood.
This... took awhile. Collectively we're talking a couple days to figure out a good program algorithm that would allow the Arduino to function in the way that we wanted. It took awhile to get certain information because most people online prefer to tell why your method is wrong, or why it won't work instead of just answering the specific question you're asking.
Additionally, during this period I may have accidentally overwritten part of the code I had recently spent hours working on JUST as it started working the way I wanted.
And finally the issue that was probably the most annoying to overcome was an issue that crept up after the code was working correctly. At some point the serial connection just... stopped receiving anything useful. At all. The Arduino just reported receiving nothing. Super. What time is it? 2:00 am? Wonderful. Well, it turns out the serial connections utilize something called a buffer. And if it gets full it stops working. So that was fun to work through...
Have you ever wondered why highly technical people some times act so strange? This is why. Its all just a weird variant of PTSD.
Almost
Okay, sorry. Frenetic ranting over. The new LED strip arrived and there was much rejoicing! As before I wanted to see what this strip was capable of vs. the $5 one from the store. Following a tutorial I found online I hooked up the Arduino to the light strip, imported a control library and reprogrammed the Arduino. This is what happened.
Holy smokes it can MOVE! Excellent. Immediately went and ordered more LEDs. 16 feet to be exact. One of the main upsides to these light strips over the Phase 1 strips is that each individual light can be programmed to do specific things including light intensity, blinking, color, etc.
I also bought an LED strip extension kit that came with 9 feet of extra wire and 7 clamps that made increasing the covered area much easier. For the serial communications I'm using a Raspberry PI mini computer connected via an X10 ethernet connection that eliminates the need for having any cords run over the main floor area.
For the 3 foot LED light strip that I ordered first to use for testing I needed something that would reliably hold it in place that I could mount under the desk. Turns out! I had a spare broom that I never used and figured the handle would get more use if I strapped some lights to it and shoved it under a desk.
It looks like this.
The complete Arduino LED Light Strip project!
Note that most of these pictures look very similar to Phase 1 and... That's on purpose. Phase 2 was just a better higher quality implementation of Phase 1.
I don't have an HD video camera so these are a little... Non HD.