For the past few weeks, I've been merrily playing with Adafruit's NeoPixels. Sad to relate, I just ran into a slight problem, which may have taken out one of my NeoPixel Rings. Fortunately, there is a solution.
Now, before we plunge headfirst into the fray, I'd like to start by saying that I have the utmost respect for the stuff (products, tutorials, and whatnot) from the folks at Adafruit. Quite apart from anything else, I really like the way the company seems to anticipate things I need. As a simple example, I recently purchased a 5V 10A switching power supply to power my NeoPixels (about which, more below).
As we can see, the output from this power supply is delivered via a 2.1mm male plug. In the past, I would typically have cut this plug off (which I hate doing) and connected the wires directly into my project, but this gets to be a pain when one wishes to move the supply from one project to another. So you can only imagine my surprise and delight to discover that Adafruit also offers a female DC power adapter (a 2.1mm socket with a screw terminal block) as shown below.
I don't know if this is an Adafruit special, or if you can find such devices all over the place. What I do know is that I've never seen one before, but I love the idea. I immediately ordered one, and I will be adding a bunch more to my next order (which I will be placing sooner rather than later, I have no doubt).
But that's not what I wanted to talk to you about. A couple of weeks ago, I decided to make an infinity mirror. This is when I first became aware of Adafruit's NeoPixels, which are an incredibly cool idea. Each NeoPixel is presented in a small (3/16" square) package that includes red, green, and blue LEDs along with pulse-width modulated controllers. Furthermore, each NeoPixel has only four external terminals: 5V, 0V (ground), data-in, and data-out, which allows you to daisy chain a bunch of them together. For example, consider the Adafruit NeoPixel Digital RGB LED strip, which contains 60 NeoPixels per metre. You actually purchase this by the metre.
Using the Arduino library that you download from the Adafruit website, you can control the colour and brightness of each pixel individually—and the amazing thing is that all this requires only a single digital output pin on your Arduino microcontroller.
While I was playing with such a strip in the context of my infinity mirror, I thought, "Just a minute. These NeoPixels would be ideal for my pedagogical and phantasmagorical inamorata prognostication engine. I've had this project on the back burner for a couple of years. The problem is that I need to be able to monitor a lot of switches and knobs and control a lot of LEDs and analogue meters. Every time I've turned my attention to this in the past, things have quickly grown too cumbersome, and my attention has drifted away again. But it struck me that I could use an Arduino to control all the LEDs using a single output pin. Also, I can use the Arduino's PWM outputs to control my analogue meters and its analogue inputs to monitor my rotary potentiometers.
The image below shows my first-pass layout for the control panel. Things have evolved a little since I took this picture, but the overall feel is the same.
Currently, I think we are looking at using 116 LEDs. In the case of stand-alone LEDs, I might simply cut them off a NeoPixel strip like the one shown above. Alternatively, I might be tempted to use the individually presented Flora NeoPixels shown below.
But what about my rotary potentiometers? There are five of these in the upper portion of the control panel. As you can see in the image below, I've decided that each will have 16 associated LEDs.
Fortunately, Adafruit supplies NeoPixel rings with 16 elements. These are perfect for my project, as illustrated below. Adafruit also offers 12-NeoPixel and 24-NeoPixel rings.
In addition to power and ground connections, each NeoPixel ring has a data-in connection and a data-out connection, thereby allowing you to connect a bunch of them together in series. All of this brings us to the crux of my problem. This morning, I brought one of my rings into work to show to my chum Ivan. When I proudly turned everything on, however, the result wasn't what I had expected. Instead of a glorious rainbow pattern rolling around the ring, all we saw was one lonely NeoPixel giving a very half-hearted attempt to light up.
Ivan immediately bounced over to his office and returned with a multi-meter and oscilloscope. It took only a few seconds to discover that we were getting power to the ring, and the programming signal was reaching the ring's data-in pin, but there was no programming signal at the data-out pin. Hang on. I've been thinking about this as a long shift register, but it just struck me that this might not be a good analogy. Maybe we shouldn't see anything at the data-out pin unless we modify the program to behave as though there were more NeoPixels in the chain. (Hmmm... I'll have to go back and experiment further.)
It may well be that I accidently blew out the input stage to the first NeoPixel in the chain by electrostatic discharge (ESD). However, Ivan also pointed out that we were seeing a lot of overshoot and undershoot on the programming signal, as seen in the oscilloscope screenshot below.
In order to address this, we added a potentiometer into the circuit just before the signal line was presented to the NeoPixel ring. We started off with the potentiometer set to 0Ω. Then we gradually increased the resistance until the overshoot and undershoot were completely removed from the signal, as shown below. Increasing the value further started to impact the slope of the signal's edges.
The ideal value for this particular configuration was 230Ω, which we subsequently approximated by strapping two 470Ω 1/4-watt resistors in parallel. The required resistor value will no doubt depend on the characteristics of the rest of the wiring harness, so I will be repeating this procedure for future iterations of the design.
As I say, it may be that this overshoot and undershoot is not a problem, and that it was my own stupid fault that my NeoPixel ring was toasted due to my failing to take ESD precautions. On the other hand, I feel much happier knowing that we are now working with a clean programming signal. But now I must away to order a replacement NeoPixel ring. In the meantime, please feel free to post any questions or comments below.
文章评论(0条评论)
登录后参与讨论