Introduction: Control WS2812 Ceiling Lamp With Smartphone (ESP8266)
I decided to build a easy ceiling lamp with with a plank and some WS2812 LEDs (see the video). I added a ESP8266 to the lamp, so i can control it with my smartphone. The lamp is rudimentary, and shall be a first prototype. For the next one I m planning a better case. I will update this instructable when I have achieved that.
I have used the following components:
- ESP8266 ebay
- WS2812 LED strip ebay
- LF 33CV voltage regulator ebay
Step 1: Program the ESP8266
In this part I will explain the steps you need to do to program the ESP8266. The cool thing is, the ESP8266 has 2 output pins, and you can control the LED strip with one of them. So you dont need an arduino or other controler in addition. An arduino uno is only needed to program the ESP8266.
First step is to go to File->Preferences in your arduino IDE and fill in "http://arduino.esp8266.com/stable/package_esp8266com_index.json" to the Additional Boards Manager URLs.
Go to Tools -> Board and choose Boards manager and install esp8266.
Now you can choose the ESP8266 version fitting to your device.
In the next step you have to wire the flash circuit like in the picture. For the voltage regulator you can use a LF 33CV or another one. Important is that you provide 3.3V to the ESP8266, 5V can destroy it.
After wiring you can flash the ESP8266 with the added software like you do it normally with your arduino.
Important: In the code change the line
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(49, 2, NEO_GRB + NEO_KHZ800);
and fill in the number of LEDs you use instead of the 49 that I use.
If it doesnt work, reset the voltage at the ESP8266, than it has to be in the flash mode. And try it again afterwards.
Step 2: How Does It Work.
Now you can wire the circuit in the picture and connect your 2812 LEDs.
Before you provide that circuit, be sure that your power supply can provide at least the number of your LEDs x 60mA. Because every color of the LEDs needs 20mA per LED. Because my power supply provides not enough current, I made a limit for LEDs. If the LEDs are white, the software controls every color in the RGB value up to 150 instead of 255. You can remove that limit if your supply has enough power.
To control the LEDs I m using the library Adafruit_NeoPixel.h. There are many examples how it works in the internet.
How does it work:
When you supply power to the circuit, the LEDs should turn white if everything works correct. The ESP8266 works as Access point, you can connect to it through connecting to the wireless network ESP8266 with your smartphone. With the software the ESP8266 provides a website. You can connect to it with the IP 192.168.4.1 in your browser. Now you can see the control page for the WS2812 LEDs like in the video. Just choose a effect and click "Send", and the LEDs should start showing this effect. Remember, after every effect you have to go to the normal mode first before you start another effect.
Have fun :).
If you have questions, dont hesitate to ask.