This example shows the usage of RGB led line controller (with WS2812, WS2813) which uses Web Thing Server on ESP32 (with esp-idf ver. 4.0).
Connection of ESP32 devkit board with WS2813 diode line is shown below. Led's data line is connected to IO23 of ESP32. Led line is powered from devkit and can draw maximum aproximitly about 600mA from the board (it gives only 10 diodes with maximum light). For more diodes external 5VDC current source is necessary and it must be connected directly to the led line.
Picture below shows the Gateway Web Interface for this thing.
The controller has the following properties:
on
- ON/OFF led linediodes
- number of diodes in the linecolor
- RGB color defined for some patternsspeed
- pattern refreshment speed, 0 .. 100brgh
- leds' brightness, 0 .. 100pattern
- currently running pattern
Patterns list is implemented as string enum
in json format. Picture below shows that list on Firefox Android.
The following software must be copied into components
folder:
By the first power-up the node starts in AP mode with SSID: iot-node-ap
and password: htqn9Fzv
. After loggin into this WiFi network load the main page by typing in browser iot-node-ap.local:8080/
(it does not work on Android) or 192.168.4.1:8080/
.
On the page write SSID and password of the WiFi network where the node will work. In the last position enter the local node's name.
Pressing submit causes writing data into flash and restart of the node in station mode. If you want to change the WiFi SSID or password later just connect GPIO27
to GND, this causes node's restart in AP mode as in the previous paragraph.
If WebThing Gateway runs in the same WiFi network go to Things category on gateway and press plus sign. Gateway shoud find new things, press Save and Done.
idf.py menuconfig
In the RGB Controller Configuration menu item WS2812 Data GPIO number
can be set for led data line (default is 23).
Build: idf.py build
Flash: idf.py flash
and press boot button.
- WebThing Gateway - https://iot.mozilla.org/gateway/
- Web Thing API - https://iot.mozilla.org/wot/
- esp-idf - https://github.com/espressif/esp-idf
This project is licensed under the MIT License.
- Krzysztof Zurek - kz