Controlling RGB LEDs With Only the Powerlines: Anatomy of a Christmas Light String

The RGB curtain predictably turns into a mess of wires when not used according to instructions.

As should be obvious from this blog, I am somewhat drawn to clever and minimalistic implementations of consumer electronics. Sometimes quite a bit of ingeniosity is going into making something “cheap”. The festive season is a boon to that, as we are bestowed with the latest innovation in animated RGB Christmas lights. I was obviously intrigued, when I learned from a comment on GitHub about a new type of RGB light chain that was controlled using only the power lines. I managed to score a similar product to analyze it.

Continue reading “Controlling RGB LEDs With Only the Powerlines: Anatomy of a Christmas Light String”

Power Analysis: Probing WS2812 RGB LEDs

Power analysis is a technique to probe the inner workings of an integrated circuit by measuring changes in the supply current. Whenever a logic gate switches, it will cause a tiny current spike that can be measured externally. By inspecting the temporal variation, especially in reaction to an external signal, it is often possible to deduce information about the construction of the IC.

A few years ago I used a logic analyzer to investigate the protocol of the, then new, WS2812 RGB LED. So, why not revisit this topic to test my newly acquired deep sampling oscilloscope?

Continue reading “Power Analysis: Probing WS2812 RGB LEDs”

Intelligent 7-Segment Display

Time for another project with a super-low-cost microcontroller. But what to design? Ever since seeing a project where a $0.03 MCU controls $40 worth of intelligent RGB LEDs, I have been wondering whether this is the right place to use these devices. At this price point, doesn’t it seem to make more sense to dedicate one MCU to one LED each and use it to implement a fancy node-controller? It has always appealed to me to design my own protocol. However, just copying a WS2812 RGB LED or similar seemed to be a bit pointless…

Continue reading “Intelligent 7-Segment Display”

The “terrible” 3 cent MCU – a short survey of sub $0.10 microcontrollers.

Like many others, I was quite amazed to learn about a microcontroller sold for only 0.03 USD via the EEVblog last year. How was this possible? Many assumed this was a fire sale of an old product. Digging a bit further, it became apparent that there is an entire market segment of ultra-low-cost microcontrollers. Almost all of them are products of rather unknown companies from China or Taiwan. This write up summarizes my findings in this rather peculiar niche.

We already learned that there is a large variety of very powerful $1.00 microcontrollers, but what about the $0.10 MCU? Are they indeed all “terrible”, as suggested elsewhere?

Continue reading “The “terrible” 3 cent MCU – a short survey of sub $0.10 microcontrollers.”

SK9822 – a clone of the APA102?

Two years ago I took a deeper look into the APA102. Although it was more expensive than the common WS2812, and harder to come by, it had some intriguing properties. The main benefits are a timing-insensitive  SPI interface, allowing easy interfacing to standard periphery, and a much higher PWM frequency of >19kHz, making the APA102 almost flicker free.

So much about that. Considering how things with LEDs from China go, it should not take too long for clones to appear? Indeed! Recently, several comments showed up on my blog, reporting about issues with APA102 LEDs they bought. It quickly turned out that these were SK9822, APA102 clones from the same company that already brought the SK6812 to us, a WS2812 clone.

One of these people was Mike. He developed the Weblight, a WebUSB controlled RGB LED. The prototype (shown below, red pcb) worked well, but when he commissioned a small production run (black pcb), the LED started to show odd update behavior. Mike was nice enough to share a couple of boards with me for further investigation.

sidebysidenotext Continue reading “SK9822 – a clone of the APA102?”

DICE10 – electronic dice controlled by two GPIO.

Yay,  another mini-project with the ATtiny10!

dice10

A while ago I devised a scheme to drive an electronic dice with only two IO lines. I finally found the time and motivation to build up a small design using this as an entry for the hackaday 1k compo. Please find project details on the hackaday.io page or the github repository.

dice10_withtext

Understanding the APA102 “Superled”

A couple of weeks ago I reported about a new type of RGB-LED with integrated controller, the APA102. One of the interesting new features of this device is a two-wire SPI interface instead of the proprietary one-wire protocol of the more common WS2812. Many microcontrollers have hardware SPI functions, which allow easy control of these LEDs, as opposed to timing critical bit banging. But it turned out this was not the end of the story. As pointed out by Bernd in a comment, there is some discrepancy between the datasheet and the actual behavior of the devices when it comes to the “end frame”. Reason enough to subject the APA102 to more scrutiny.

The diagram below summarizes the APA102 protocol as found in the data sheet.

programming_incorrect Continue reading “Understanding the APA102 “Superled””

Measuring the length of a WS2812 string

Recently, I encountered an interesting problem: How do you measure the length of a WS2812 programmable RGB-LED string electronically? That is, just using signals that are already there. This can be useful if you want a LED controller to adapt its pattern according to the string that is connected to it, or simply for diagnostic reasons.

WS2812 strings are usually controlled by using one serial output signal only. The LEDs are daisy chained and you simply push out data for all LEDs without any feedback. If there are fewer LEDs on the string, the data for the last LEDs is ignored.

An intuitive approach to counting the number of LEDs is to feed the output of the last LED of the string back into the microcontroller. According to the WS2812 protocol, the output of LED number n is low until data for n+1 LEDs has been pushed to the string. To count the number of LEDs, data is fed to the string until a rising transition is detected on the output. A relatively easy way to implement this is by using a pin change interrupt on the AVR, or a similar feature on other microcontrollers.

While this works nicely, it has the disadvantage of requiring another wire. Can we do it without introducing any additional connections? Continue reading “Measuring the length of a WS2812 string”

APA102 aka “Superled”

After clones and variations of the venerable WS2812, there finally seems to be a new RGB-LED with integrated controller that actually improves on several characteristics: The APA102, also known as “Superled”. There are two versions on the market, the APA102 and the APA102C, as shown below.

apa102 Continue reading “APA102 aka “Superled””