Using Blynk to Control an RGB LED Strip with an ESP-8266

I am installing recessed RGB LED strip lighting under our kitchen cabinets and wanted to control them via Wifi and Amazon Alexa. I found and purchased an inexpensive ESP-8266 based Wifi controller on Amazon (see photo below). After a quick disassembly, I was easily able to reverse-engineer the device, and reprogram it for my purpose. This device came with an IR detector for use with an
IR remote control, however, I didn’t use this and therefore removed the detector. I’ve subsequently noticed version are available on Amazon without the IR remote option.

Wifi RGB LED Strip Controller

The pinouts on the device were labelled R, G, B, with an additional common cathode pin and an un-populated pin labelled W (a fourth MOSFET is installed for this pin). The R-G-B pins are controlled by MOSFETs and connected to the following ESP-8266 GPIOs:

  • G – Q1 – Pin #14 GPIO05
  • R – Q2 – Pin #05 GPIO14
  • B – Q3 – Pin #06 GPIO12
  • IR – Pin #13 GPIO04
  • I didn’t trace the un-populated pin and MOSFET (labelled Q4).

    As suspected, the test points on the reverse side of the PCB are for programming the onboard ESP-8266. Two of the test points were labelled RX and TX. I traced the other two points to GROUND and GPIO0, which are used to place the ESP-8266 into flash mode. Perfect!

    For testing, I reprogrammed the device to respond to a simple Blynk IoT program with 3 slider widgets, one each for the R, G, B pins:

    /*************************************************************************
     * Title: Simple ESP-8266 Wifi RGB LED Strip Light Controller
     * File: esp8266_rgb_led_controller.ino
     * Author: James Eli
     * Date: 1/14/2018
     *
     * Blynk slider #1 (r) GPIO14
     * Blynk slider #2 (g) GPIO05
     * Blynk slider #3 (b) GPIO12
     * 
     * This program controls an RGB LED strip light. 
     * 
     * Notes:
     *  (1) Requires the following arduino libraries:
     *      ESP8266
     *  (2) Compiled with arduino ide 1.8.3
     *  (4) To place an ESP8266 into program mode, GPIO0 must be LOW during power up. 
     *  (5) Test Pads on PCB back:
     *        #1 – GND
     *        #2 – Pin #12 IO00
     *        TX – Pin #16 TX
     *        RX – Pin #15 RX
    *************************************************************************/
    #include <ESP8266WiFi.h>
    #include <BlynkSimpleEsp8266.h>
    
    // Blynk App authentication token, wifi ssid and password.
    char auth[] = "***";
    char ssid[] = "***";
    char pass[] = "***";
    
    // Esp8266 pins.
    const int RED_PIN   = 14;
    const int GREEN_PIN = 5;
    const int BLUE_PIN  = 12;
    
    void setup() {
      pinMode( RED_PIN, OUTPUT );
      pinMode( GREEN_PIN, OUTPUT );
      pinMode( BLUE_PIN, OUTPUT );
      Blynk.begin( auth, ssid, pass );
    }
    
    void loop() {
      Blynk.run();
    }
    
    Advertisements

    About Jim Eli

    µC experimenter
    This entry was posted in iot and tagged , , . Bookmark the permalink.

    Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out /  Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out /  Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out /  Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out /  Change )

    Connecting to %s