Go Down

Topic: Wemos module to control Ws2812b rgb strip from over wifi (Read 88 times) previous topic - next topic


I want my project to be have the following features...

1. control by mobile phone using wifi, it must create its own AP, I don't need it connected to the internet at all

2. led brightness adjustment and any other variables like speed etc

3. ability to choose any colour

4. choose a specific program (eg like the ones in the example demoreel or set to cycle through them all

5. I want it to turn off the wifi after the first minute to save battery.

I'm planning on incorporating a gyro pcb so it can react to movement once I've got all the above up and running

Can the wemos monitor for instructions over the wifi while still running thru the different lighting patterns etc? how do you achieve this In the code?

Is it possible to upload new sketches or lighting sequences over wifi?

here's a vid of what I've made so far...... it's cool but it's not interactive!


hardware I'm using is....
wemos mini
ws2812 strip
3.7v lion 18650 batt
power/supply battery charger module

I'm pretty average at coding, so what's my options?


There are many people that have done this before you. What makes your project so special that you cannot look at the countless examples on Google?

You could start here:
https://tttapa.github.io/ESP8266/Chap14 - WebSocket.html


I have found about half a dozen, but none of the code will compile.... I will have a look at the link now thx....


yeah I will try the code you linked too, it'll require a bit of mixing up because it uses the 3channel controlled by current strips, whereas I'm using individually addressable ws2812b strip.

does using a web Socket allow the program sequence for the leds to run whilst sending/receiving instructions aswell? I guess the word I'm looking for is multitasking, but too my knowledge that can only be done by splitting the software into functions and then have a loop calling them one by one,.... ithe led strip I'm using needs  constant stream of input or it will just freeze.


Wemos only has one CPU core, so you will need to use the same "many things at once" techniques as you would use with other Arduino. But the Wemos' cpu is considerably faster than, say, Uno. Even so, it is likely that when serving web pages and responding to requests, the led pattern may freeze for a fraction of a second, but at other times it should run smoothly.

Yes, Wemos can act as an AP. Yes, you can upload sketches to Wemos over WiFi. I don't know if you can upload sketches in AP mode. Yes, you can switch the WiFi off to save battery power, but (1) it will not then respond to you phone or sketch uploads until you physically reset it and (2) current consumption is around 80mA with WiFi on, compared with 60mA for a single ws2812 LED at full brightness white, so switching WiFi off is not that big a saving in this circuit.


There's only one thread on an Arduino, so you can't do two things at the same time. The clue is that you have to keep your loop running at all times: in other words, don't use delay, because it blocks the execution of the entire CPU*, meaning that you cannot handle websocket messages at the same time.

(*) The way the delay function is implemented in the ESP8266 Arduino Core, it will still refresh the network stack, but not your server or websocket handlers.

Go Up