Long Data Wire + ESP8266 + Level Shifter

I have 2 ESP8266 boards running 700 leds each. The first board is running lights across the first floor of my house the the data wire is connected directly to the D4 pin on the board and all works without issue.

The problem I am having is the second board is to run lights on the upper level of the house and I need to have a long data wire (over 10M) to reach the first strip. The data cable I am using is 14 AWG.

Both boards are sitting in my garage and the lights are outside.

I have read that when using a long data wire I need to add a level shifter, which I have done. When putting an LED strip directly off the level shifter everything works. However, when I add my 10+ meter data cable I run into the issue where the board will not boot up.

I have tried with and without the 470 Ohm resistor as I have seen mentioned in other questions.

I am new to all of this and am not sure what I am missing?
I am also attaching my wiring diagram.

Here is the level shifter that I am using:

1 Like

Add a pull-up 4k7 resistor to a D4 pin.

I just put a 4k7 resistor from the D4 pin to 5V+ and it still does not boot with the data wire connected.

Not 5V!!! 3.3V.
You will damage ESP.

1 Like

Tried again with 4k7 from D4 to 3.3V. Still does not boot with data wire attached. I unplugged the data wire and it booted properly.

then your data line is pulled low which prohibits booting.
use some other pin (GPIO12-GPIO14 or GPIO4-GPIO5)

1 Like

The “How far can I put my controller from my LED’s” question comes up often as we’re all trying to cover our living spaces with wonderful LED projects.
Here’s my short primer on the 3 scenarios (for serially addressable LED’s, WS281x, APA102,etc,etc):

Legend:
D1 is the 3.3V LED data from the ESP-WLED controller.
D2 is the “corrected” LED data after a level shift back to TTL (quasi-5V) levels.
Ro is the kludge resistor used when you’re in scenario “B” and trying to force things back to “A”.
A+,B- LED data “encoded” for long distance transmit over 2-Wires (GND is also required).
LD Pwr is the power required for the long distance receiver (Rx).
Strip Pwr is the power line needed for LED’s, need NOT be 5V, sometimes 12V (or even 24V).
Gnd’s need to be connected together - Common GND.

The “secret sauce” to these diagrams is the “Long Dist Tx” and “Long Dist Rx” modules.
They’re nothing more (or less) than RS485 modules configured for half-duplex TX and RX.
You can look at another thread for my examples of how simple they can be. That thread also talks a little more on my cabling choices for B setups (22/4, alarm wire).

IMHO many people are trying to “force” a scenario B into an A by using just enough wire or adding Ro.
I get it, A is simple, less parts, easy to visualize everything.
Hey, I typically push my setups as A’s without even the Level Shifter or Ro (never used Ro) and lots of them work well.
But if I want to be sure the setup is reliable beyond 3m, I’ll wire it up as a B.

The other nice thing I find with B scenario is I can build it in the “lab” as an A with the controller right near the strip and then go into “production” by adding the Tx/Rx pair after the code is all doing what I like.

Note, you don’t need an extra Level Shifter for B or C, the specs on the MAX485 give you that for “free”.

All the other notes about GPIO’s to use still apply.

4 Likes

Also, the shifter you linked says I2C which means it’s likely too slow. See recommended shifters in wiki/kno.wled.ge base.

I changed from gpio pin 2 to pin 5 and that fixed my issue of booting. Thanks!

As for the distance and shifter comments, could both of those be corrected by using a sacrificial pixel right at the board and eliminate the shifter?

The sacrificial pixel is the “poor man’s” level shifter.
At best you can try and put it halfway from the board to the strip.
You’re still counting on that 1st pixel reading the board reliably and then being able to send over a longer than standard spec distance.
On the plus side it’s cheap to try, if it works go for it.

Hi @divsys, can you confirm if my wiring below for the Max485 is right ?
Not too sure about the RO-RE-DE-DI part but gave it a shot based on this

RO - Receiver out
RE - Receiver enable (enabled when this pin is LOW)
DE - Driver enable (enabled when this pin is HIGH)
DI - Driver in (the transmitter pin)

I guess I could also use 12v-5v step down converters to feed the transmitter/receiver and go from 5 wires to 4 wires
As per your other thread

Also, what are the terminals blocks for? just another way to wire A-B ?


.

Let me know what needs to be corrected, unless I’m right =)
Thanks.

1 Like

Wiring looks right at a first glance.
Screw terminals just make it easier to wire in the field.
One simple test I use before hooking up to a strip:
Wire up the Tx-Rx pair for pwr and AB, don’t connect the MCU or strip.
On the transmitter tie the DI to +5V with a 1K resistor, you should measure +5V (or close, logic Hi) on the Rx DO line.
Move the DI to GND with the 1K resistor, you should measure 0V (or close, a logic Lo) on the Rx DO line.

That’s really all the Tx-Rx pair does, transfer the DI pin logic level across AB to the DO pin.
Except it can do it very fast over distance while ignoring noise.

If it passes that test, you’re good to go hook up the strip and take it for a test drive.
As far as converters, I use them all the time.
You can power your MCU on 5V and pass it over the 22/4 to power both Tx and Rx ends on 4 wires.
The max current used on that line will be predominately the two 120R0 termination resistors for a total of 5V/60R0 = 83.3mA. The line drop on that wire at those currents will easily accommodate a 50m run.
As long as ground is common at the strip data input, you can worry about your 12V power bus independently.

1 Like

I did the wiring and test with 1k resistor but this was NOK. The solution was:
On TX: DE and RE on 5V
On RX: DE and RE on GND

Then it works.

Yep that’s a common setup, but that will depend on the particular RS485 boards you buy.
There’s a few different variants out there.

Commonly they’re setup as “default” TX unless you ground DE/RE, but other variations require more explicit connections.

One of my favourites right now is the “Auto-Tx” boards that all default to RX mode unless you send data to the DI pin in which case they switch to TX mode automatically - no pins to set.
As general RS485 devices they’re limited to a maximum baudrate since they would have to allow time for the TX unit to stop transmitting and receive a response from the far unit.
For WLED it’s not an issue because the LED protocols don’t listen, the just transmit and hope the data arrives properly.

Those boards usually have a bonus of pretty good protection diodes on board, making them pretty robust.

1 Like

Hello,
I developed this board just for RS485 LED strip: maybe it is interesting for you!

2 Likes

Hello
Great, what is the led for ?
Bought them at Radig up to now.