WiFi Controlled RGB LED Strip With ESP8266

10,803

14

18

Introduction: WiFi Controlled RGB LED Strip With ESP8266

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.

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.

- ESP8266WiFI

- ESP8266Webserver

- 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.

Indoor Lighting Contest

Participated in the
Indoor Lighting Contest

Be the First to Share

    Recommendations

    • Make it Glow Contest

      Make it Glow Contest
    • First Time Author Contest

      First Time Author Contest
    • PCB Challenge

      PCB Challenge

    18 Discussions

    0
    AndrewM379
    AndrewM379

    2 months ago

    I too cannot download the code, even if I enter "Australia", the site wants to charge $10.

    It would benefit the whole community massively if source code was kept in a proper source code repository like GitHub, and then more folk can appreciate your excellent (and free) Instructable.

    Thanks

    0
    snorlaxprime
    snorlaxprime

    Reply 6 weeks ago

    Hi Andrew,
    You should be able to check out for free. Don't click on the paypal button.

    Let me know if you still have any issue.

    0
    TestingArnd
    TestingArnd

    Question 9 months ago

    Sorry I’m new to this and interested in achieving this setup. How do i determine which MOSFET to get (I.e. how do I figure how much V and A will pass through the 3 gates)? Thanks!

    0
    snorlaxprime
    snorlaxprime

    Answer 9 months ago

    Hi Busterho,
    You can use N-Channel MOSFET IRF510, or any equivalent to this. As per the datasheet, Source to Drain current can be up to 5.6 Amps.
    Multicoloured LED draws about 60mA per strip (20mA for Red, Green and Blue). So with the configuration above one MOSFET per colour, we can power about 280 LEDs, so lets be conservative, it can power up to 250 LEDs safely.
    The source to drain voltage is 2.5V, which is enough voltage to power the LEDs.
    I hope this answers your questions.

    0
    yptrio
    yptrio

    1 year ago

    i didnt find the code is it paid??

    0
    e_cuara
    e_cuara

    Reply 1 year ago

    Link redirect me to a paypal painment of $0.00… when I click on the pay button its shows the following warning:
    "PayPal error (10525): An error (10525) occurred while processing your PayPal payment. Please contact the store owner for assistance."

    Assistnace is needed...
    Best regards...

    0
    snorlaxprime
    snorlaxprime

    Reply 1 year ago

    Hi e_cuara,
    Don't click on the "paypal" button, but instead, click on the "view cart" button and you can checkout from there without going through "paypal". Please let me know if you still having an issue.

    0
    mo1726
    mo1726

    Reply 9 months ago

    hi dear
    i can't download

    0
    snorlaxprime
    snorlaxprime

    Reply 9 months ago

    Hi Mo1726,
    What is the issue? Can you tell me more?

    0
    mo1726
    mo1726

    Reply 9 months ago

    hi
    i can't see download link

    0
    mo1726
    mo1726

    Reply 9 months ago

    i have this link but i can't download
    can you send source file to my email ?

    Untitled.png
    1
    The Fe Factor
    The Fe Factor

    11 months ago

    The page displays this in the Order/Shipping section (close to the bottom of the page) "There are no shipping options available. Please ensure that your address has been entered correctly, or contact us if you need any help."
    When a "Place Order" button is clicked the page produces this error msg "No shipping method has been selected. Please double check your address, or contact us if you need any help." I checked, the address is correct ...
    If you wanted to share maybe a github would be a better place for it?

    0
    snorlaxprime
    snorlaxprime

    Reply 11 months ago

    Hi Fe Factor,
    You can follow the following steps (don't click on the paypal checkout):
    - Add it to the cart
    - Click on cart at the top
    - Checkout from the cart
    I just tested it, seems to work ok.
    Please let me know if you are still not able to download the source code.

    0
    The Fe Factor
    The Fe Factor

    Reply 11 months ago

    I just tried again. Please see attached pictures

    Cart_01.jpgCart_02.jpgCart_03.jpg
    0
    snorlaxprime
    snorlaxprime

    Reply 11 months ago

    Hi Fe Factor,
    Just try using Australia as a country. It should work.

    0
    The Fe Factor
    The Fe Factor

    Reply 11 months ago

    thanks! this worked