• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

SPI to RGB Using WS2811 with Constant Current/Amp

Status
Not open for further replies.

EvilGenius

Member
Hello
For a while I have been trying to find a pre-made board that is able to convert SPI signal (not DMX) to RGB to drive high power RGB Pixels (10W), to no avail. I had a previous post regarding this and gave up since I could not find such a board and it was cost prohibitive to manufacture. I originally gave in using WS2811 Pixel Board combined with an RGB amplifier. It was all good with the exception that I had no control over the LED currents and the pixel could easily overheat and self-destruct even with series resistors. Worth mentioning WS2811 is a 3-channel (18.5ma constant current) pixel driver that can receive SPI signal, buffers what it needs and pass on the remaining signal to the next pixel with no additional external clock. The buffer triggers 3 outputs to generate the color on the RGB pixel. This is done by a start bit, then sequence of 8bit for R, 8bit for G, 8bit for B, then a stop bit and auto latch. Its outputs can only "sink" (active low) maximum of 18.5ma per channel.

Operational Goal: Building a device that can receive SPI signal from microcontroller, or Programmable SD-RAM SPI Controller, or SPI signal from a DMX to SPI controller which utilizes DMX signal from a controller, or a PC program such as Light-O-Rama via a dongle. Device to have 3-Wires in/out (Data, +12, Gnd) for daisy chaining.

Searching on the net I came across a simple dual NPN CCR which peaked my interest yet it was not exactly what I needed since it required Positive trigger (Active High) to operate it. I reconfigured the design to use PNP transistors for Active low outputs of WS2811.

Objective: Build a device that is able to convert SPI to RGB
1- Be very low cost
2- Be very small (to fit an HP RGB metal case)
3- Be able to sink 300mA per channel (with flexibility to go a bit higher or lower by selecting Rs and Rx)
4- Use fairly common parts that are easy to find and inexpensive
5- Operate with minimum I/O wires (Single data line in/out)
6- Provide for constant current for each channel
7- Be able to drive 10W high power RGB module that runs on 12VDC

Parameters:
I-LED=300mA (under utilized vs. 350mA max)
Ideal Transistors: PNP To-92 Case, no heat-sink, Power Diss. = 625mW, hfe= about40, Ic=600mA, Vbe(on)=0.65, If Vbe(on) is not available Vbe(sat)=0.75 (example: 2N4403). Setting aside the board cost (board can be build dirt cheap at home and parts are thru-hole), the part cost is under $1 USD.

Here is the circuit simulated schematics and PCB layout (1.15x1.25 inches, 0.25 height)
 

Attachments

Last edited:

jpanhalt

Well-Known Member
Most Helpful Member
By SPI do you mean Serial Peripheral Interface bus? If so, I don't understand how your schematic fits in. Do you intend to transmit the led information (e.g., which ones are lit at any particular time) from a master to the device without having a slave MCU at the receive end? One might be able to load a port directly, but I have not seen any examples of that, and you will still need to work with the clock, miso, and mosi lines. Usually a receive buffer in the slave gets the binary byte off the bus, then that is read by the slave and can be used for anything, such as setting output pins to the bit values.

John
 

EvilGenius

Member
By SPI do you mean Serial Peripheral Interface bus? If so, I don't understand how your schematic fits in. Do you intend to transmit the led information (e.g., which ones are lit at any particular time) from a master to the device without having a slave MCU at the receive end? One might be able to load a port directly, but I have not seen any examples of that, and you will still need to work with the clock, miso, and mosi lines. Usually a receive buffer in the slave gets the binary byte off the bus, then that is read by the slave and can be used for anything, such as setting output pins to the bit values.

John
- John
It is not master and slave in the sense of what we are used to. Look up datasheet for WS2811 (I might post one soon). It acts like a listening device in series with each other. It is designed to input 36 color bits in its buffer. Once it captures that, it will latch itself, condition, amplify and pass the rest of data chain to the next module. Next module grabs 36 color bits, latch and pass on to the next and so forth. WS2811 does not talk back to master (controller) nor it needs a clock. It does it by stop bit at the end. Just imagine the controller (master) spits out a chain of 36 bits per module (rgb) times number of modules. Then do it again. This is done in a very fast speed without a clock.

I love this method since master and slave dont have to indicate when they are ready nor do they need to check their status. After all the data for all the modules have been latched, the stop bit tells it that we are starting over with a new chain of data.

Regards,
Rom
 
Last edited:

EvilGenius

Member
Controller ---> data in First WS2811 data out ----> data in Second Ws2811 data out ----->
It recognizes 1 or zero by the duration of the pulse. and a long pulse at the end resets all.
 

ronsimpson

Well-Known Member
Most Helpful Member
Where did you get this from?
I think the 50 ohm resistor is a problem. I think Rbx should be 0 to 5 ohms. (maybe 10 at most)
I think the WS2811 can not pull down to zero volts. (more like 0.4V)
 
Last edited:

EvilGenius

Member
Where did you get this from?
I think the 50 ohm resistor is a problem. I think Rbx should be 0 to 5 ohms. (maybe 10 at most)
I think the WS2811 can not pull down to zero volts. (more like 0.4V)
I built it in a simulator and a spreadsheet. When you reduce Rbx, you will increase Ic2 and that reduces I-led. Please note Vb2 = Ve1-Vbe1-Vbe2, I let the calculations lead me to Rb2.
Lets say Blu LED: Vf=9.6v, I-LED=If=300ma, Most higher powered PNP transistors in T0-92 package have a Vbe of about 0.7v. So Ve5=Vdd-Vled=12-9.6=2.4V
Setting Vbe5=0.7 (basis for current set), Vb5 is approx. equal 1.7V. Similarly Vbe6(sat) is somewhere between 0.75 to 0.9. Therefore Vb6=1.7-0.7 or about 0.8 to 1V. Based on simulation Ie5=12ma and Ib5=o.4ma, Ib6=6ma so Irb6 is about 18ma. Therefore Rb6=Vb6/Ib6 or Rb6 is somewhere between 45ohm to 55ohms. The closest value and average is 50 ohms. If output of WS2811 does not hit zero and is about 0.2-0.4v then Vrb6 is reduced by the same and Rb5 would be between 22 and 33. It is not that citical because when you raise Vb6 you are pinching Q5, reducing Is and I-led slightly. Which is the whole point of this circuit to have some flexibility. I pulled up all the possible To-92 PNP packages from MOUSER that had Pd=625mw, Ic=600ma, hfe=40 and Vbe(on) is about 0.65-0.75, Vbe(sat) is about 0.8-0.9v, Vce(sat) about 0.4v min.
 

EvilGenius

Member
Ron thank you for encouraging me to read the datasheet once more. I think the 0.4 you are referring to is under Vo. I believe this is indicating the output level of Data out and not R/G/B sinks to ground voltage. Look a bit lower when they have 3 LED in series and how they calculated RR (Series resistor for Red). There is no mention of deducting for 0.4V before dividing by constant current of 18.5ma!

On that note the constant current allowed by WS2811 is 18.5ma per channel. So Irb2,4,6 should be monitored not to exceed that and 50 ohms does exactly that. Positive side, you made me look closely at currents and voltages and made me realize that the series resistor that I used for WS2811 in the PCB layout needs to change from 1.2k to 2.7k. Thanks.
-Rom
 

ronsimpson

Well-Known Member
Most Helpful Member
Real life:
1) 12 volt supply might be +/-5%. With long wires the voltage could be lower than you think. With 0.9A and wires there will be loss.
2) The voltage drop on an LED is not temperature stable. The voltage will change with temp. and from part to part.

I don't know what current you asked for from the WS2811.
I am not sure what voltage the WS2811 can pull down to. It is "constant current". If you pull less than that current it will pull as low as it can but what voltage?
I did a series of tests with the supply from 8V to 13V just for fun. I also changed the voltage across the LED to see what happens.

So the IC wants to output 18.5mA +/- some amount. So that 18.5mA adds to the current from the transistor.
What I think you want is a constant current transistor amp that holds the current the same over a range of LED voltage and supply voltage.
upload_2016-3-18_18-29-4.png
This is what I have in SPICE. The diode D2 and Voltage 0.75 volts are used to keep the current source from going negative. It holds the voltage to no less then about zero. (this is only to make SPICE work, not for real life)
I am using a 9.1V Zener as a LED so I can change the voltage on the fly.
R2 is basically removed at 1 ohm.
The voltage at the current source is not zero. It is what ever it takes to work. It changes to compensate for the supply changing.
Example: If the supply changes, the voltage at the output of the IC also changes to compensate.
Most of the 18.5mA goes through Q2 to the LED.
The Q1 current is set by R1 and 0.7 volts.
--------
If R2 has too much voltage across it then the IC can not pull Q2 base low enough at low voltages. (or at high LED voltage)
By removing R2 you can run with a 0.8V less supply. (or 0.8V of loss in wire) (or with a higher LED voltage)
 
Last edited:

Mikebits

Well-Known Member

EvilGenius

Member
Real life:
Ron
You changed the order of Q1 and Q2. My references below is to your schematics.
But I am not sure what you are referring to by "IC", WS2811?
I was trying to simplify the circuit, now you added another constant current source. I think I understand your concern with voltage drop but that would be minor.
Wouldn't I-led and transistors Vce and Vbe follow a very quick ramp until Q1 gets saturated? Meaning Vbe, Vce, Ie, Ic and Ib all shift to create that ramp with Vdd voltage changes and cutoff below certain level?

What if I disconnect the emitter of Q2 and tie it direct to Vdd (12v) separately with an added Resistor. That way the LED is in the path of only Q1 (load transistor) forcing Ie2=I-LED=Irs=0.7/Rs
That changes Rs to 2.3 ohms for 300ma I-led. This will provide for a separate current source for Q2 that gets sunk into WS2811. For that we can set the current at 18.5ma and recalculate R2 as needed! This way I believe the LED will be ran as a constant current almost independent of VDD up to a point (accounting for losses and fluctuations of Vdd). I am going to run a simulation as such.

Regards,
Rom
 

DirtyLude

Well-Known Member
That data sheet is full of typo's. NZR communication mode for example. Never heard of NZR, I have heard of NRZ however. In looking at the spec, I think what you want is a 1-wire Bus interface, not SPI. Just google 1-wire bus.
See Microchip appnote: https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=16&ved=0ahUKEwix7vfpysvLAhUJwmMKHbCFACU4ChAWCDcwBQ&url=http://ww1.microchip.com/downloads/en/AppNotes/01199a.pdf&usg=AFQjCNFxraG-ycQWvhKvdangUdgKIHeEUQ&sig2=bvN2ZT__KjXxHLBg5lnsKw&bvm=bv.117218890,d.cGc&cad=rja
I think he's referring to SPI because many library implementations of the 1 wire WS2811 protocol use hardware SPI and just use the MOSI line. You can implement the correct timing by sending a specific bitstream.
 

ronsimpson

Well-Known Member
Most Helpful Member
But I am not sure what you are referring to by "IC", WS2811?
Post #1 starts out with the WS2811. (that is a IC) Its output is a constant current source. It tries to keep 18.5mA on the LEDs (is connected directly).

In my SPICE circuit I did not show the WS2811 because I don't have one in software. Because its output is just like a constant current source that is what I used. The output of the WS2811 should look like a current source when the voltage is between 0 and 12V. (probably more like 0.5V and 11V but I don't know)

I think your circuit is OK. You are thinking in voltage mode and I am thinking in current mode. I started out with the idea that I have 18.5mA and I want 350mA independent of voltage.
When I simulated your circuit, as soon as the 12V dropped the current also dropped.
 

Mikebits

Well-Known Member
I think he's referring to SPI because many library implementations of the 1 wire WS2811 protocol use hardware SPI and just use the MOSI line. You can implement the correct timing by sending a specific bitstream.
Despite that, it is not SPI, it is a 1-wire Bus.
Hello
For a while I have been trying to find a pre-made board that is able to convert SPI signal
The OP is looking for a pre-made board, he will have better chances of finding something if he uses the correct terminology.
 

EvilGenius

Member
Post #1 starts out with the WS2811. (that is a IC) Its output is a constant current source. It tries to keep 18.5mA on the LEDs (is connected directly).

In my SPICE circuit I did not show the WS2811 because I don't have one in software. Because its output is just like a constant current source that is what I used. The output of the WS2811 should look like a current source when the voltage is between 0 and 12V. (probably more like 0.5V and 11V but I don't know)

I think your circuit is OK. You are thinking in voltage mode and I am thinking in current mode. I started out with the idea that I have 18.5mA and I want 350mA independent of voltage.
When I simulated your circuit, as soon as the 12V dropped the current also dropped.
Ron
I thought of what you were doing after my last post. I am thinking you did not have the means to create the constant current device and put together a mini circuit to simulate that. Clever! It was late and I did not have my thinking cap on. I had to do the same to simulate the HP LED using a resistor.
This CCR is designed for 12V supply ( I should have mentioned that in the original post (but the layout indicates that). That said original circuit has some tolerance for voltage loss but it is not necessarily designed for varying voltages like normal CCR. It is specific to run High Power RGB Pixels (10W) with high Vf. Think of a simple 12V SPI controller that runs intelligent RGB strips (example Dreamcolor) with the difference that driving current is not 20ma but rather 300ma! This unit fits in the individual HP-RGB box and act as a simple WS2811 node with respect to data in/out, but drives high current on its RGB side.
Below is a second version.
 

Attachments

Last edited:

EvilGenius

Member
Despite that, it is not SPI, it is a 1-wire Bus.


The OP is looking for a pre-made board, he will have better chances of finding something if he uses the correct terminology.
Hello Mike
You statement is not necessarily true. This is a hybrid SPI. Perhaps not something you are used to but never the less is something that is vastly used in LED lighting. It is specifically designed to work with the controllers already out there for RGB intelligent strips and protocol communication from SPI, DMX , DMX to SPI, Light-O-Rama and so on. You want to call it single line communication, that is fine and I respect that, but that is not what the LED industry is calling it. The LED industry is spreading like a wild fire in all directions. There are tons of manufacturers with their own protocols. But for majority, they use standards to communicate with other devices. WS2811 is a common chip used in LED lighting and the Intelligent Strips readily available from China (they are beating our pants off). Most of these controllers do allow selection of WS2811 as a receiving end of the data signal and have in place the protocol to communicate with WS2811. I am more concerned with the products out there and how my device can communicate with variety of controllers without worrying about how to manage the transfer of data, the timing and other required knowledge to create a brand new controller (not my objective). It is a simple board to be retrofitted in High Power RGB to communicate with what is readily available. They call it SPI to distinguish it from Dumb RGB and DMX.

Regards,
Rom
P.S.: I appreciate it very much if you have something to say to me, just do so. Instead of talking down or addressing me as a passive third party. Many thanks!
 
Last edited:

EvilGenius

Member
Mike
I love to have your input as you may have a simpler and cheaper way to implement the objective of this post.
I do encourage you to read the original post and challenge you to come up with a simple board that can accomplish this objective. Takes only couple of hours to design, cost maximum of $1 for parts, it is compact, and does not require advance knowledge of electrical engineering and programming for average Joe out there.
Regards,
Rom
 

EvilGenius

Member
Based on the simulation of the new circuit:
Vbe2=0.64 (it does not reach full saturation)
Vbe1=0.75
Vb1=Ve2-Vbe2-Vbe1=1.53
Ie2=303-289=14ma
Ib2=< 0.28ma
Ic2= 13.72ma
Ic1=284ma
Ib1=4.78ma
R2 is used to take the power stress off of Q1
Rx is used to take the slack Vf difference between Red and G/B also to bring down the voltages to take stress off Q1 and Q2
Pq1= Vq1 x Iq1 = (2.28-0.85) x (303-14+0.28)= 413mw (within specs with room for deration)
 
Last edited:

EvilGenius

Member
Just a note: look at this
It is an interesting device. I think this is a controller not receiver. Also at a quick glance it operates on 5v which is ideal for 5v intelligent strips but not 12v version nor the High power LED. I don't believe it can handle 300ma per channel! But I am sure you can create a interface with it to accomplish the job. Not sure if it can communicate with other cheap controllers out there.
There is a device with 27 SPI outputs (9 RGB pixels) on one board that receives DMX and converts it to SPI that a WS2811 can understand. But it is pricey and requires your pixels to be more centralized instead of spread out (5-10 feet away from each other). I don't claim I know all the products out there, but I have been searching for quite a while for such device.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top