The idea is to create an LED lights that can be controlled from WiFi. I have some spare LED strip from Christmas lying around, so I am recycling this to ESP8266 which allow the LED to be controlled from WiFi.
ESP8266 can function as webserver, this will be used to create the Remote layout to control the LED Strip. The LED strip that I have is 12V, so I will need a 12 V power supply for this, otherwise if you have the 5V LED, you can power the LED strip from the same power source that power the ESP8266 circuit.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Gather All the Materials & Tools
For this you will need the following materials:
- 1 x ESP8266
- 3 x MOSFET IRF510
- RGB LED Strip
- Prototype board
- Connector Wire
- 12 V Power supply for LED Strip
- 5 V Power supply for the ESP8266
The following are the tools that you will need:
- Wire stripper
- Soldering Iron
- Multimeter (Handy tools for trouble shooting)
Step 2: Connect the Circuit
Connect the circuit as per the diagram above. We need 3 MOSFET to power the 3 colours (RED, GREEN, BLUE) of the LED. Note that I am not using the individual addressable LED strip. For that you will need a different connection.
Using the 3 colours of the LED, we are able to create many more colours. For educational purposes, it is great to be able to teach the kids about the Primary colours, and the combination that made up the other colours.
Another thing to note is you will need to make sure that the GND of the 12 V power supply is connected to the GND of the 5V power supply. Another alternative is you can use the 12V power supply to power the 5V using the 5V regulator LM7805.
Step 3: Configure the Code From Arduino Interface
You can download the code that I have used from my website in the following location. The code will need the following library to run.
- Arduino OTA
Once you load the code in the Arduino interface, there are a couple of things that you need to configure.
1. Change the following to point to your wifi ssid and password
/* Network settings */
const char* ssid = "yourWIFISSID"; // SSID - your WiFi's name const char* password = "yourwifipassword"; // Password
2. Change the IP address to reflect your Router subnet, and make sure that there is no devices in the same IP address.
IPAddress ip(192,168,1,111); // static IP adress of device
IPAddress gateway(192,168,1,1); // Gatway IPAddress subnet(255,255,255,0); // Network mask
3. Change the OTA (On the air update) password in the Setup section in around line 62.
// OTA code
ArduinoOTA.setHostname("LEDStrip"); ArduinoOTA.setPassword((const char *)"ledstripOTApassword"); ArduinoOTA.begin();
Step 4: Upload the Code to ESP8266
Once you have configured the code to suit your WiFi setup, it is time to upload the code to the ESP8266. Make sure you select the correct port where your ESP8266 is attached to. In the example above, I have mine on /dev/cu.wchusbserial14750, this might be different from your PC or Mac.
Then Select Sketch->Upload.
Wait until the upload is finished. If all goes well the ESP8266 should connect to your WiFi router and have the IP address of 192.168.1.111. This might vary if you have change it in the previous step. Point your browser to that IP address, http://192.168.1.111, you should see the LED remote control as shown in the picture.
Click on the colour to change the colour of the LED according to your mood, and enjoy.
Step 5: Future Upgrades
Now that you have a working WiFi controlled RGB LED strip, you can play around with the code to add more different combination of disco lights. Some of the suggestion of future upgrade include:
- Connecting the circuit to MQTT so that you can control it via internet
- Add motion detection circuit, to automatically turn the LED lights on for night light
- Add code for different flashing modes (Flash, Strobe, Fade, Smooth), these button at the moment is not functional.
- Change the light colour based on Music.
That's all, I hope you enjoy this post. And if you like this, you can vote for me in the Lighting contest. You can visit my website for other simple IoT projects.
You can also drop me a comment on what suggestion for the future upgrade that you would like to see, so that I can use this idea to post on the next instructables.
Participated in the
Indoor Lighting Contest