Arduino Nano

Arduino basic Tutorial

Blynk iot Tutorial

Visit all the Links

ArduinoTutorial by Manmohan Pal

12 volt RGB LED strip Control iot using Blynk

12 volt RGB LED strip Control iot using Blynk


To connect a 12V RGB LED strip to an L293 motor driver, using a NodeMCU (ESP8266) and Blynk IoT platform for control, follow this step-by-step guide:

Components Needed:

  1. NodeMCU (ESP8266) - For Wi-Fi connectivity and communication with Blynk.
  2. L293 Motor Driver - Used to control the RGB LED strip, which typically requires more current than the NodeMCU can provide directly.
  3. 12V RGB LED Strip - The RGB LED strip that you want to control.
  4. Power Supply (12V) - To power the LED strip.
  5. Jumper Wires - For connections.
  6. Blynk App - For controlling the RGB LED through your smartphone.

Step 1: Wiring the Components

  1. RGB LED Strip Connections:

    • The RGB LED strip typically has 4 pins: VCC, GND, R, G, and B (Red, Green, and Blue pins).
    • VCC (positive terminal) goes to the 12V power supply.
    • GND goes to the ground.
  2. L293 Motor Driver Connections:

    • The L293 motor driver will act as a current driver for the RGB LED strips.
    • Pin 1 (Enable) is connected to 5V to enable the motor driver.
    • Pin 2 (Input 1), Pin 7 (Input 2), Pin 10 (Input 3), and Pin 15 (Input 4) will control the red, green, and blue channels of the LED strip.
    • Pin 3 (Output 1) and Pin 6 (Output 2) will go to the R (Red) pin of the LED strip.
    • Pin 11 (Output 3) and Pin 14 (Output 4) will go to the G (Green) pin of the LED strip.
    • Pin 9 (Output 5) and Pin 12 (Output 6) will go to the B (Blue) pin of the LED strip.
  3. NodeMCU (ESP8266) Connections:

    • D1 (GPIO5) to Input 1 of L293 (for red channel).
    • D2 (GPIO4) to Input 2 of L293 (for green channel).
    • D3 (GPIO0) to Input 3 of L293 (for blue channel).
    • GND of NodeMCU connects to the GND of the L293 and the 12V power supply.

Step 2: Powering the Circuit

  1. RGB LED Strip requires 12V, so connect the 12V supply directly to the VCC of the LED strip.
  2. L293 Motor Driver:
    • Connect the VCC1 of the L293 to the 5V pin from the NodeMCU or a 5V supply.
    • VCC2 of L293 to the 12V power supply.
  3. Ensure that the GND of the power supply, L293, and NodeMCU are all connected.

Step 3: Setting Up the Blynk App

  1. Install Blynk App:

    • Download and install the Blynk app on your smartphone from the App Store or Google Play.
  2. Create a New Project:

    • Create a new project in the Blynk app, select NodeMCU as the device, and set the connection type to Wi-Fi.
    • Blynk will send an Auth Token to your email. Keep this safe as it is needed to authenticate the NodeMCU.
  3. Add Widgets:

    • Add 3 Button Widgets for controlling Red, Green, and Blue channels.
    • Set the pin for each button widget:
      • Red button: D1
      • Green button: D2
      • Blue button: D3
    • Use Switch widgets to control the on/off states for the RGB channels.
  4. Set Button Actions:

    • You will be programming these buttons to control the RGB LED strip by sending HIGH or LOW signals to the corresponding GPIO pins on the NodeMCU.

Step 4: Programming the NodeMCU

Install the Blynk Library and the ESP8266 Board in the Arduino IDE if you haven't already.

  1. Install Blynk Library:

    • Open Arduino IDE → Go to SketchInclude LibraryManage Libraries.
    • Search for Blynk and install it.
  2. Install ESP8266 Board:

    • Go to FilePreferencesAdditional Boards Manager URLs.
    • Add this URL: http://arduino.esp8266.com/stable/package_esp8266com_index.json
    • Then go to ToolsBoardBoards Manager, and install esp8266.
  3. Upload Code:

//////////////////////////////////////////////////////////////////////////////////////////////
#define BLYNK_TEMPLATE_ID "............................"
#define BLYNK_TEMPLATE_NAME "..........................."
#define BLYNK_AUTH_TOKEN ".............................."

#include <BlynkSimpleEsp8266.h>

#define BLYNK_PRINT Serial

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

int rled=14;
int gled=15;
int bled=16;

char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = ".............."; //your hotspot name
char pass[] = ".............."; //your hotspot password name

void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
  pinMode(rled, OUTPUT);
  pinMode(gled, OUTPUT);
  pinMode(bled, OUTPUT);

}

void loop() {
  Blynk.run();
}

BLYNK_WRITE(V1){
  int redcolour = param.asInt(); // assigning incoming value from pin V1 to a variable
  analogWrite(rled,redcolour);
}

BLYNK_WRITE(V2){
  int bluecolour = param.asInt(); // assigning incoming value from pin V1 to a variable
  analogWrite(bled,bluecolour);
}
BLYNK_WRITE(V3){
  int greencolour = param.asInt(); // assigning incoming value from pin V1 to a variable
  analogWrite(gled,greencolour);
}

////////////////////////////////////////////////////////////////////////////////////////////////

Step 5: Upload and Control

  1. Connect your NodeMCU to the computer and select the right board and port in Arduino IDE.
  2. Upload the code to the NodeMCU.
  3. After uploading, open the Blynk app and use the buttons to control the RGB LED strip colors.

When you press the buttons on the Blynk app, the corresponding colors (Red, Green, Blue) will be turned on/off on your RGB LED strip.


Step 6: Additional Considerations

  1. Current Limitations: The L293 motor driver is used here to provide enough current for the RGB LED strip, which often requires more than a NodeMCU can supply directly. Ensure your power supply provides enough current for the LED strip.
  2. LED Strip Type: If you are using an addressable RGB LED strip (e.g., WS2812), a different approach using a library like Adafruit NeoPixel would be required instead of the L293 motor driver.

This tutorial will help you control the RGB LED strip's colors remotely using the Blynk IoT platform, NodeMCU, and L293 motor driver.


RGB Tubelight,

Smart Tubelight,

DIY RGB Tubelight,

Blynk APP,

Blynk Tutorial,

Smart Lighting,

Home Automation,

IoT Project,

Arduino Blynk,

RGB Lighting,

DIY Smart Lighting,

IoT Smart Home,

Blynk App Tutorial,

Arduino RGB Tubelight,

Home Automation Project,

Blynk IoT,

RGB Control with Blynk,

DIY LED Tubelight,

Blynk IoT Tutorial,

Smart Home Projects,

No comments:

Post a Comment