Friday, July 30, 2021
Home » Flowstone Workshop » Flowstone Workshop 19

Flowstone Workshop 19



Welcome to the FlowStone Workshop number 19, where we give you a beginner’s guide to computer programming using the FlowStone graphical programming language.

In this issue we are going to look at how to program addressable LED strips so you can add some bling to your robots.

What are addressable LED strips?

Our LED strip stuck to some aluminium angle.

Low cost, addressable LED strips are a relatively new invention, certainly at this price point. However it could be said that the famous Night Rider KIT Car was a pioneer of this technology! From around $15to $30 you can get a 1m strip with around 60 high-powered LEDs, often in a silicone waterproof coating or flexible plastic tube. The main difference between addressable and non-addressable is that for the address- able version each LED can be controlled independently of the others as far as brightness and color. For the non-addressable LED strips the whole strip is controlled with a global brightness and color. This independent control means you can display an almost infinite range of patterns and colors with pinpoint precision. We used a strip with the 5V WS2812B LED devices.


The LED strips usually come with three wires to connect to: Power (+5V), Ground (GND) and Data (The control signal). At the far end of the strip these three wires are out- put again so you can daisy chain the strips if necessary. One word about current, since there are 60 super bright LEDs you need around 3A of current at 5V and if you add more strips you will need more current for each subsequent strip etc.


Now for the techy bit, in order to control the strips there is a protocol designed to send the ones and zeros down the single data wire to each LED. This protocol is very specific and has super accurate timing so you can forget doing this on a Raspberry Pi or PC, you need a microprocessor with Nano-Second precision.

Here you can see the individual Green, Red and Blue LEDs at work to make a single mixed colour

The various ones and zeros are defined not by voltage level but by a mark space ratio as follows:

A Zero = Hi for 350ns followed by a Low for 900ns A One = Hi for 900ns followed by a Low for 350ns A Frame reset = Low for > 50us

Each LED needs 3 x 8 bits = 24bits to describe the Red, Green and Blue color ratios (Actually G,R,B). So that’s a 24 bit sequence of ones and zeros defined by the mark space ratios described above for each LED. In our chain there are 60 LEDs so in order to address the individual LEDs a sequence of 60 x 24 bits needs to be sent pre- ceded by a frame reset.

In order to achieve the accurate timing needed we used a bit/bang method of toggling a pin on the microprocessors using loops of NOPs (No Operation). It actually sounds more complicated than it is but does require a bit of experimentation to get it right. We verified ours using a scope to get the timing correct.


If all of this is a bit ‘out there’ then there is a simpler way! We have coded this into the FlowPaw board in the latest firmware and made a FlowStone module to simply control the colors and we programmed a few pat- terns that you can just use.

The LED strip wires connected to the FlowPaw Board.

This works by connecting the Data pin of the LED strip to one of the FlowPaw Claws on the PWM pins and also connecting the GND to the FlowPaw. Then in FlowStone connect the LED-Strip module to the Flow- Paw module and you’re off.

LED Strip Robot.png “The FlowPaw Module connected to the LED-Strip Module.

On the LED–Strip module in FlowStone there are three inputs for the general color (R,G,B), a Pattern input that selects one of the pre-made patterns:

Pattern 0 – Block Colour

Pattern 1 — Rainbow

Pattern 2 – Left to Right (additive)

Pattern 3 – Left to Right (single led)

Pattern 4 – Slide (single LED)

Pattern 5 – Slide (11 LED Block)

For all of the patterns, except the rainbow, the color is defined by the RGB inputs (Range 0-254) and the brightness is controlled via the brightness input (Range 0-254). The send input acts as a clock to control the speed of the pattern.

Led Headder.jpg “Multiple LED strips showing the Rainbow pattern.

From here you can use FlowStone to sequence your patterns to make fantastic light shows or even control them from live sound to make your own robotic disco!


These LED strips are a lot of fun and are infinitely controllable using a microprocessor or FlowStone and the FlowPaw board. While the protocol isn’t simple it’s not too hard once you understand the basics. You can even connect multiple strips to control up to 5m of LEDs. I can’t remember having so much fun for such a low-cost device… definitely worth investigation.

DSP Robotics,