Arduino Forum

Using Arduino => LEDs and Multiplexing => Topic started by: Emmeran on Oct 07, 2011, 03:54 am

Title: Cheap addressable RGB strip - how to control?
Post by: Emmeran on Oct 07, 2011, 03:54 am
Hey guys,

I found this rather cheap RGB LED strip on eBay:
http://cgi.ebay.com/ebaymotors/12V-Waterproof-5M-IC-D7001-digital-RGB-versatile-led-strip-l-controller-/220849026721?pt=Motors_Car_Truck_Parts_Accessories&hash=item336ba0b6a1

It arrived yesterday and I was planning on putting it behind the projector screen in my living room to do some atmo light. But as it turns out the strip doesn't use a shift register as one would suspect, at least not in the common sense.

I used my scope to try and reverse engineer what I need to send to the strip, but turns out it's doing some weird stuff and I'm unable to find any documentation anywhere.

Here's what I found so far, maybe somebody knows what this is:

The strip has four wires: GND +5V DTI CKI
DTI and CKI are on another source online called DAT_RECV and CLK_RECV so I was assuming a shift register with data and clock.

The scope told me a different story. There is a ~7bit signal both on CKI and DTI (but different ofc). Here's the timing of a "shift pixel" command in 10ths of microseconds (0.1us): (| means a falling/rising edge)
// DTI + 32 | 10 , 14 | 26 | 16 , 16 | 18 , 16 | 18 , 18 | 14 , 20 | 12 , 22 | 14 +
// CKI | 32 , 10 | 14 , 26 , 16 | 16 , 18 | 16 , 18 | 18 , 14 | 20 , 12 | 22 , 14 |   

Both lines are high by default, CKI becomes LOW, 3.2us later DTI becomes low as well, 1.0us later CKI rises to HIGH again etc.
Finally CKI becomes HIGH 1.4us after DTI.

Each of the areas between two | depict one bit. Both CKI and DTI are used to transfer actual data (or I'm misunderstanding something completely).

So far I achieved to do some stuff, like shifting pixels through the strip, but only in the direction of the shift register and only in RGB + mix of full red, full green etc. The controller that came with it is able to do all kinds of nice effects, but it seems that the ucs on the strip are doing some of the controlling themselves (1 uc handles data i/o tells 2nd uc what to do. 2nd uc controls 8 rgb LEDs => 24 channel LED driver).

Thanks for any help and sorry for the long post! :)

I hope it'll be possible to hack this strip, since adafruits alternative has the disadvantage of price and availability. :-/
Title: Re: Cheap addressable RGB strip - how to control?
Post by: assalible on Nov 09, 2011, 09:32 am
Without too much analysis could bet, it's I2C. Please draw the waveforms, so I could decode the address/data.
Title: Re: Cheap addressable RGB strip - how to control?
Post by: Grumpy_Mike on Nov 09, 2011, 10:15 am
The trick is to find out what those chips are between the LEDs. Can you spot a number on them?
Title: Re: Cheap addressable RGB strip - how to control?
Post by: milamber on Nov 09, 2011, 10:26 pm
I went looking for information on strips using d7001. Most of the strips I found used a combination D7001/D7002. With the explanation given:
D7001 with 24 outputs for the LED driver chips
D7002 for the bus driver chip

I couldn't find any specifications for either chip. But I am curious as to how it is working.
<edit with further info>
I found two images that I have attached but I will try direct linking to put them in this post:
(http://www.cntronics.com/editorfiles/20101222162438_1542.jpg)
From Google translate:
"Here(below) is a typical application circuit D7001/7002. The above is 8 5050 RGB LED, below the LED driver IC D7001 and bus transfer chips D7002. Only two external components resistor, a capacitor element is very small."
(http://cntronics.com/editorfiles/20101222162544_2792.jpg)
Frustratingly I can not find anything that even resembles a spec sheet for either the D7001 or the D7002. It does look like the D7002 just runs the BUS and the D7001 is just taking the DT and CK lines in and driving the LEDs.

I am interested as these look really nice and seem like they are at a good price.
Title: Re: Cheap addressable RGB strip - how to control?
Post by: assalible on Nov 10, 2011, 08:41 am
Just received Chinese versions from a manufacturer. Not too much info.

http://www.2shared.com/document/ppiMT2cR/D7001.html
http://www.2shared.com/document/LskBohqZ/D7002.html

The pins are labeled DAT and CLK or on the pinout SDA and SCL, which is I2C.
Title: Re: Cheap addressable RGB strip - how to control?
Post by: pictux on Nov 10, 2011, 10:40 am
..very interesting!
Title: Re: Cheap addressable RGB strip - how to control?
Post by: ratkins on Mar 05, 2012, 10:39 am
Check this thread out (http://waitingforbigo.com/2011/11/28/another-quick-library-update/#comment-234). The author of the FastSPI (http://code.google.com/p/fastspi/) library has a sample of a D7001-based strip and is planning on adding support.

I note the eBay URL you pasted says 12V but you say the strips are labelled 5V. Which is it? How much current do they draw? I'm interested in using these strips in a project of my own.

Cheers, Robert.
Title: Re: Cheap addressable RGB strip - how to control?
Post by: dgarcia42 on May 06, 2012, 12:36 am
Hi!  FastSPI author here - I do have a D7001 strip, but I haven't had a chance to figure out how it's talking yet, and my attempts to find datasheets have been limiting.  The next chipset on my chain is the TM1803 in high speed mode (just had a "oh, duh!" moment for how I can support it in my library, as well as re-work the TM1809/4 support so that the code is a bit cleaner, and not quite as ... delicate as it is right now).

If it's I2C - That can probably get me a bit closer to working out what's going on here.  Time to read up on I2C I suppose!  Also, it isn't clear to me whether it's 12 bits per pixel (a datasheet I saw talked about 4096 colors) or 12 bits per rgb pixel.  The former would be fantastic from a color leveling standpoint (most other chipsets I work with are 8 bits per pixel, 24 bits per rgb pixel).  The latter would be a bit limiting, I get higher than 4 bits per pixel w/hl1606.
Title: Re: Cheap addressable RGB strip - how to control?
Post by: ratkins on May 06, 2012, 10:52 am
Very keen to hear an update on this when you've got something to share, Daniel :-). Just about to order some of these strips myself, for this year's project.

Any first-hand info on the voltage for these strips, by the way? Is it 5V everywhere, or 5V signalling and 12V to power the LEDs like the LPD6803 strips I used last time?
Title: Re: Cheap addressable RGB strip - how to control?
Post by: thefloyd on May 16, 2012, 04:13 pm
Hi -
 I've got a 5M roll of this stuff, but my manufacturers in China refuse to give me any documentation on the strips so I refuse to order more. I like the lower power requirement of this strip versus the ws2801 and lpd8806 variants plus the lower cost.

I'm willing to give 1/2 meter long segments away to anyone who might be able to take a serious crack at getting this stuff to do anything useful. I'm a PIC micro guy myself, but even working arduino code should be easy enough to port over. I'm admittedly not a great hardware guy but I've spent 2 weekends blindly trying to send data to this and I've yet to get it to do anything useful.

The only catch is that any code given needs to be freely (as in no strings attached) redistributable.

Thanks!
-Patrick

Oh, PS the stuff I have is 5V across the board. I think the 12V variants (if they exist) would have to use the trick of stacking 3 LEDs per driver circuit making the strips not individually addressable. Also, these only seem to come from one source (there are other manufacturers reselling it but it seems that there's only one making it at this point). I've yet to see a 12V variant in all my dealings with manufacturers.
Title: Re: Cheap addressable RGB strip - how to control?
Post by: ratkins on May 17, 2012, 02:30 pm
I'd guess the Chinese manufacturers are reluctant to give out datasheets because they're worried about other manufacturers ripping of their designs. Which is funny, because the specs at least look a lot like these NXP chips:

http://ics.nxp.com/products/led.drivers/

Specifically:

http://www.nxp.com/documents/data_sheet/PCA9626.pdf

(I may, however, be talking completely out of my arse here. I would welcome this being pointed out if it's discovered by someone who does indeed know what they're talking about.)

Edit: Dicking with google translate I found this, which I think is meant to be a whitepaper, which has a little more information than is on the above diagrams (but not much):

http://translate.googleusercontent.com/translate_c?rurl=translate.google.com&tl=en&twu=1&u=http://www.cntronics.com/public/art/artinfo/id/80009061&usg=ALkJrhhmkOplKxDAMNvsX4G0PuRsMoxSbQ

Title: Re: Cheap addressable RGB strip - how to control?
Post by: thefloyd on May 19, 2012, 08:19 pm
Yeah, I'm guessing the same thing too, but it's pointless as the design is already well documented. If I were trying to rip off the strip itself I probably already have what I need. I don't see the point in withholding programming documentation from me (I tried asking them if they want to sell LED strips or they're trying to sell cheap shitty controllers - because it sure sounds like they're trying to protect the latter at the expense of the former but the language barrier doesn't help.) I've been buying from them for a while and told them I'd probably be able to (re)sell a lot of this stuff to hobbyists as the price is right, but only if we had the specs. No go..

The IC is manufactured by a company called DBIC (DBIC D7001, D7002) and I had found their website at one point. Rather unsurprisingly, they're a Chinese manufacturer too. This is probably a knockoff of someone else's chip design. I submitted requests to them (fudged it a little and said I was interested in using their product to design my own led strip) but got no replies back. The strips are sold under a part number "S301" across many "manufacturers", so I'm pretty sure they're all coming from one source. My main manufacturer claims this is their design - they are a large manufacturer of lighting, not a reseller - but it's hard to validate that as they've sold me products (controllers mainly) that look just like the same damn controllers everyone else sells. I have noticed most of the ws2801 strips (which I buy from them) from other sellers carry their part number on them, so they're at least a pretty big source of them. They may indeed be the main source of these too.

I think we'll only make progress with this once someone with the know-how can reverse engineer the protocol. I didn't buy a controller, but I could, and I do have a scope.. but I have no experience reverse engineering stuff at this low a level. If anyone has pointers, I'd be willing to request a controller in my next order with them.

I've posted what I have received from my manufacturers about these strips at:

http://www.insomnia.org/S301.pdf

Nothing exciting there, though, mostly just marketing blurb. I do think these are only 12 bit color strips though (4 for each of r, g, b) as the documentation claims 4k colors per LED (this _could_ be a controller limitation, too. I've received controllers where it's obvious someone used a regular 'int' to track the number of 'pixels' and thus they're useless for LED strip lengths > 8M).

I'm unfortunately stuck working this beautiful day for my day job, so I'm going to take a crack at trying to talk to this thing as if it were one of those PCA9626 chips today.. maybe I'll get somewhere if they used this chip as the inspiration for this design..

BTW - shameless plug for myself - I do sell the same strips Adafruit does at a better price and with better availability (since that's what started the thread) :). The same site with the PDF can take you to my store, if anyone is interested.
Title: Re: Cheap addressable RGB strip - how to control?
Post by: thefloyd on May 30, 2012, 09:53 pm
Just an FYI, I've still yet to have any luck getting these strips to do much of anything.

I do believe that the company that makes the ICs on these strips may indeed be the company manufacturing them, too. I came across this:

http://www.db-ic.com/dbic/EN/showservice.asp?id=61

db-ic.com is responsible for the D7001/D7002 chips as seen on these strips.

Still no datasheets or programming specifications, though.. :(
Title: Re: Cheap addressable RGB strip - how to control?
Post by: ratkins on Aug 09, 2012, 08:26 pm
With the help of some friends from the Amsterdam Hackerspace (http://techinc.nl) and the Meta group, I've hooked the controller for these strips up to a logic analyser and got some dumps. Bad news: it still doesn't make sense. Firstly, here are what a couple of the patterns look like looked like on a scope:

(http://dl.dropbox.com/u/1432370/S301/scope1.JPG)

(http://dl.dropbox.com/u/1432370/S301/scope2.JPG)

In both, the top is the clock line and the bottom is the data line. According to people there who know something about I2C this is not what an I2C clock signal ought to look like.

More interesting, here are a couple of dumps from the http://www.saleae.com/ a friend bought. Screen caps follow, but you can download the software from that link and play with the attached dumps yourself without owning the hardware.

(http://dl.dropbox.com/u/1432370/S301/mode17.png)
(http://dl.dropbox.com/u/1432370/S301/mode18.png)

It still doesn't make sense. For some of the patterns, after an initial burst of enthusiasm the controller seems to be sending nothing, despite the LEDs happily continuing their pattern. Maybe all the controller is doing is selecting one of a hundred or so patterns and telling the D7001 which one to display.

Links to the data files for the Salae: http://dl.dropbox.com/u/1432370/S301/R700-A%20LedController%20mode%2017.logicdata (http://dl.dropbox.com/u/1432370/S301/R700-A%20LedController%20mode%2017.logicdata), http://dl.dropbox.com/u/1432370/S301/R700-A%20LedController%20mode%2018.logicdata (http://dl.dropbox.com/u/1432370/S301/R700-A%20LedController%20mode%2018.logicdata)

Does any of the above help anyone? Doesn't look like my original project is going to come off now :(.
Title: Re: Cheap addressable RGB strip - how to control?
Post by: JoeN on Aug 09, 2012, 10:49 pm

It still doesn't make sense. For some of the patterns, after an initial burst of enthusiasm the controller seems to be sending nothing, despite the LEDs happily continuing their pattern. Maybe all the controller is doing is selecting one of a hundred or so patterns and telling the D7001 which one to display.


How many patterns are there that you can select from?  Are there many or fairly few?  If there are few, maybe you should just grab the waveforms and write a small library to basically play them back if that is all this product is capable of doing.  
Title: Re: Cheap addressable RGB strip - how to control?
Post by: ratkins on Aug 10, 2012, 12:13 am
There are about 100 patterns, according to the prebuilt controller. Capturing the waveforms and playing them back is something we were going to try, but I had to leave town before Ian (from Dangerous Prototypes) came back with his Bus Pirate :-).

Building a completely custom controller and running custom patterns on these LEDs is kinda the point, if I can't do that I might as well use the built-in controller.
Title: Re: Cheap addressable RGB strip - how to control?
Post by: Riva on Aug 10, 2012, 09:47 am
Any chance of getting some more samples of the controller output please? I know you said that the controller sends a burst of data then goes quiet but are the couple of examples you posted the entire output of one controller program select or just a subset?
EDIT: More questions,
If you listen to the DAT/CLK lines when the unit is doing a chase (assuming the controller does this) is the data continuous/repeated  between controller and first chip and if not what about between nth & nth+1 chips?
Title: Re: Cheap addressable RGB strip - how to control?
Post by: ratkins on Aug 13, 2012, 12:46 am
It's a little tricky, my friends with the logic analysers and oscilloscopes are in Amsterdam and I'm now in Las Vegas (and not returning to Amsterdam until at least next year.) I'll check out SYN Shop (the Vegas hackerspace) and see if anyone there can help.

The first dump is the whole output; the second is a subset but it repeats like that the whole way. I know it would help if I could get video of the patterns synced to the logic analyser dumps and I'll try for that.
Title: Re: Cheap addressable RGB strip - how to control?
Post by: Riva on Aug 13, 2012, 12:38 pm
Ok, I was hoping for more examples because I am wondering if it's just plain old serial.
It does not look like one leg is a clock for data on the second leg. Maybe one wire sends the speed and the other the pattern as a 7 or 8 bit RS232 serial with one start & one stop bit?
Title: Re: Cheap addressable RGB strip - how to control?
Post by: ratkins on Aug 13, 2012, 07:48 pm
I'd be surprised if that were the case, as upthread you can see the marketing pages which mention I2C and I also opened up the controller and found an I2C chip in there.
Title: Re: Cheap addressable RGB strip - how to control?
Post by: thefloyd on Aug 14, 2012, 09:00 pm
Doesn't explain the odd timing/waveforms, however when I was reading the datasheet for the PCA9626 chips they had a "go off and do this" mode for things like blinking/dimming and (perhaps, don't remember offhand) chasing.

Perhaps that's why the controller has a short burst of activity - it may just set the parameters and tell the D7001/D7002 chips to go off and do something. These strips may actually be more intelligent than the long chain of shift registers that the WS2801, LPD8806, and other strips are essentially made up of.
Title: Re: Cheap addressable RGB strip - how to control?
Post by: ratkins on Aug 14, 2012, 11:54 pm
That was my thought too. I've had some contact with the LV hackerspace crew and there are people interested in helping, so we'll get to it post-Burning Man :-)
Title: Re: Cheap addressable RGB strip - how to control?
Post by: ratkins on Sep 06, 2012, 10:14 am
It's now post-Burning Man :-). There were so many people out there this year with LED projects of various compositions, so I've started a forum for LED artists and technologists:

https://groups.google.com/forum/#!forum/led-nerds

Please join if you're interested in this stuff. Discussion of the S301 hacking may indeed continue there, but I'll report back when I've found something concrete.

Cheers, Robert.
Title: Re: Cheap addressable RGB strip - how to control?
Post by: Emmeran on Oct 03, 2012, 02:49 pm
Interesting that this thread got revived at some point.

I can tell you guys a bit more about what I found out myself. At one point I pretty much figured out the entire mechanism behind it, it's very unusual (at least to what I'm used to).

Unfortunately this is quite some time ago and I'm unsure if I still have any of my documents to this. In the end it turned out that this strip is useless for anyone who want's to address single LEDs fast.

There is one command that just shifts in a new color from the left but there's no latch, so the shift is done at once. The frequency you can do that with is not satisfying since when you go to the max (which I belive was something like 30 Hz for 5m) you get weird artifacts due to the missing latch. Also you cannot shift any color, but only red, green or blue or any on/off combination of those (yellow, white, etc.).

To get PWM you have to send another command where you make the strip mix all of it's current colors with the neighbouring color to the right or the left. And there's some other stuff, mixing segments of the strip etc.

If anyone is seriously interested, I can look for the documents, I might still have them on another PC.

In general I got to the conclusion that this strip is absolutely useless for anything else than what the controller that comes with it does. So if you just wanna light your room this one might be for you, but if you want to address each LED to display something then you should go for a different strip, which is also what I did.

My strip now serves as a remote controlled ceiling light for a friends living room.



PS:
There's no data/clock line. It's more like two intermixed serial lines with varying bit times within the single bits. And also command and value bits are mixed. It's a huge mess.
Title: Re: Cheap addressable RGB strip - how to control?
Post by: Riva on Oct 03, 2012, 06:58 pm
Quote
There's no data/clock line. It's more like two intermixed serial lines with varying bit times within the single bits. And also command and value bits are mixed. It's a huge mess.

When I suggested serial in an earlier post it did not get a good reception so I abandoned it. Almost feel I should have just pressed on with the thing. <sigh>
Well done by the way.
Title: Re: Cheap addressable RGB strip - how to control?
Post by: ratkins on Oct 03, 2012, 07:27 pm

If anyone is seriously interested, I can look for the documents, I might still have them on another PC.


If you can find them, it'd be great to have the info on line as a matter of record.

It's a bit of an arse that I bought 25m of the damn stuff  :~. S'pose we'll find a use for 'em somewhere with the stock controller. Either that or soldering practice.

In the meantime, these bad boys (http://www.aliexpress.com/store/product/4m-WS2811-LED-digital-strip-60leds-m-with-60pcs-WS2811-built-in-the-5050-smd-rgb/701799_638374848.html) seem to be the best current option.

Cheers, Robert.
Title: Re: Cheap addressable RGB strip - how to control?
Post by: Emmeran on Oct 04, 2012, 12:21 am
Well it's not the standard serial either. And in my opinion the strips are completely useless for anything else than decoration. You could disassemble the controller and try to use it as a remote switch maybe.

In another project I disassembled a cheap remote control for airplanes and found a very similar looking protocol (if you can call it that), so maybe it's some weird china standard that I don't know about.

Here's the old pde file from the software I wrote. Not sure if it's the newest version, but it contains some of the defines and timings.

Most important part is probably this:
Code: [Select]

//                      cccccc-ddddddd
//#define RAINBOW+COL 0b111110 011***1 // shifts a pixel for pwm
//#define SWIPE+M1+M2 0b111110 010***1
//#define SWIPE+MYST1 0b110010 010***1
//#define CMD_SETPWM  0b10**100010***0 // pwm speed for fading
//#define CMD_SHIFT   0b1***10 011***1 // shifts a pixel into the register
//#define SWIPE+MYST2 0b011110 010***1
//#define CMD_CLS1    0b01**10 0111*00 //?? before foreground paint, set background as well
//#define CMD_BG      0b01**10 0110*00 // paint background
//#define CMD_SWIPE   0b010010 010***1 //?? responsible for program 69
//#define CMD_CLS2    0b001010 0100000 //?? before background paint
//#define CMD_FG      0b00**10 0101*00 // paint foreground
//#define CMD_EMPTY   0b000010 0100001 // shifts pixels, removed bg, but not all of it


It took me quite a long time of fiddling with my oscilloscope, simply trying out all possibilities and combinations and some logical thinking to come up with the stuff. I think I had a better documented file as well, I'll have a deeper look later.

Warning:
some of the information in the document is probably conflicting and outdated.

Full file:
http://pastebin.com/2J8hcfEc