The official forums for Pokemon Tower Defense / PTD and all things Sam! GET YOUR LARVITAR CODE: HERE! ![]() New to the forums? Well make sure you Introduce yourself here! Discuss the latest PTD 3 here! Join our Discord to Chat! (Also for Mobile Phones!) |
| Welcome to Pandora Gaming Network. The most active Pokemon Tower Defense, Pokemon, Yu-Gi-Oh and Gaming fan forum on Zetaboards. We hope you enjoy your visit. You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free. Join our community! If you're already a member please log in to your account to access all of our features: |
| Desk Programmable LED Backlighting Project; A guide on how I made my desk awesome | |
|---|---|
| Tweet Topic Started: Sep 3 2015, 05:25 PM (1,284 Views) | |
Shojiro
|
Sep 3 2015, 05:25 PM Post #1 |
|
The one and only!
|
WIP - This post is being worked on and will be updated with more info/pictures later. It honestly is mostly done on the information side, I just hope to add more pictures to break up the wall of text and to also just help illustrate the info.![]() That is the setup that I currently have. I put RGB addressable LEDs on the back of the top of my desk so that the light reflects from the wall behind my desk. Guides to read before buying parts/starting this project: Adafruit NeoPixel Überguide FadeCandy guide Adafruit Guide To Excellent Soldering Materials and tools with pictures below:
![]() From left to right: The helping hand tool which also has a magnifying glass. Solder is the spool on the bottom left. In the middle is the Soldering Iron resting in the Soldering Iron holder (it came with a sponge, you might want to make sure to have a soldering sponge). The tube next to the soldering iron is the solder sucker, it helps remove solder when you are trying to desolder things. Last in the bottom right is the solder wick which is also used to help remove solder. ![]() From top to bottom: 16 AWG wire in red and black colors (used for high power transfer). The box below the red and black was a kit I bought containing 6 spools of 22 AWG wire 25 feet of each color. Below that is the wire strippers to strip the wire so you can solder to it and use it. Below the wire strippers are the JST connections. Last at the bottom is a 1000uF capacitor. ![]() Here is the spool of NeoPixels and the FadeCandy driver. ![]() Multimeter with the 4-pin AT/ATX/IDE peripheral power cable How I did it: Start and Initial Setup: So there were a lot of things going on when I first started this project. I researched NeoPixels and FadeCandy, and asked my uncle (an electrical engineer) for tips and info. Initially I was only planning on using a strip of 64 NeoPixel LEDs in the middle of my desk because of the fact that while FadeCandy can support up to 512 LEDs total, each port on the FadeCandy can only support up to 64 LEDs. There are 8 ports total, so 8 x 64 = 512 LEDs. Later after buying all the materials and whatnot I ended up deciding to go the full length of the desk, which ended up being 96 LEDs (which is more than 64, and has to be controlled by 2 FadeCandy ports, but more on that later). I measured the length of my desk and it came out to be 160 cm long (I used cm instead of inches because NeoPixel strips come in 1 meter sections, and a whole reel is 4 meters). When buying the NeoPixels, there are several different LED counts you can buy, 144 per meter, 60 per meter, and 30 per meter. I decided to buy 60 per meter as it wasn't that much more expensive than 30 per meter and the spacing between the LEDs seemed like a good middle between the two. That and 144 per meeter is expensive, haha. So with calculations, it comes out to 0.6 NeoPixel LEDs per cm, and so 0.6 x 160 = 96. When buying NeoPixel strips, the 30 per meter strips come in 1 meter lengths, and if you buy at least 5 meters you will get a full reel with power and data wires coming out of the ends of the strip already. Same with 60 per meter, except a reel is 4 meters long. 144 per meter are only sold in 1 meter lengths and there are no reels of them. NeoPixels come in a weatherproof sheathing, which can easily be removed with some scissors and/or a knife. For this project I thought that the weatherproof sheathing might help diffuse some of the light a little, so i kept it on. I bought a whole 4 meter reel of 60 per meter NeoPixel strips, so mine came with the cables already coming out of the end, so that means I didn't have to go through the work of soldering it on to the end of the strip and the data wires already had a JST female connector coming out. I started by stripping the ends and soldering 2 wires to port 0 of the FadeCandy driver so that I could test out the NeoPixels. I twisted the wires to help shield the data from electromagnetic interference (hence why the four pairs of wires inside of Ethernet cables are usually twisted pairs) and then soldered a JST male connector on to the end of those wires making sure that when the JST connections were together, data went to the data wire and ground went to the ground wire. In this case the wires for data coming out of the NeoPixel strip were white for data and black for ground (black usually denotes ground, just as red usually denotes power) and the first wires I grabbed and had already soldered onto my FadeCandy were black and red with red being data. I just made sure that when connecting the JST connectors that the red wire from the FadeCandy would go to the white wire from the strip and the black wires would go to each other. When I bought all of my materials I also bought a female DC power adapter 2.1mm jack to screw terminal block and a 5v 2a AC to DC power supply. So I took the power wires from the ends of the strip, put them into the positive and negative slots on the female power adapter screw terminal (red is positive), shoved a capacitor in there (the capacitor helps smooth the electricity flow and handles any spikes that may come from the power source so that you don't damage your LEDs), and then screwed them down to tighten the connection so the wires wouldn't fall out. I hooked up the FadeCandy to my computer, followed the FadeCandy guide to install the proper software to interact with it, and then powered on my NeoPixel LEDs and tested them using several of the examples that the FadeCandy software comes with. The testing of the first 64 LEDs went well (remember that the FadeCandy can only work with 64 LEDs per port), so I decided to continue on with my efforts. My first step was to put the LEDs on my desk to make sure that my measurements were correct and that it looked like it would fit properly if I used 96 LEDs. After that all looked good, I started work on all my other wires. Power: So after talking with some people from Adafruit, the company I bought the NeoPixels from, I found out that after powering about 30 LEDs in a NeoPixel strip there starts being a red-shift in the colors that they display because the further away from the power source, the more resistance and the less power that the LEDs are able to get. So I decided to power my large strip of 96 LEDs from 4 different points. Fortunately 96 was a number that was easily divisible by 3, so I was able to add power connections in between LEDs 32 and 33, and then another one between 64 and 65, and then I also added power connections at the start and at the end. Power can pass in either direction, up or down the LED strip, but data only flows one way. So in the Uberguide is info about the NeoPixels specifications and power requirements. A NeoPixel is made up of 3 small LEDs, Red, Green, and Blue to make up all the colors. A typical usage of a NeoPixel LED takes about 20 milliamps of power, but to be safe, the maximum is 60 milliamps (20 for each LED inside the NeoPixel) which is if the LED is full on bright white light. So when doing power calculations for how many amps of power it will take, I wanted to be sure it was safe and take the calculation of 60 x 96 = 5760 milliamps or 5.76 amps. Originally I only had AWG 22 wire which is a pretty thin wire for transferring that much power, so I went ahead and also bought AWG 16 wire (the smaller the number the bigger in diameter the wire will be) to be a main feeder wire for the power and then I will user other smaller wires to split off from that main power feed to power the NeoPixels. So power cables all need to be done in pairs, one main power line and one ground line. In mine I used the typical red for power and black for ground. I measured out how long I needed the main feeder lines to be from being inside my computer to hang along the back of my desk and then added a little bit for wiggle room. Then I measured where I needed to make cuts in the feeder power wires so that I would be able to splice in the wires in the middle of the wire for the first three power connections. I wanted to be able to disconnect the cables from the NeoPixel LED strip easily so everywhere where I wanted to solder on connections to the strip, instead of soldering wire directly to the strip I soldered JST female connections to it for power, and then I planned to solder JST male connections to the main power red and black cables. (I will add some pictures later, maybe on Monday when I return home). Data: With it working out that I was already going to cut open the weatherproof casing between LEDs 64 and 65 for power, it was also a good place to connect another data connection as the first one connected to port 0 (many programming related things start at 0 instead of 1) on the FadeCandy can only support 64 LEDs. I didn't want to have to fully cut the LED strip, as I wanted to preserve the spacing between the strips, so I just connected another data connection in between LEDs 64 and 65 so that port 1 controlled the last 32 LEDs, LEDs 65 through 96. Unfortunately after testing it out, there seemed to be interference between the port 0 signal and the port 1 signal, and so I wasn't actually able to get the last 32 LEDs to work at that time. After talking with some people at Adafruit, I found the best way would be to cut about a 1/2 mm section out of the copper contact that is in the LED strip between the LEDs that passes the signal on to the next LED. So I did that and was able to solder the data connection to the section of strip after the disconnection cut, and after that I was able to control all 96 LEDs.(I will add some pictures later, maybe on Monday when I return home). Controlling the NeoPixels: The next hard part after testing the LEDs and making sure they were all working was getting it set up the way I wanted with the controls through the FadeCandy. There are a bunch of examples included with the software for FadeCandy and when I originally started using the FadeCandy I used the Processing examples (Processing is a language that is based off of Java, and actually there are Processing libraries that can just be imported in Java so it is very easy to work with if you know Java) to display some stuff on the NeoPixel strip. I used the strip64_flames example which opens a a window with a horizontal line of dots, where each one represents one of the LEDs that you are connecting to, and where each dot is, the program takes the RGB color data of the picture and transmits it to the LEDs. The picture is moving upwards so that the the spots that connect to the LEDs are constantly getting different color data. I switched out the flames picture for a rainbow picture and got some results that I really liked. When I was running the Processing example, I found that it was taking up 12-15% of my CPU and about 90 MB of RAM. While the amount of RAM wasn't an issue for me, it taking up 12-15% of my CPU just to display was just way too much to just display some colors on the LEDs. With the FadeCandy there were examples for HTML, Processing, and Python. Python is a pretty efficient language so I decided to try my hand at converting the flames example into Python, though the main problem was that I don't really know how to program in Python. While I am a programmer and learning new languages is easier because I already know how programming works, just because it is easier doesn't mean it is easy. So I tried my hand at converting the code over from Processing to Python, and overall I was pretty successful. I was able to create a similar version where essentially it loads in an image and then the points that represent the NeoPixel LEDs are set up in a vertical line instead of horizontal and then the image moves up (technically the points that the NeoPixels using to grab their color values from are moving, but it has the exact same effect). So far with my uses I have run it for hours and it seems to use 0-0.3% of my CPU and 0.9 MB of RAM so far, so that is a major improvement. I am including the code below and the picture I used can be found here.
This code requires you to install Python 3.4, the pypng module, and possibly the numpy module. To Be Continued... More info/pictures will come later. Edited by Shojiro, Sep 4 2015, 05:20 AM.
|
![]() |
|
Poledoo
|
Sep 4 2015, 03:26 AM Post #2 |
|
9999C
|
Oh wow very nice effect fast on the wall, looks great! |
![]() |
|
Master Snowy
|
Sep 4 2015, 01:00 PM Post #3 |
![]()
%The Bliss Lender%
|
Oh my goodness! Wow, look at all that! Wow, I hadn't realized that SO much hard work had been put into it. Thank you very much for this post, Sho! It is really helpful and informative and I shall keep checking it as you update it. I don't know what to say... This is just super blasting AWESOME! ![]() Thank you very much, Sho! |
![]() |
|
Shojiro
|
Sep 4 2015, 02:42 PM Post #4 |
|
The one and only!
|
Yeah, really a lot of the work was because I didn't really know electrical engineering, so I had to learn the best way to do certain things and had to learn more about how to solder stuff and whatnot. |
![]() |
|
Master Snowy
|
Sep 4 2015, 04:20 PM Post #5 |
![]()
%The Bliss Lender%
|
Wow, thanks a lot again, Shojiro!
|
![]() |
|
| 1 user reading this topic (1 Guest and 0 Anonymous) | |
| « Previous Topic · General Discussion · Next Topic » |
Twitter
Active Topics
















Wow, look at all that! 