circuit diagram
pin connection:
- Vcc -- Vcc
- Gnd -- Gnd
- Data -- D15
code :
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include "DHTesp.h"
#define DHTpin 15 //D15 of ESP32 DevKit
DHTesp dht;
float temperature;
float humidity;
char auth[] = "blynk auth";
char ssid[] = "wifi-name";
char pass[] = "password";
void setup()
{
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
dht.setup(DHTpin, DHTesp::DHT11);
}
void loop() {
// put your main code here, to run repeatedly:
Blynk.run();
float temperature = dht.getTemperature();
float humidity = dht.getHumidity();
Blynk.virtualWrite(V1, temperature);
Blynk.virtualWrite(V2, humidity);
delay(1500);
}
Youtube video tutorial:
circuit diagram:
pin connection :
pin connection :
- Relay1 --2
- Relay2 --3
- Tx of bluetooth -- Rx of arduino
- Rx of bluetooth -- Tx of arduino
App used for controll the led
Download the app by click here
code for the project
int relay1 = 2;
int relay2 = 3;
char val;
void setup()
{
pinMode(relay1, OUTPUT);
pinMode(relay2, OUTPUT);
Serial.begin(9600);
}
void loop()
{
while (Serial.available() > 0)
{
val = Serial.read();
Serial.println(val);
}
if( val == 'a') // relay1 on
{
digitalWrite(relay1,HIGH);
}
else if(val == 'b') //relay2 on
{
digitalWrite(relay2,HIGH);
}
else if(val == 'd') // relay1 off
{
digitalWrite(relay1,LOW);
}
else if(val == 'e') // relay2 off
{
digitalWrite(relay2,LOW);
}
}
int relay2 = 3;
char val;
void setup()
{
pinMode(relay1, OUTPUT);
pinMode(relay2, OUTPUT);
Serial.begin(9600);
}
void loop()
{
while (Serial.available() > 0)
{
val = Serial.read();
Serial.println(val);
}
if( val == 'a') // relay1 on
{
digitalWrite(relay1,HIGH);
}
else if(val == 'b') //relay2 on
{
digitalWrite(relay2,HIGH);
}
else if(val == 'd') // relay1 off
{
digitalWrite(relay1,LOW);
}
else if(val == 'e') // relay2 off
{
digitalWrite(relay2,LOW);
}
}
youtube tutorial:




