原创 Start them young with BADASS display

2015-7-9 20:09 1672 19 19 分类: 消费电子

Jacob, the 16-year-old grandson of a friend of mine, wants to be an electronics engineer, so I'm currently teaching him about microcontrollers and flashing LEDs; after all, isn’t that what life's all about?

 

 

My chum Duane Benson was kind enough to send Jacob a spare circuit board and headers for the spectrum analyzer card I'm using in my BADASS Display. I had some spares for the various components, so the first thing we did was to solder everything together.

 

 

The image above shows the Arduino Uno (upper right) and the spectrum analyzer board to the left (observe that I'm now being a good boy and using my Engineer's Logbook). At this stage, the spectrum analyzer didn’t have the MSGEQ7 chips inserted into the sockets. First we mounted the board on top of the Arduino, and then we mounted the red Dr. Duino Debugger on top of the analyzer. Next, we powered up the Arduino and probed around with our multimeters to check that we had good power and ground levels where we expected them and that nothing was sparking or smoking.

 

We're using Jacob's cell phone as the MP3 player along with a set of PC amplified speakers we picked up from the local recycling store for $10. After we'd inserted the MSGEQ7 chips and connected everything together, we created a simple program to read the spectrum data from the MSGEQ7s and display it using a serial monitor on the PC's screen (click here to see this code).

 

When Duane created the analyzer board, he included a little prototyping area. Rather than have flying leads going to a breadboard, Jacob and I soldered two LEDs and their current-limiting resistors into this prototyping area.

 

 

Our next step was to take the seven bands from the left channel, average them, and use the results to control the PWM value being used to drive one of these LEDs. We performed the same treatment for the right-hand channel. We also implemented a simple noise filter to prevent the LEDs flickering when no music is being played (click here to see this code).

 

Now, having two flashing LEDs is all well and good -- "Show me a flashing LED, and I'll show you a man drooling," as I always say -- but it's hard to be satisfied with a simple presentation like this when you have my BADASS Display lighting up the room in the background.

 

 

Thus, we determined to create a Mini-BADASS Display using short lengths of NeoPixel Strip from Adafruit. This proved to be a useful time to make Jacob aware of power considerations. Jacob powers his Arduino from a USB port on his PC or from a small wall-wart supply, both of which are rated at 500 mA. When running at full pelt, an Arduino Uno R3 draws around 45 mA, and the two MSGEQ7 chips have a maximum current consumption of 1 mA each. So if we assume a worst-case of 50 mA, this leaves us with 450mA to play with.

 

Adafruit says that each NeoPixel can draw up to 60 mA when full on (20 mA each for the red, green, and blue sub-pixel LEDs). However, we've actually put a string of NeoPixels on the test bench and measured 43 mA full on, which we'll round up to 45 mA (or 15 mA per color).

 

If we have three columns per channel -- one each for the base, middle, and treble, and if each column has five NeoPixels, and if each NeoPixel is used to display only one color (red, green, or blue), then we end up with 6 x 5 x 15 mA = 450 mA (I love it when a plan comes together).

 

Our next task was to set up the six NeoPixel strips, each containing five pixels. The photo below shows one of these strips with its ground wire (black), power wire (red), and signal wire (yellow).

 

 

Adafruit says you should place a resistor with a value between 300 and 500Ω as close to the data input on the first NeoPixel as possible to stop overshoot and undershoot. I usually use 390Ω resistors, but we didn’t have any to hand, so we just used a couple of 150Ω resistors in series (you can see their outlines under the heat-shrink in the image above).

 

By some strange quirk of fate, I happened to have drilled out a piece of hardboard and chopped a couple of pieces of wood a few days before as shown below (what are the odds?).

 

 

Even more amazing, I happened to have some sandpaper and a can of black spray paint close by, so Jacob was tasked with sanding everything down, spraying the front of the hardboard black, and using my trusty hot glue gun to assemble everything together.

 

The following images show the state of play with the first strip attached using two black cable ties. As it turns out, we only need to use two ties per strip, but I always over-engineer everything, so I'd drilled enough holes to accommodate a tie for each pixel. I could have saved myself a lot of time and effort by drilling a fraction of the holes, but there we are.

 

 

 

When we eventually powered everything up, it actually looked rather good. It wasn't long before we decided to move from having red, blue, and green columns to red, blue, and yellow (formed from red and green), so we dropped the PWM values used to drive the LEDs from 255 to 200 to cut down on the current consumption (click here to see this code). As you can see in this video, the result is not too shabby at all.

 

So, that's where we left things, with Jacob being the proud owner of his very own Mini BADASS display. I have no doubt that he's the only one on his street with one of these little beauties. So now it's "onwards and upwards" to our next project.

文章评论0条评论)

登录后参与讨论
我要评论
0
19
关闭 站长推荐上一条 /2 下一条