DHT12 Esp8266 (D1Mini) OneWire conections & blynk

Home Forums Home automation (domotics) DHT12 Esp8266 (D1Mini) OneWire conections & blynk

Viewing 2 reply threads
  • Author
    Posts
    • #4635
      dziobas83

        thanks a loot!! i use DHT12 Esp8266 (D1Mini) OneWire conections & blynk :

        //
        //in blynk app use label value V0 and V1 for read data
        #define BLYNK_PRINT Serial
        #include <ESP8266WiFi.h>
        #include <BlynkSimpleEsp8266.h>
        #include <DHT12.h>
        #include <Wire.h> //The DHT12 uses I2C comunication.
        DHT12 dht12(D4, true);
        // You should get Auth Token in the Blynk App.
        // Go to the Project Settings (nut icon).
        char auth[] = "***********";
        // Your WiFi credentials.
        // Set password to "" for open networks.
        char ssid[] = "*********";
        char pass[] = "********";
        BlynkTimer timer;
        void myTimerEvent() {
        // You can send any value at any time.
        // Please don't send more that 10 values per second.
        Blynk.virtualWrite(V9, millis() / 1000);
        float tmp = dht12.readTemperature();
        float hum = dht12.readHumidity();
        Serial.printf("Temperatura: %2.2f*C Wilgotnosc: %0.2f%%\r\n", tmp, hum);
        Blynk.virtualWrite(V0, tmp);
        Blynk.virtualWrite(V1, hum);
        }
        void setup() { // Debug console
        Serial.begin(9600);
        dht12.begin();
        Blynk.begin(auth, ssid, pass);
        timer.setInterval(2000L, myTimerEvent); }
        void loop() { Blynk.run(); timer.run(); // Initiates BlynkTimer }
        

      • #4672
        LottyZak

          Hi…you mention “-127 on Blynk” but this is nothing to do with Blynk. -127 is the default reading you get from a DS18B20 when you haven’t set it up correctly.So the way to proceed is to get the sensor working without Blynk and then Blynkify it. The internet has hundreds if not thousands of pages on the DS18B20.

        • #4675
          Renzo Mischianti
          Keymaster

            Hi LottyZak,

            The sensor is a DHT12, and the value -127 isn’t present.

            Can you put an example of your idea.

            Thanks Renzo

        Viewing 2 reply threads
        • You must be logged in to reply to this topic.
        Exit mobile version