Snippet - WS2811 Led Strip SPI driver

I am no expert on WS2811’s, but from what I know, if the first WS2811 thinks it’s got the right data it’ll react and then pass it on. If it doesn’t think it’s got the right data, it won’t pass it on (which is what your scenario is).

that 5v values are close enough :slight_smile:

I will try to fire up a test (a couple of dead-bug style LEDs :slight_smile: ) and see what I can prove/disprove. I’m bound to screw something up somewhere :slight_smile: :stuck_out_tongue:

Possible issue - make sure you are using the non Ethernet firmware as that uses SPI as well.

WS2812B’s work fine for me on Cerb.

@ bill that’s a great point - the WS2811/12 are relying on the SPI peripheral for timing rather than it using an actual SPI configuration, so if you have other things relying on SPI they will get in the road of the WS2811 as the LEDs will not understand that the data being sent to the other SPI device is not meant for it.

I did forget you had WS2812B’s… should have asked you to test this :slight_smile:

Hi,

somehow it is still not working. I try later with a second Strip which i have cut off the one i bought.

The Firmware i have updated to “Non Ethernet” aswell as the config, which was delivered by FEZ Gadgeteer.

Somehow i am thinking that it is still the power supply. I was testing beside with a teensy 3.1. With this board, as soon as i connected the power to the board and the Strip, all LED’s started glowing. The board has a power supply of 5V, so i was able to use the same supply for the board and the Strip. But there i had the Problem that the adressing also didnt worked. i was not able to turn them off, or to define a Color.

I realy would like to get it to work. I dont mind bying a new board or Strip, as long the board is as small as possible… And c# would be great because i dont realy like c++ :slight_smile:

Do you might have any other suggestions?

@ Bill Gates : would it mind you to send me an detailed plan of Hardware, wiring and Setup of your Project, so i can do this 1:1 on my side? If it is too much for the Forum i can also give you my email…

Kind regards
Ralf Röttcher

@ trider666 - Ping me a PM

Hi Bill,

I Need 5 more Posts to send a PM :slight_smile: i am quite new in this Forum, although i use some fez devices…

Well, now 4 more Posts…

but i have created a temporary email for you, where you can contact me : 123@ trider.de

Kind regards,
Ralf Röttcher

I saw a neat idea for driving the WS2818B type of addressable LEDs. like this Best WS2812B 5050 RGB LED, Chip-Built-in, 100 pack .
Use the SPI peripheral running at 4 times the clock rate of the LEDs (4*800kHz for WS2818B)
and send multiple bits to make up the asymmetrical signal.
high byte low byte order
1 is 11100000 00001110
0 is 10000000 00001000

I have implemented this on a 16MHz MSP430 and it works fine using the SPI system. I haven’t tried it on a Maple yet.

Hi Matt, welcome to the .net micro framework community :wink: :wink:
The approach this driver/project uses is overcooking SPI too…

@ Brett - Does the Ethernet warning include the Cobra II WiFi version?

The reason I ask is that I’m trying to run a set of 24 WS2811s that I got as part of the Espruino package I backed, and I’m not having much luck.

I tried both the SPI1_MOSI on the edge of the board, and the Gadgeteer socket. On the latter, if I hook up an LED as suggested earlier in the thread, I appear to be seeing data sent (i.e. the LED blinks periodically), and I’ve verified that the LEDs are getting voltage by testing the opposite end of the strip from the supply.

So, with power and signal, I should be getting lights, but no dice. I know the strip works, because I’ve gotten it to work with the Espruino board, using the exact same power supply (GHI battery module).

Betting it’s probably something simple, but at the moment, I’m stumped.

Any suggestions for further troubleshooting? Should I go ahead and flash the board with the non-Ethernet firmware?

Cobra2 WiFi is a premium device so you can’t flash the non-Ethernet firmware, it doesn’t apply :slight_smile:

I ran this code on my Cobra2Wifi, and I’ll check where I had the connections set to, but I had no problem doing exactly what you’re doing. Actually I just checked my code, and it is using SPI1…

            WS2811Led MyWS2811Strip = new WS2811Led(NumberOfLeds, Microsoft.SPOT.Hardware.SPI.SPI_module.SPI1, WS2811Led.WS2811Speed.S800KHZ, 2.25);

@ Brett - Where did you have the MOSI connected? On the connector on the edge, or the S socket?

electrically, they’re connected, so it should not matter. :slight_smile:

But from memory I used my custom screw-terminal to Gadgeteer socket connector, so I was connected via a G cable to the socket. I’ll verify when I get home in a few hours if that’s ok?

BTW, hey nice to see you around here ! :wink:

@ Brett - No hurry…just an experiment, to try to keep my hardware chops from getting too stale. :slight_smile:

Thanks for the kind words…I know it’s been a while. Work got somewhat all-consuming for a while, but that’s changed for the better.

Both SPI (edge and socket) connections are connected electrically? I guess that makes sense, since you can have multiple SPI devices, but since they’re labeled differently, I guess I incorrectly assumed they were separate.

OK, I checked.

My setup is 5v power coming from “big” power source that can run my 5m length, but is also powering the mainboard, so they’re all connected in a screw-terminal block - the GND to terminal 10, the 5v to terminal 2. I have powered BOTH ends of my string - so the “in” wires share a terminal with the INPUT end of the string of LEDs as well as a two-core (heavy) wire that runs to the “out” end of the LED string.

I have the “SI” (serial in) wire from the LEDs connected to terminal 7 (the MOSI pin)

I have the “CK” (clock) wire from the LEDs connected to terminal 9 (the CLK pin)

In code I am using SPI port 1.

I thought the WS2811 didn’t use clock?

My string only has 3 wires…DI (data in), Ground, and Voltage.

OK, what time is it over there? You passed my test and it’s obvious you’re not asleep !

LPD5505 has CLK, that’s what I have… but the code is the same :slight_smile:

Nearly midnight, and I should be.

Thanks for the sanity check. Will have to look at this again after I’ve had some shut-eye.

Yes - a nice surprise this morning! Was wondering if perhaps if the change at the top somehow caused the slow down.

Well, can’t speak for anyone else, but in my case the slowdown had to do with my decision to leave Microsoft. Had a great run, almost 10 years, but it was clear to me that it was time to move on and try something new.

So now I’m freelance, doing consulting and training, including some videos for WintellectNOW on game development using HTML5: http://www.wintellectnow.com/Videos/Index?instructorName=G.%20Andrew%20Duthie

Now if I can just get my blinkies working… :wink: