Persistence is the plan – addressable LEDs over distance

This is a bit of a story – longer than your normal Internet consumable.  Bookmark and come back when you have the time (you’ve been warned).

Been working on a project for some time now…  I want to have addressable LED lights (specifically NeoPixels) many feet apart.  One per fence post (66 posts @ 10-foot separation on average) and run Cylon like red lights and all sorts of animated fun back an forth.

Quick note: an addressable LED is a type you can have a long string of (or a grid or ‘each one on a fence post’) be a different color and you can change those colors to any other color anytime.

I can get these pixels to work over 6 or even 10 feet apart but not for any significant distance when chained together.  Every large gap introduces errors – lights don’t glow the color you expect – random errors crop up often (1).  I have not found a product out there to help with this problem.  Either for connecting two stings (a distance apart) of addressable LEDs or for having single LEDs in a long string each separated by an arbitrary distance.  Two years ago I started to work on the problem.  I was thinking this shouldn’t be too difficult.  Sadly Google did not provide the instant satisfaction we all expect.  The results of Google searches suggested people live with this limitation of Neopixels and the quirky (not well understood) communications protocol.  The result seems to be to limit the design around a limitation.  That’s all I could find.  Not good enough!

Several people mentioned how there are specific timing issues with the bit banging that’s required to drive Neopixels,  and I agree there are limits and limitations.  Two specific Google results stood out.   Tim’s (2) work was the first I came across.  This told me I did not have to rely on the status quo.  There was more to it than what the popular opinion had gleaned.  Then (very recently) I found Josh’s (3) epic posts that kicked me into high gear.  They both looked at the timing specifications of the chip.  Yeah ok. Those are the rules – don’t break them.  But are they the rules?  Suffice it to say these two showed me there was more to a data sheet than first meets the eye (Fine! I have no idea how to read most data sheets, but this one (4) is fairly short).  Now I knew (believed) timing was not going to be a limitation AND I had been looking at the wrong parameter assuming it was the timing causing the color issues.

Ok, timing is important but was that my problem?  Actually no.  The issue I had was signal propagation over distance.  A nice square wave from your Arduino becomes a wavy wave when you try to make it 10 feet or more (many times in a row without error).  Some bits will be fine, some will be only a bit off (see the pun there).  The problem again is these little errors accumulate quickly (and randomly) and by 3 or 4 10 foot lengths out – you’ve got random blinking colors and no known state you can predict.  Mush.

Retrospective: How did it take two years to figure this out?  My initial budget was zero.  My initial goal was to light up 66 fence posts with an addressable led each 10 feet apart. So even at $5 a post, I was in a bit deep for a $0 budget.  The designs and prototypes had to be very very cheap.  THAT (knowledge/thinking) was THE limitation.  Also I only really pick this up every few weekends.

Basically, to get where I’ve come, I gave up thinking I’d ever build the fence post lights I had originally envisioned.  Letting go of the project as a reality gave me the latitude to think more deeply about how to solve the problem.  Odd to think of it this way, but you may have to let something go to see it clearly.  It’s time to mention solar and wireless.  If I built this with solar the side effect would be each node also needed to be wireless.  If I just did it with power and wireless – still each node needed to be wireless.  This implies a very different way to communicate with the nodes and keep things in sync.  I am sure it is a project I’ll do someday (I have some crazy ideas for this) but it is not the goal of this project.  The goal here is to treat all the lights in the “string” just as if they were on one short 66 led strip.  So don’t say “hey how about wireless or solar”.  That said a solar power source for the entire system will be part of the final project – just not one per post.


More components are needed.  I was looking at serial communication protocols to solve the problem (they’ve been doing this forever, right).  I went to my weak spot and reviewed all sorts of data sheets of serial chips.  None of the pictures (that’s all I really look at) showed a scenario that seemed like it solved the problem.  Now, what is it about data sheets I learned earlier?  Ignore the status quo they don’t depict and consider all cases.  The 485 serial bus communication chips are where I focused.  Why are all the chips bi-directional – is that a requirement of the buss electronics or just the way most people use them? Turns out; it’s how they use them.  You can take the transmit of a chip and send it to the recipient of another and then transmit from that chip to yet another chip’s receive (not the original transmitter).  This now sounds like what I am looking for.  A one way, infinite, propagation of a signal to an infinite set of Neopixels!

So that looks a bit like this image.  Between pin 2 and 3, you put the LED and supporting items needed like capacitors and maybe resisters (not sure yet).  The chip provides the conversion of the TTL signal from the LED to serial 485 (5) signals.  The chaining of these together, again and again, is that thing I had not been finding in my searches.  I had no idea if this would work.  So I bought some chips, designed some cheap boards and tested it.  You can’t discount the need to be testing these things in real circuits – you’ll find issues to overcome every time.  Once I got past some learning curves and stupid mistakes I was able to get LEDs working reliably at least 70 feet apart from each other.  Yeah!

Now what

Build a more production ready board and order the surface mount chips and items needed to test this with 10 units over 100 feet (10-foot separation per node).  Bonus let’s put 2 LEDs per board for extra brightness and even more animation options!

One thing each board will have is a voltage regulator – this will certainly increase the cost (when I get to actual budgeting for this project).  It will be required (so far as I can tell).  5 Volts drives the LED no problem but voltage to has an issue over distance (it drops fast).  The test boards are designed to be linked together with 4 wires.  2 for power and 2 for data.  The regulator enables me to run up to 30 volts over the power wires.  The regulator enables me to run the chips and LEDs at the required 5 volts.  The board passes through the 30-volt power to the next board and the next and so on.  At some point, the voltage reaching a board will be below 6 volts (the threshold for stable regulation down to 5 volts).  At this point, we’ve either made it to 66 LEDs (660 feet) or something else needs to be done.  One option will be to inject the voltage in the middle – this means only 33 in each direction – helping the power distribution.  330 feet is still a distance so if that can’t be met then 2 or more points for power injection need to be arranged.  And there’s one more issue…

Current.  Volts I think I can manage as above but once you string a bunch of LEDs together they each use current and it all adds up.  2 LEDs at full brightness use 120 milliamps (60 each) – not a lot (and the voltage regulators can easily manage that per board).  Where it adds up in across the power lines and across the board’s copper traces that support the pass-through path.  Let’s say the voltage gets to the 66th LED without an issue — what total current (amperage will be required). 120 milliamps * 66 LED = 7920 milliamps or – 7.9 Amps.  Now maybe the math needs to account for the power usage @ 5 volts of the LEDs so let’s see what that might look like (we are in the” I don’t know for sure” zone here).  (0.120 Amps * 66 LEDs) * 5 Volts = 39.6 Watts.  That many Watts @ (let’s use) 24 volts, is only 1.65 Amps.  So my guess is if the boards and wires can handle this 1.65 Amps then 66 nodes (120 LEDs) should run without failures (failures = fires and melting of things).

Status – currently awaiting boards from the prototype manufacturer.  Still trying to figure out how to 2 side surface mount when they arrive.  Ordering surface mount parts once boards have a shipping date.  Also will order a solder stencil once boards have a shipping date.  Boards have 2oz copper (more than 1oz) to manage the current better (I hope – no idea).

When they arrive I’ll run a load (lots of current) through a board until it fails.  Probably the best way to test the limit.  I hope for some spectacular flames or something worth reporting on.

Lastly, once everything works check out etc, I need to figure out how to mount these on fence posts in a weather resistant manner.  Epoxy, silicone, hydrophobic coating – no idea there yet.  Proper defusing of the LED light is also to be considered.  Currently, I’ve found translucent white water bottle caps to be very practical – they may get incorporated into the final design.

I’ll edit the above as I progress.

Foot notes:

1 – Adafruit best practices

2 – Tim’s Work

3 – Josh’s work

4 – Neopixel datasheet

5 – Serial 485 wikipedia