Blynk 2.0 ESP8266 Home Automation

I have made the following Home automation projects with the new Blynk 2.0 and NodeMCU ESP8266.

Everything works fine, I can able to control relays from the Web dashboard and Blynk IoT app and monitor real-time feedback while controlling manually with switches.

Now, I want to add the following features to this projects
Control from Manual Switches without internet.
Use BlynkTimer to measure Temperature after every 2 seconds with DHT11.

Please help with this. if you have any suggestions please let me know.

4 Likes

Bro but I am getting error wificlientsecure has no member name

I have not faced such errors. Have you changed the “BlynkEdgent.h” file. If you can share the sketch then I can check.

Nice tutorial! Thanks for sharing.

1 Like

Thanks for the feedback. The New Blynk IoT platform has lots of new useful features.

1 Like

Thanks for making this video! Very nicely done! BTW, you can use widget cloning on mobile. Then you only would change Datastream

1 Like

Thank you Pavel for your valuable feedback and suggestion. Waiting for the Google Home and Alexa integration. Thanks for this simple but amazing IoT platform.

29 posts were split to a new topic: Does the shared access still exist

Nice example! Well done.

I tested it out last night with my “2nd” :wink: Inaugural test of Blynk 2.0… albeit with a WEMOS D1 Mini, a button shield and only 1 relay.

The sketch part went smoothly :stuck_out_tongue_winking_eye:

BTW, I moved the rest of the past comments into their own topic, as it seemed s shame to turn this Project topic into a back and forth about Blynk 2.0 sharing.

2 Likes

Thanks,
Any idea, how to control relays, if WiFi is not connected?

Are you using interrupts to detect change in button state ? Or timer ?

@VIGHNESHNS2008 Hello !!

He has posted a video link in post number one where he is already using a toggle switch to turn on or off a device for manual control. His issue is, when the wifi or internet is down the toggle switch becomes unresponsive. @techstudycell is asking how to overcome this problem.

@VIGHNESHNS2008 I would highly suggest you to go through the whole topic, each n every post to understand the issue and later answer if you know. Dont just simply answer to the random topics that you find in the forum. This will make the threads long and meaningless if filled with answers like this

Please explain in detail so everyone could understand.

Moderators can suspend your account if this continues. Please be careful.

First of all sorry @Madhukesh .

I saw his video and am his regular viewer too.

Here is my Suggested solution.

1.Make a Variable int Relay_state and int Connection

BLYNK_CONNECTED(){
int Connection=1;
BLYNK_DISCONNECTED(){
int Connection=0;

}
2. When your Manual Switch is on Make it ON, Write 1 on the variale.

if (Connection=0){    // If Device is offline...


if (digitalRead(DigitalPin)==HIGH){
      Relay_State=1;
    }

    else{
      Relay_State=0;
}

3.If Online

BLYNK_WRITE(VirtualSwitchPin)
{
Relay_State= paramasInt(); 
}
  1. In void loop implement the variables
if (RelayState==1)
{
digitalWrite(RelayPin,High);

}
else{digitalWrite(RelayPin,Low);

Hope This would Help…

Your Second Question

    #include <dht.h>

    dht DHT;

    #define DHT11_PIN 7

    BlynkTimer timer; // Announcing the timer

    void setup(){
                        \\your setup
      timer.setInterval(1000L, sensorDataSend); //timer will run every sec
    }

    void loop(){
                                  \\your loop

     }     

void sensorDataSend()
{
   int chk = DHT.read11(DHT11_PIN);
```  Serial.print("Temperature = ");
  Serial.println(DHT.temperature);
  Serial.print("Humidity = ");
  Serial.println(DHT.humidity);
  delay(1000);
   Blynk,virtualWrite(VPin, DHT.temperature);
}


[poll type=regular results=always max=20 chartType=pie]
# Did it Work?
* Yes
* No
* Errors
[/poll]

Forgot to Add timer.run in the loop

Try this

While the device is trying to reconnect for say 5 or 10 sec it blocks all the timers and code inside loop part. During this time the device is not responsive ans will not register the input via a physical button. To over come this we need to have interrupt routine which will always run in the priority to detect the change in the switch.

What you are suggesting is again going to get blocked by wifi while connecting.

Ok sir

Hi, I have resolved all the issues or limitations, which I have faced in the previous Blynk 2.0 project.
Now I can control the relays without Wi-Fi using IR remote and manual switches, and also monitor sensor data in the Blynk IoT app.
You can refer to the following video.

I have been using this technique for 4 years but with a 433 MHz remote control because with an IR remote control you need to be in front of the IR receiver and my esp32 is in my garage inside the main switchboard. :stuck_out_tongue_winking_eye:

It would be cool if you share the project details.