Shares

ESP8266 RGB Color Picker

Shares

In this project, you’re going to build a web server with an ESP8266 to remotely control an RGB LED. This project is called ESP8266 RGB Color Picker.

First, watch the video demonstration


To learn more about the ESP8266 and RGB LEDs use the following tutorials as a reference:

If you like the ESP and you want to do more projects you can download my eBook Home Automation using ESP8266 here.

Let’s get started!

Parts List

Here’s the hardware that you need to complete this project:

Flashing Your ESP with NodeMCU

In this tutorial we are going to use the NodeMCU firmware. You have to flash your ESP with NodeMCU firmare.

Downloading ESPlorer IDE

I recommend using the ESPlorer IDE which is a program created by 4refr0nt to send commands to your ESP8266.

Follow these instructions to download and install ESPlorer IDE:

  1. Click here to download ESPlorer
  2. Unzip that folder
  3. Go to the main folder
  4. Run “ESPlorer.jar” file
  5. Open the ESPlorer IDE

esplorer start

Uploading Code

You should see a window similar to the preceding Figure, follow these instructions to upload a Lua file:

  1. Connect your ESP8266-12E that has built-in programmer to your computer
  2. Select your ESP8266-12E port
  3. Press Open/Close
  4. Select NodeMCU+MicroPtyhon tab
  5. Create a new file called init.lua
  6. Press Save to ESP

Everything that you need to worry about or change is highlighted in red box.

esplorer_tab

Code

Upload the following code into your ESP8266 using the preceding software. Your file should be named “init.lua“.

Don’t forget to add your network name (SSID) and password to the script below.

Important: If you’re using an RGB LED common cathode, you need to comment and uncomment some code in the if(_GET.r or _GET.g or _GET.b) statement as described in the script comments.

Schematics

Now follow these schematics to create the circuit that the RGB LED common anode.

ESP8266 RGB Color Picker_bbff

Important: If you’re using an RGB LED common cathode, you need to connect the longer lead to GND.

Your ESP IP Address

When your ESP8266 restarts, it prints in your serial monitor the ESP IP address. Save that IP address, because you’ll need it later.

In my case, the ESP IP address is 192.168.1.7. If you experience problems seeing your IP read this troubleshooting guide.

You’re all set!

Opening Your Web Server

Go to any browser and enter the IP address of your ESP8266. This what you should see:

RGB color picker main selecting color

Click the field and a small window opens with a color picker. Simply drag your mouse or finger and select the color for your RGB LED:

selecting color

Then simply click the “Change Color” button:

changing color

Now your RGB LED changes to the blue color:

blue LED

Go to the top of this page to see a video demonstration of this project.

Taking It Further

This is a basic example that shows you how easy it is to remotely control an RGB LED with an ESP8266. You can take this example and modify it to control an actual lamp.

Do you have any questions? Leave a comment down below!

Thanks for reading. If you like this post probably you might like my next ones, so please support me by subscribing my blog.

Leave a Comment:

Add Your Reply

Download Home Automation Using ESP8266 (2nd Edition) and Save 30%
Sale Ends January 21

x