Raspberry Pi IoT with WS2812

Hi!

I am trying to use a Raspberry Pi together with a WS2812 light strip and to make some sort of a IoT device together with these components.
I get how the connection between the web application and the Raspberry Pi works, but how do I translate the command sent to the Raspberry Pi to a command to the GPIO data pin?

//Björn

1 Like

Hey Björn,
Welcome to the forums!

We have a great guide for Controlling WS2812B LEDs with a Raspberry Pi! It will take you through how to connect the LEDs, power them and give some example code that can help you with your project!

Cheers,
Blayden

How you translate the response fronm the web app to a command for the light strip will depend on how the Pi is communicating with that web page. There are several different protocols available, and the process for handling the response will be different for each. If you can link to the code you are using, or post that code, then it will be possible to see which protocol you have chosen and where you need to interpre the response and insert the required command.

1 Like

Hi Bjorn,

What will your device do at the end of all this? Keen to give you some pointers on how I imagine the structure (and make sure you aren’t reinventing the wheel)

You could extend our guide with Flask, which runs a web server on top of Python. While it may not be as performant as other languages/frameworks, it’s easy to integrate with things like the Raspberry Pi hardware or WS2812s. The possibilities there are endless: