Remote control of 2 LED with Arduino.

Schematic2

list of products from Amazon (Not mine, i just link them!) Scroll Down For Article! Note: Elegoo boards are not Arduino, but they are compatible with Arduino IDE and are mutch more affordable!


 

Schematic

How to Control LEDs Using Blynk and Arduino Uno: A Complete Guide

Controlling LEDs remotely using Blynk and an Arduino Uno is a simple yet powerful project for IoT (Internet of Things) enthusiasts. In this guide, we will explain how to use Blynk to toggle LEDs connected to an Arduino Uno, define the required components, explain the wiring connections, and provide a well-optimized code.

Components Required:

To complete this project, you will need the following components:

  • Arduino Uno

  • USB Cable (for communication with Blynk via Serial)

  • 2 LEDs (Red & Yellow)

  • 2 Resistors (220Ω - 330Ω)

  • Breadboard & Jumper Wires

Understanding Blynk

Connections


Blynk is a popular IoT platform that allows you to create mobile apps for controlling hardware such as Arduino, ESP8266, and Raspberry Pi. For this project, we will use Blynk's virtual pins to control two LEDs.

Circuit Diagram and Pin Connections

Arduino Pin Component Blynk Virtual Pin
13 Red LED V0
12 Yellow LED V1
GND LED Cathodes -

Wiring Instructions:

  1. Connect LED Cathodes to GND.

  2. Connect LED Anodes to 220Ω - 330Ω resistors, then to digital pins:

    • Red LED (Pin 13)

    • Yellow LED (Pin 12)

  3. Ensure the Arduino is connected via USB for Serial communication with Blynk.

Blynk App Setup

Blynk Dashboard


  1. Download & Install Blynk from the App Store / Play Store.

  2. Create a new project and select Arduino Uno as the device.

  3. Add Two Buttons:

    • Set V0 to control LED on Pin 13.

    • Set V1 to control LED on Pin 12.

  4. Obtain the Blynk Authentication Token and replace it in the code.

Arduino Code to Control LEDs via Blynk


#define BLYNK_TEMPLATE_ID "TMPL2lXUr6cLg"
#define BLYNK_TEMPLATE_NAME "Quickstart Template"
#define BLYNK_AUTH_TOKEN "rOdxPDZcdzE-mVEyZy2GT3eUwoUHS3LU"
#include <BlynkSimpleStream.h>
char auth[] = BLYNK_AUTH_TOKEN;
int ledPin = 13; // LED on Pin 13 (V0)
int yellowPin = 12; // Yellow LED (V1)
void setup() {
Serial.begin(9600);
Blynk.begin(Serial, auth);
pinMode(ledPin, OUTPUT);
pinMode(yellowPin, OUTPUT);
}
// LED on Pin 13 (Toggle with Button on V0)
BLYNK_WRITE(V0) {
digitalWrite(ledPin, param.asInt());
}
// Yellow LED (Toggle with Button on V1)
BLYNK_WRITE(V1) {
digitalWrite(yellowPin, param.asInt());
}
void loop() {
Blynk.run();
}
view raw Blynk2led.ino hosted with ❤ by GitHub

Code Explanation

  1. Blynk Library: The code includes <BlynkSimpleStream.h> for Serial communication with Blynk.

  2. Authentication: The BLYNK_AUTH_TOKEN is used to connect the Arduino with the Blynk app.

  3. LED Pin Setup:

    • Pin 13 is assigned to V0 (Red LED)

    • Pin 12 is assigned to V1 (Yellow LED)

  4. BLYNK_WRITE() Functions:

    • BLYNK_WRITE(V0): Reads V0 button state and controls Pin 13.

    • BLYNK_WRITE(V1): Reads V1 button state and controls Pin 12.

  5. Loop Execution:

    • Blynk.run(); keeps communication active with the app.

Final Testing

  1. Upload the Code to the Arduino Uno.

  2. Open the Serial Monitor in the Arduino IDE.

  3. Run Blynk on Your Mobile and toggle the buttons to control the LEDs.


  • Arduino LED control using Blynk

  • How to connect Blynk with Arduino Uno

  • IoT LED control using Blynk

  • Arduino Blynk project for beginners

  • Remote LED control with Arduino and Blynk

Conclusion

By following this guide, you can easily control LEDs using Blynk and Arduino Uno. This project is a great starting point for IoT applications and can be expanded with sensors, relays, or RGB LEDs. Stay creative and explore more possibilities with Blynk and Arduino!


Did you find this guide helpful? Share it with your fellow Arduino enthusiasts! 🚀

list of products from Amazon (Not mine, i just link them!)


Please NOTE that ELEGOO is not Arduino but it is compatible with Arduino IDE, and mutch cheaper!


CanaKit Raspberry Pi 5 Starter Kit PRO - Turbine Black (128GB Edition) (8GB RAM)

CanaKit Raspberry Pi 5 Starter Kit PRO - Turbine Black (128GB Edition) (8GB RAM)

Post a Comment

0 Comments