This project is looking at using an Ikea Vidja floor lamp with RGB LEDs controlled via an ESP32 or ESP8266 board.
It can be controlled through a webpage or through API GET requests, such as IOS Shortcuts
This was initially following along with this. I started working on getting web calls working to the controller, using TinyWeb. This worked except I ran into issues related to stopping a currently running preset (e.g. running LED loop). Lo and behold, Bhavesh posted an article solving this exact issue by using microdot. So many thanks for getting me on the right path there.
I have found that the LED lights can be controlled using the ESP8266 boards but not particularly well. A few issues I noticed:
The first 2 issues were likely due to the ESP8266 boards only supplying 3.3v, instead of that 5V that can be supplied by the E32s. The last issue might be due to the processing power behind chips or the 5V as well.
Best to use an ESP32 boards and not an ESP8266, although an ESP8266 can sort of work.
This is pretty straight forward and I'll add a picture later at some point. But:
Modify the config.py
file with wifi, pin, and pixel settings
esptool.py --port /dev/ttyUSB0 erase_flash
esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_size=detect 0x1000 images/images/esp32-20220117-v1.18.bin
wget https://raw.githubusercontent.com/miguelgrinberg/microdot/main/src/microdot.py
wget https://raw.githubusercontent.com/miguelgrinberg/microdot/main/src/microdot_asyncio.py
ampy --port /dev/ttyUSB0 put microdot.py
ampy --port /dev/ttyUSB0 put microdot_asyncio.py
ampy --port /dev/ttyUSB0 put library/pixels.py
ampy --port /dev/ttyUSB0 put library/wifi.py
ampy --port /dev/ttyUSB0 put boot.py
ampy --port /dev/ttyUSB0 put config.py
ampy --port /dev/ttyUSB0 put main.py
ampy --port /dev/ttyUSB0 put index.html
# Reboot the microcontroller
At this point, you should be able to access the webpage on the esp32 at http://IP/
You can also use something like shortcuts to send GET requests to the various endpoints
Shuts the microDot application down.
Note: It can only be brought back up by restarting the esp32 or through usb and import main
Provides memory and network information
Sets rgb of the lights to 255, 255, 255
Sets rgb of the lights to 0, 0, 0
Allows for changing the color of the string of lights using RGB. Requires r,g,b arguments in the GET request
Accepts r,g,b arguments for the starting color
Light display sourced from here
Accepts r,g,b arguments for the starting color
Light display sourced from here
Light display sourced from here
Light display sourced from here
I'm utilizing the Wemos LOLIN D32 v1.0.0 however and ESP32 should work well here.
This is based on the ESP32 (See datasheet)
Description | Value |
---|---|
Microcontroller | ESP-32 |
Board Power Supply (USB) | 5V |
Supported Batteries | Lipo Battery 3.7V |
Operating Voltage | 3.3V |
Lithium battery interface | 500mA Max charging current |
Digital I/O Pins | 22 |
Analog Input Pins | 6 (VP, VN, 32, 33, 34, 35) |
Analog Output Pins | 2 (25, 26) |
LED BUILTIN | Pin 5 |
Clock Speed(Max) | 240Mhz |
Flash | 4M bytes |
Length | 57mm |
Width | 25.4mm |
Weight | 6.1g |
[Source]
I created a Fritzing part for the Wemos LOLIN D32.
If there is no boot/flash button and you get the error Wrong boot mode detected (0x13)!
when attempting to erase the flash, try grounding Pin 0 and resetting.