SK6812RGBW (Smart RGBW LEDs) and Picaxe 14M2

mark713

New Member
Hi,

I would class myself as a novice and still learning, but need a little help with this if its possible, I have searched for some time and although there is plenty of Arduino and other controller articles out there, unfortunately none of them help me.

I have some SK6812RGBW which is a smart LED / Neopixle, looking at the data sheet I have been trying to bit-bang the sequence required to get them to illuminate, just so I can get an understanding of the protocol and sequence to make them work,

looking in Picaxe Manual 2, from what I have read it appears that it is unable to do the speeds I require. The LEDs work by receiving 32bits of data per led from the MCU, the bits have a period of 1.25uS(+/-600nS) which comprises of the following:-
0code = time high 0.3uS followed by time low 0.9uS
1code = time high 0.6uS followed by time low 0.6uS

R7 R6 R5 R4 R3 R2 R1 R0 G7 G6 G5 G4 G3 G2 G1 G0 B7 B6 B5 B4 B3 B2 B1 B0 W7 W6 W5 W4 W3 W2 W1 W0

SK6812RGBW Datasheet link

I have tried running the 14M2 at 32Mhz and utilising "pause", "pauseus" "PWM" and "HPWM".
I have managed to get some to illuminate with the HPWM and the following simple code, this code sends multiple 1code bits to the led.
I got the PWM code with Picaxe pwmout wizard, Clock 32Mhz, PWM freq 800kHz with a 50% duty cycle, this achieves the 1code structure.

Code:
setfreq m32

init:
hpwm 0,0,%0001,9,20
hpwm off
goto init

(Just to expleain, I have 5 of these connected together, with the above code it illuminates RGBW at full intensity on the 1st LED and what looks like RGB at full intensity on the 2nd LED, the remaining are not illuminated. Deleting the "hpwm off" will illuminate all LEDs at full intensity after a reset command)

I am wondering and would like to know, is it possible to send out a single period from the HPWM? if so then I'm sure I could control the led by sending out 32 individual HPWM periods.

Or is there a better way to achieve my goal with another command?

I hope I have been concise enough and understandable.

Thank you for any advice given.

Regards, Mark.
 

Hemi345

Senior Member
I don't have any experience with these, but I'd probably try using the pulsout command.

Actually on a second look, even an X2 PICAXE might not be fast enough to control these at 64Mhz.
32MHz1.25us unit
64MHz0.625us unit
 
Last edited:

AllyCat

Senior Member
Hi Mark,

Sorry, I don't think there is any way to bit-bang those LEDs (with "useful" data) by a PICaxe (without a lot of additional hardware). The nominal data rate of the LEDs is given as 800 kHz, but the PICaxe can only bit-bang at about 1 kHz, or perhaps a few kHz if you're clever. For example, those LEDs use pulses with sub-microsecond widths, whilst PULSOUT operates in 10 us increments and more seriously the "overhead" between pulses is about 600 us. Those times can be reduced only by a factor of 8 in M2s or 16 in X2s by increasing their clocks to 32 / 64 MHz.

Yes, the HPWM (and PWMOUT) commands can set up a "continuous" stream of 0s or 1s, but I doubt if that is very useful. AFAIK, the only possibility is to use the SPI bus hardware, available only with PICaxe X2 devices, but I don't have any practical experience of these. If you do have an X2, then maybe somebody else will be able to suggest some test code.

Cheers, Alan.
 

mark713

New Member
Thank you for your replies and advice.

I thought the M2 may not be suitable, I'll purchase a couple of X2 chips and try those as it will aid my understanding and learning if nothing else.
I see posts and videos of these being controlled relatively easy with various hardware, I will see if there is a dedicated chip to control these LEDs.

Once again, Thank you for your replies

Regards,
Mark.
 

hippy

Technical Support
Staff member
From my notes -

APA102 - Easily controlled directly from any PICAXE.

WS2801 / WS2803 - Directly controllable by a fast enough PICAXE with appropriate code.

WS2811 / WS2812 / WS2812B / APA104 - Not controllable by PICAXE.

HL1606 / LPD8803 / LPD8806 - Uncertain

SK6812 / TM1804 / D7001 - Unknown

The SK6812RGBW seems to use a similar very high-speed protocol as the WS2812 chips so I suspect it won't be controllable with a PICAXE. Perhaps with external hardware but even then I think it may be unlikely. It's not something I would want to try to get working without a scope or logic analyser to hand.
 

mark713

New Member
Yes I've read that the SK6812 is an updated WS2812.

Thank you very much, that info is hugely appreciated and gives me something to work with.

Thanks again everyone, got some good info out of this 👍

Kind regards, Mark.
 

Bill.b

Senior Member
Hi Mark

I have used the WA2812 LEDS for my Christmas lights. The picaxe chips will not address these leds, I Used the PIC32MX*** chips for this project.
Got to the backshed forum for infomation on programming these LEDs.

Bill
 

mark713

New Member
Thank you Bill, I'll have a pop over and look at that, I've ot tried anything with those chips before 👍

Regards, Mark.
 
Thankyou for this feedback.
First off I will try using APA 102 lights, hopefully utilising a Blocky program for my 7 year old grandson first programming steps.
Then for the WS2812 I will see if an PicAxe can comunicate with an Ardunino nano such that the Arduino acts as an interface to the WS2812 lights themselves.
 

Bill.b

Senior Member
The simplest way to communicate with ws2812 LEDs is with a raspberry pi pico running mmbasic. The pico are about AU$5.80 each.
 

tmfkam

Senior Member
It is possible to use a (compiled) BASIC language to operate them. I've got a clock with a ring of 60 of these devices which is run from a PIC16F1829 (the Daddy of the 20M2), all programmed using BASIC.
 

Bill.b

Senior Member
All you require in mmbasic for the pi pico to address ws2812B leds is one line of code.

BITBANG WS2812 type, pin, nbr, value%[()

This command outputs the required signals to drive one or more WS2812 LED chips connected to 'pin'. Note that the pin must be set to a digital output before this command is used. 'type' is a single character specifying the type of chip being driven: O = original WS2812 B = WS2812B S = SK6812 ‘nbr’ is the number of LEDs in the chain (1 to 256). The 'value%()' array should be an integer array sized to have exactly the same number of elements as the number of LEDs to be driven. Each element in the array should contain the colour in the normal RGB888 format (i.e. 0 to &HFFFFFF).

Bill
 
Thankyou for your contrbutions.
However, I now have some sucess utilising APA102 lights. However, though I can get them iluminating by utilising 'SPI' from PicAxe Basic there is no direct way to Utilise SPI from within a Picaxe Blocky program. As such I am currently trying to bury the Picaxe Basic SPI alsost like a burried APA102 driver, while then allowing my young grandson to design a higher level blocky program to instigate the what the APA102 lights are doing. Its possible, just not very elegant Blocky wise.

'Its one thing to get youngsters to use Blocky to program 6 individual LEDS as traffic lights; Its what they then come up with that becomes fustrating'.
 
I had a fair bit of success burying the principle APA102 calls each within a subroutine where each one just 'dived down' the execute one line of a Picaxe Basic SPI call. It menas that the 'shnanagins' of designing what the APA102 lights are doing can be left to my grandsons own creative blocky skills.
 
Top