RBG LED WS2812 Adafruit NeoPixel - anyone got it working
Moderator: Benj
- Jay Dee
- Posts: 398
- Joined: Tue Aug 18, 2009 6:42 pm
- Has thanked: 121 times
- Been thanked: 154 times
- Contact:
RBG LED WS2812 Adafruit NeoPixel - anyone got it working
Hi Guys,
I've revisiting an old RGB project.. and saw an RGB stick with 8 LED from Adafruit, available in the UK.
http://proto-pic.co.uk/neopixel-stick-8 ... d-drivers/
Ju8st happens to be more than ideal but has anyone had any luck driving the WS2812 programmable LEDs..
The issue I believe is mostly with getting very accurate timing for the serial programming.
a Logic Zero requires 0.35uS High, 0.8uS Low (both parts +/-0.15uS)
a Logic One required 0.7uS High, 0.6uS Low (both parts +/-0.15uS)
This is far finer than I'll achieve with a delay macro!
Tech and Spanish Dude discussed it over on the french forum but my french is p*ss poor conversational at best!
So anyone had a play with these little blighters? we all love a bit of flashy LED stuff!
J.
I've revisiting an old RGB project.. and saw an RGB stick with 8 LED from Adafruit, available in the UK.
http://proto-pic.co.uk/neopixel-stick-8 ... d-drivers/
Ju8st happens to be more than ideal but has anyone had any luck driving the WS2812 programmable LEDs..
The issue I believe is mostly with getting very accurate timing for the serial programming.
a Logic Zero requires 0.35uS High, 0.8uS Low (both parts +/-0.15uS)
a Logic One required 0.7uS High, 0.6uS Low (both parts +/-0.15uS)
This is far finer than I'll achieve with a delay macro!
Tech and Spanish Dude discussed it over on the french forum but my french is p*ss poor conversational at best!
So anyone had a play with these little blighters? we all love a bit of flashy LED stuff!
J.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: RBG LED WS2812 Adafruit NeoPixel - anyone got it working
Hello,
I have used similar LEDs on my project here.
[/youtube]
Source code as available from here.
http://www.matrixtsl.com/mmforums/viewt ... =25#p57182
To output the signals to the LEDs I used the ECIO40P16 hardware though the EB091 will also be fast enough to work.
I have used similar LEDs on my project here.
[/youtube]
Source code as available from here.
http://www.matrixtsl.com/mmforums/viewt ... =25#p57182
To output the signals to the LEDs I used the ECIO40P16 hardware though the EB091 will also be fast enough to work.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Jay Dee
- Posts: 398
- Joined: Tue Aug 18, 2009 6:42 pm
- Has thanked: 121 times
- Been thanked: 154 times
- Contact:
Re: RBG LED WS2812 Adafruit NeoPixel - anyone got it working
Ah.. Nice one Benj !!
Will try to find time for a trawl this weekend. Blinky lights Ahoy!
Will try to find time for a trawl this weekend. Blinky lights Ahoy!
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: RBG LED WS2812 Adafruit NeoPixel - anyone got it working
Used them in this project too. Great little LEDs
[/youtube]
[/youtube]
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Jay Dee
- Posts: 398
- Joined: Tue Aug 18, 2009 6:42 pm
- Has thanked: 121 times
- Been thanked: 154 times
- Contact:
Re: RBG LED WS2812 Adafruit NeoPixel - anyone got it working
This guy did some great background work on the LEDs on his blog.
https://cpldcpu.wordpress.com/2014/01/1 ... rary-v2-0/
Regarding the data timing Tims basic conclusions were;
A reset is issued as early as at 9 µs, contrary to the 50 µs mentioned in the data sheet. Longer delays between transmissions should be avoided.
The cycle time of a bit should be at least 1.25 µs, the value given in the data sheet, and at most ~9 µs, the shortest time for a reset.
A “0” can be encoded with a pulse as short as 62.5 ns, but should not be longer than ~500 ns (maximum on WS2812).
A “1” can be encoded with pulses almost as long as the total cycle time, but it should not be shorter than ~625 ns (minimum on WS2812B).
From the testing on another thread, managed to get an ECIO40P to output a pulse train of period 580ns, Low 140nS and Hi of 170nS using a bit of C code from Ben.
Given that the timing might not be as super precise as the datasheet implies.. it might yet be possible to get these lower speed PICs to crudely drive them... hmmm will keep looking.
https://cpldcpu.wordpress.com/2014/01/1 ... rary-v2-0/
Regarding the data timing Tims basic conclusions were;
A reset is issued as early as at 9 µs, contrary to the 50 µs mentioned in the data sheet. Longer delays between transmissions should be avoided.
The cycle time of a bit should be at least 1.25 µs, the value given in the data sheet, and at most ~9 µs, the shortest time for a reset.
A “0” can be encoded with a pulse as short as 62.5 ns, but should not be longer than ~500 ns (maximum on WS2812).
A “1” can be encoded with pulses almost as long as the total cycle time, but it should not be shorter than ~625 ns (minimum on WS2812B).
From the testing on another thread, managed to get an ECIO40P to output a pulse train of period 580ns, Low 140nS and Hi of 170nS using a bit of C code from Ben.
Given that the timing might not be as super precise as the datasheet implies.. it might yet be possible to get these lower speed PICs to crudely drive them... hmmm will keep looking.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: RBG LED WS2812 Adafruit NeoPixel - anyone got it working
Great news, let us know how your getting on.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Flowcode v5 User
- Posts: 211
- Joined: Tue Feb 19, 2013 9:51 pm
- Has thanked: 72 times
- Been thanked: 177 times
- Contact:
Re: RBG LED WS2812 Adafruit NeoPixel - anyone got it working
You might want to look into the application note pointed out by a forum member in this post:
http://www.matrixtsl.com/mmforums/viewt ... lit=ws2812
Flowcode 6 now supports that chip, so you can ignore the parts of the post that add it to the chip list.
I was a bit curious about this since I like "flashy stuff" too, so I made a program to try it out..
Here are the approximate timings: for a (1) .8us High, .4us Low and for a (0) .4us High, .8us Low.
Edit: Changed micro and adjusted timings.
http://www.matrixtsl.com/mmforums/viewt ... lit=ws2812
Flowcode 6 now supports that chip, so you can ignore the parts of the post that add it to the chip list.
I was a bit curious about this since I like "flashy stuff" too, so I made a program to try it out..
Here are the approximate timings: for a (1) .8us High, .4us Low and for a (0) .4us High, .8us Low.
Edit: Changed micro and adjusted timings.
- Attachments
-
- flashy_stuff_experiment.fcfx
- (9.12 KiB) Downloaded 601 times
Last edited by Kenrix2 on Tue Sep 08, 2015 10:36 pm, edited 1 time in total.
- Jay Dee
- Posts: 398
- Joined: Tue Aug 18, 2009 6:42 pm
- Has thanked: 121 times
- Been thanked: 154 times
- Contact:
Re: RBG LED WS2812 Adafruit NeoPixel - anyone got it working
Hi Guys,
and Thanks Kenrix, I'm away on Event so not had much time to study the other post in detail yet but will go through when I'm back in the UK.
I was working on getting a nice fast bit bang output from the ECIO40P.. I did manage to get a very crude 80ns pulse! For improving my own understanding, I decided to write the section that needs to run as fast as possible in C, I can then trim it down, remove any bloat and get somewhere close to the actual timing needed to function.
The is the first bit of C code I've inserted into Flowcode. I know there are errors as boostC wont compile it so I would really appreciate someone pointing out the silly syntactical errors proper way to call FC variables...
If it helps any...The flowcode attached is the 'work in progress' test program, a highly chopped down version of Bens Infinity mirror FC.
The above C code is used in the refresh macro.
Thanks for any pointers.
and Thanks Kenrix, I'm away on Event so not had much time to study the other post in detail yet but will go through when I'm back in the UK.
I was working on getting a nice fast bit bang output from the ECIO40P.. I did manage to get a very crude 80ns pulse! For improving my own understanding, I decided to write the section that needs to run as fast as possible in C, I can then trim it down, remove any bloat and get somewhere close to the actual timing needed to function.
The is the first bit of C code I've inserted into Flowcode. I know there are errors as boostC wont compile it so I would really appreciate someone pointing out the silly syntactical errors proper way to call FC variables...
Code: Select all
Int count;
for(count=0; count<=8; count++)
{
latc = 0x80;
if(FCL_COLVAL&0x80)
{
asm { Nop };
latc = 0x00;
} //Close IF
else
{
asm { Nop Nop Nop};
latc = 0x00;
} //Close Else
FCL_COLVAL<<=1 //Bitshift Byte for next time around loop
} //Close For Loop
If it helps any...The flowcode attached is the 'work in progress' test program, a highly chopped down version of Bens Infinity mirror FC.
The above C code is used in the refresh macro.
Thanks for any pointers.
- Attachments
-
- NeoPixel_Test3_Nop_ECIO40P.fcfx
- (11.96 KiB) Downloaded 553 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: RBG LED WS2812 Adafruit NeoPixel - anyone got it working
Hello,
I can see a couple of problems.
This should probably be.
Another line that BoostC won't like is this.
This should instead be like this.
I can see a couple of problems.
Code: Select all
Int count;
Code: Select all
char count;
Code: Select all
FCL_COLVAL<<=1
Code: Select all
FCL_COLVAL = FCL_COLVAL << 1
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Jay Dee
- Posts: 398
- Joined: Tue Aug 18, 2009 6:42 pm
- Has thanked: 121 times
- Been thanked: 154 times
- Contact:
Re: RBG LED WS2812 Adafruit NeoPixel - anyone got it working
Cheers Ben,
Taken an hour to bash my way through but the following C code now compiles.. back at the office in a day or so and will flash it to an ECIO and see whjat we get in hardware.
Taken an hour to bash my way through but the following C code now compiles.. back at the office in a day or so and will flash it to an ECIO and see whjat we get in hardware.
Code: Select all
char count;
for(count=0; count<=8; count++)
{
latc = 0x80;
if(FCL_COLVAL&0x80)
{
asm
{
Nop
}
latc = 0x00;
} else {
asm
{
Nop
}
latc = 0x00;
}
FCL_COLVAL = FCL_COLVAL << 1; //Bitshift Byte for next time around loop
} //Close For Loop
- Jay Dee
- Posts: 398
- Joined: Tue Aug 18, 2009 6:42 pm
- Has thanked: 121 times
- Been thanked: 154 times
- Contact:
Re: RBG LED WS2812 Adafruit NeoPixel - anyone got it working
The C code worked great.. had to play around the the 'Nop' commands to get the timing right. It does appear that the actual timing requirements are quite broad. Sticking to the limits previously discussed it works fine for me.
Attached is a working test routine for an ECIO40P driving 8 neopixels.
NOTE
If you are using anything other than an ECIO40P, ECIO28P, (18F4455 or similar) you'll need to re-tweak all of the Nop timings. It needs a fairly fast 8bit PIC, the ECIO's internal clock is running at 48Mhz.
This test program writes to the whole C port even though data is only output on C7.
If you writing to lots of Neopixels or doing something fancy.. you'll need more grunt than this 8 bit micro! But for real basic stuff it works. Good enough for the prototype my customer needs.
Hope this helps anyone else playing with Neopixels.. have fun.
J.
Attached is a working test routine for an ECIO40P driving 8 neopixels.
NOTE
If you are using anything other than an ECIO40P, ECIO28P, (18F4455 or similar) you'll need to re-tweak all of the Nop timings. It needs a fairly fast 8bit PIC, the ECIO's internal clock is running at 48Mhz.
This test program writes to the whole C port even though data is only output on C7.
If you writing to lots of Neopixels or doing something fancy.. you'll need more grunt than this 8 bit micro! But for real basic stuff it works. Good enough for the prototype my customer needs.
Hope this helps anyone else playing with Neopixels.. have fun.
J.
-
- Posts: 94
- Joined: Wed Jan 16, 2013 11:37 am
- Has thanked: 56 times
- Been thanked: 16 times
- Contact:
Re: RBG LED WS2812 Adafruit NeoPixel - anyone got it working
Hey guys, I want to control some leds neopixel.
Long ago, I thought I saw a component to flowcode6 this led.
It's posible?? I'm not sure.
Thank you
Long ago, I thought I saw a component to flowcode6 this led.
It's posible?? I'm not sure.
Thank you
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: RBG LED WS2812 Adafruit NeoPixel - anyone got it working
Hello,
I would have made a component a while back but the timings to drive the LEDs were a bit too tight to reliably calculate based on clock speed and device family. With a bit of time and attention it probably could be done.
The alternative LED modules with Data and Clock data lines are far easier to control as you can simply clock out the data at your own speed. Therefore we could make a component to drive these.
I would have made a component a while back but the timings to drive the LEDs were a bit too tight to reliably calculate based on clock speed and device family. With a bit of time and attention it probably could be done.
The alternative LED modules with Data and Clock data lines are far easier to control as you can simply clock out the data at your own speed. Therefore we could make a component to drive these.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 94
- Joined: Wed Jan 16, 2013 11:37 am
- Has thanked: 56 times
- Been thanked: 16 times
- Contact:
Re: RBG LED WS2812 Adafruit NeoPixel - anyone got it working
Hi Benj.
What I want to try that put only in asm code routine to set the output to "1" and "0" to get the necessary fast time.
No program in assembly, I would like to put in the code block C ASM code to activate and deactivate the output.
Thank you
What I want to try that put only in asm code routine to set the output to "1" and "0" to get the necessary fast time.
No program in assembly, I would like to put in the code block C ASM code to activate and deactivate the output.
Thank you
- RobH
- Posts: 95
- Joined: Wed Sep 11, 2013 7:51 pm
- Has thanked: 29 times
- Been thanked: 17 times
- Contact:
Re: RBG LED WS2812 Adafruit NeoPixel - anyone got it working
BenJ,
I could use a NeoPixel component if you could make it.
I could use a NeoPixel component if you could make it.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: RBG LED WS2812 Adafruit NeoPixel - anyone got it working
Hi Rob,
I made a product using these LED strips and have got quite badly burnt, they work, then they dont, then they do... My table works well but I think that's because I don't really care which LED is LED 1. I don't think I want to go near them again.
The strips with the clock and data signals work very well and I would recommend using these instead if your making a product and don't want to be ripping your hair out when the customer out in the field is saying they don't work.
I made a product using these LED strips and have got quite badly burnt, they work, then they dont, then they do... My table works well but I think that's because I don't really care which LED is LED 1. I don't think I want to go near them again.
The strips with the clock and data signals work very well and I would recommend using these instead if your making a product and don't want to be ripping your hair out when the customer out in the field is saying they don't work.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- RobH
- Posts: 95
- Joined: Wed Sep 11, 2013 7:51 pm
- Has thanked: 29 times
- Been thanked: 17 times
- Contact:
Re: RBG LED WS2812 Adafruit NeoPixel - anyone got it working
Sounds horrible! I've got them working fine in Arduino. I guess I'll stick with that.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: RBG LED WS2812 Adafruit NeoPixel - anyone got it working
Hi Rob,
I had them working fine, It wasn't until we actually tried them outside of the lab on a mains PSU rather then a DC bench supply that they started having issues. Lots of issues. I was converting from 3V3 to 5V so that could have been part of the problem.
Could be the Arduino lib is doing something special but I couldn't crack it from reading datasheets.
Do you have a link to the Arduino library and I will have a look at how they are doing things.
I had them working fine, It wasn't until we actually tried them outside of the lab on a mains PSU rather then a DC bench supply that they started having issues. Lots of issues. I was converting from 3V3 to 5V so that could have been part of the problem.
Could be the Arduino lib is doing something special but I couldn't crack it from reading datasheets.
Do you have a link to the Arduino library and I will have a look at how they are doing things.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- RobH
- Posts: 95
- Joined: Wed Sep 11, 2013 7:51 pm
- Has thanked: 29 times
- Been thanked: 17 times
- Contact:
Re: RBG LED WS2812 Adafruit NeoPixel - anyone got it working
AdaFruit has some files on GitHub:
https://github.com/adafruit/Adafruit_NeoPixel
https://github.com/adafruit/Adafruit_NeoPixel
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: RBG LED WS2812 Adafruit NeoPixel - anyone got it working
Thanks Rob,
It's mostly written in assembler but looks interesting. I'll ponder on it.
It's mostly written in assembler but looks interesting. I'll ponder on it.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Jay Dee
- Posts: 398
- Joined: Tue Aug 18, 2009 6:42 pm
- Has thanked: 121 times
- Been thanked: 154 times
- Contact:
Re: RBG LED WS2812 Adafruit NeoPixel - anyone got it working
An alternative..
I got my 8 NeoPixels working fine but have recently started using the APA102C leds, Uses SPI.. only MOSI and Clock, 5V, Gnd. Its really simple to drive and no special timing at all. Certainly an option for those on new projects and have not commited to the NeoPixels. They do various density strips and loose 5050 packages, there is an LED strip with 144 per meter, 20ma per colour and 60mA per LED so can get quite power hungry at full brightness.
https://www.pololu.com/product/2557
J.
I got my 8 NeoPixels working fine but have recently started using the APA102C leds, Uses SPI.. only MOSI and Clock, 5V, Gnd. Its really simple to drive and no special timing at all. Certainly an option for those on new projects and have not commited to the NeoPixels. They do various density strips and loose 5050 packages, there is an LED strip with 144 per meter, 20ma per colour and 60mA per LED so can get quite power hungry at full brightness.
https://www.pololu.com/product/2557
J.
Re: RBG LED WS2812 Adafruit NeoPixel - anyone got it working
Will Flowcode 7 support the APA102 in the future? I have several from Pololu and would like to use them on my WS2812 projects.
- Jay Dee
- Posts: 398
- Joined: Tue Aug 18, 2009 6:42 pm
- Has thanked: 121 times
- Been thanked: 154 times
- Contact:
Re: RBG LED WS2812 Adafruit NeoPixel - anyone got it working
Hi,
I know its not a flowcode component but the following is an example extracted from a project that I used APA102C leds.
They turn out to be pretty simple using an SPI component to push strings of data into the LED strip.
My example is only setup for 8 LED and the LED data is hard-written to an byte array. I've not tested this example on hardware, as I'm away from office but I know the routine works as I've had it running RGB ID and running lights on a LeMans LMP1 race car all year. Another day at the office.
I know its not a flowcode component but the following is an example extracted from a project that I used APA102C leds.
They turn out to be pretty simple using an SPI component to push strings of data into the LED strip.
My example is only setup for 8 LED and the LED data is hard-written to an byte array. I've not tested this example on hardware, as I'm away from office but I know the routine works as I've had it running RGB ID and running lights on a LeMans LMP1 race car all year. Another day at the office.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: RBG LED WS2812 Adafruit NeoPixel - anyone got it working
That's a nice picture Some real electronics, also thanks for the example.
Here's a really quick go at a component, the current usage setting is currently a global property rather than a LED by LED value. Saves a bit of RAM space but more limiting in terms of what you can do with it.
Just copy the file into your "Flowcode 7/Components" directory and restart Flowcode and the component should then appear under the outputs category.
Here's a really quick go at a component, the current usage setting is currently a global property rather than a LED by LED value. Saves a bit of RAM space but more limiting in terms of what you can do with it.
Just copy the file into your "Flowcode 7/Components" directory and restart Flowcode and the component should then appear under the outputs category.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel