Arduino D1 temperature code is not working for me.

Hi,  I'm working on a temperature( DS18B20) project with the model D1 of Arduino and I will like to connected to the internet via Blynk . I was able to configure the WiFi and the blink project. But when I try to use this code the application of Blynk say that I don't have connection with the board. I find a code that everybody is using but is not working for me. Can you help me please?   This is my code: #define BLYNK_PRINT Serial // Enables Serial Monitor #include #include #include //EAO #include // OneWire DS18S20, DS18B20, DS1822 Temperature Example // // http://www.pjrc.com/teensy/td_libs_OneWire.html // // The DallasTemperature library can do all this work for you! // http://milesburton.com/Dallas_Temperature_Control_Library OneWire  ds(7);  // on pin 7 (a 4.7K resistor is necessary) WidgetLCD lcd(V1); // You should get Auth Token in the Blynk App. // Go to the Project Settings (nut icon). char auth[] = "f7d376f1ae554207a6666c45babe7e69"; // Your WiFi credentials. // Set password to "" for open networks. char ssid[] = "Samsung Galaxy Note 4 0628"; char pass[] = "1234567"; void setup() {   Serial.begin(9600); // See the connection status in Serial Monitor Blynk.begin(auth, ssid, pass);  // Here your Arduino connects to the Blynk Cloud. } void loop() {   Blynk.run(); // All the Blynk Magic happens here...   // You can inject your own code or combine it with other sketches.   // Check other examples on how to communicate with Blynk. Remember   // to avoid delay() function! // delay(1000);   byte i;   byte present = 0;   byte type_s;   byte data[12];   byte addr[8];   float celsius, fahrenheit;   if ( !ds.search(addr)) {     Serial.println("No more addresses.");     Serial.println();     ds.reset_search();   //  delay(250);     return;   }   Serial.print("ROM =");   for ( i = 0; i < 8; i++) {     Serial.write(' ');     Serial.print(addr[i], HEX);   }   if (OneWire::crc8(addr, 7) != addr[7]) {     Serial.println("CRC is not valid!");     return;   }   Serial.println();   // the first ROM byte indicates which chip   switch (addr[0]) {     case 0x10:       Serial.println("  Chip = DS18S20");  // or old DS1820       type_s = 1;       break;     case 0x28:       Serial.println("  Chip = DS18B20");       type_s = 0;       break;     case 0x22:       Serial.println("  Chip = DS1822");       type_s = 0;       break;     default:       Serial.println("Device is not a DS18x20 family device.");       return;   }   ds.reset();   ds.select(addr);   ds.write(0x44, 1);        // start conversion, with parasite power on at the end //  delay(1000);     // maybe 750ms is enough, maybe not   // we might do a ds.depower() here, but the reset will take care of it.   present = ds.reset();   ds.select(addr);   ds.write(0xBE);         // Read Scratchpad   Serial.print("  Data = ");   Serial.print(present, HEX);   Serial.print(" ");   for ( i = 0; i < 9; i++) {           // we need 9 bytes     data[i] = ds.read();     Serial.print(data[i], HEX);     Serial.print(" ");   }   Serial.print(" CRC=");   Serial.print(OneWire::crc8(data, 8), HEX);   Serial.println();   // Convert the data to actual temperature   // because the result is a 16 bit signed integer, it should   // be stored to an "int16_t" type, which is always 16 bits   // even when compiled on a 32 bit processor.   int16_t raw = (data[1] << 8) | data[0];   if (type_s) {     raw = raw << 3; // 9 bit resolution default     if (data[7] == 0x10) {       // "count remain" gives full 12 bit resolution       raw = (raw & 0xFFF0) + 12 - data[6];     }   } else {     byte cfg = (data[4] & 0x60);     // at lower res, the low bits are undefined, so let's zero them     if (cfg == 0x00) raw = raw & ~7;  // 9 bit resolution, 93.75 ms     else if (cfg == 0x20) raw = raw & ~3; // 10 bit res, 187.5 ms     else if (cfg == 0x40) raw = raw & ~1; // 11 bit res, 375 ms     //// default is 12 bit resolution, 750 ms conversion time   }   celsius = (float)raw / 16.0;   fahrenheit = celsius * 1.8 + 32.0;   Serial.print("  Temperature = ");   Serial.print(celsius);   Serial.print(" Celsius, ");   Serial.print(fahrenheit);   Serial.println(" Fahrenheit");   Blynk.virtualWrite(V5, celsius);   Blynk.virtualWrite(V6, celsius);   Blynk.virtualWrite(V7, celsius);   Blynk.virtualWrite(V8, celsius);   lcd.clear();   lcd.print(0, 0, "Temperature");   lcd.print(0, 1, celsius); }

Question by ealemanypr 2 years ago  |  last reply 2 years ago


How to send a value from Blynk to Arduino?

Hi All,I am doing my project by using blynk and arduino mega. This code is to control Relay by measuring temperature and humidity through dht11. Now I programmed that Relay is off when the humidity is over 60 which is the fixed value. However, I want to add slider or other input switch to set the humidity value on the app. And then the set value is sent from Blynk to Arudino. Therefore, Relay will be on or off, depending on the set value. I’ve been trying it but failed. Please anybody can help me? Thank you.#define BLYNK_PRINT SwSerial #include SoftwareSerial SwSerial(10, 11); // RX, TX#include #include char auth[] = “*****************************”; #define DHTPIN A1 #define DHTTYPE DHT11 // DHT 11 DHT dht(DHTPIN, DHTTYPE); BlynkTimer timer; void sendSensor() { int h = dht.readHumidity(); int t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit Blynk.virtualWrite(V5, h); Blynk.virtualWrite(V6, t); if(h<60){ digitalWrite(52,HIGH); } else{ digitalWrite(52,LOW); } } void setup() { // Debug console SwSerial.begin(9600); pinMode(52,OUTPUT); // Blynk will work through Serial // Do not read or write this serial manually in your sketch Serial.begin(9600); Blynk.begin(Serial, auth); dht.begin(); // Setup a function to be called every second timer.setInterval(1000L, sendSensor); } void loop() { Blynk.run(); timer.run(); }

Question by chocomilk77 9 months ago


wemos d1 mini blynk? display temperature&humidity?

this is my code and it works to display c&% on display and blynk app and it notifies me when it starts and run time, is there a way to display runtime/uptime on the display and should i remove anything? maybe add in code to send email when offline for more than 5 minutes? why does the screen go black when it updates? what other data can i display on the screen? it will be used to monitor server room temperature, thanks #include #include #include #include "Adafruit_SSD1306.h" #include #include #include #define OLED_RESET 0  // GPIO0 Adafruit_SSD1306 display(OLED_RESET); #define BLYNK_PRINT Serial #define DHTPIN D4 #define DHTTYPE DHT22  DHT dht(DHTPIN, DHTTYPE); // 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 notifyUptime() {   long uptime = millis() / 60000L;   // Actually send the message.   // Note:   //   We allow 1 notification per 15 seconds for now.   Blynk.notify(String("Running for ") + uptime + " minutes."); } void sendSensor() {   float h = dht.readHumidity();   float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit   if (isnan(h) || isnan(t)) {     Serial.println("where is my DHT sensor!");     return;   }   // You can send any value at any time.   // Please don't send more that 10 values per second.   Blynk.virtualWrite(V5, h);   Blynk.virtualWrite(V6, t); } void setup() {   // Debug console   Serial.begin(9600);   Blynk.begin(auth, ssid, pass);   // You can also specify server:   //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);   //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);   dht.begin();   // Notify immediately on startup   Blynk.notify("Device started");   // Setup a function to be called every minute   timer.setInterval(60000L, notifyUptime);     // Setup a function to be called every second   timer.setInterval(1000L, sendSensor); } void loop() {   Blynk.run();   timer.run();   Serial.begin(115200);   dht.begin();   // by default, we'll generate the high voltage from the 3.3v line internally! (neat!)   display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3C (for the 64x48)   display.display();   delay(5000);   // Efface l'écran et positionne le curseur dans le coin supérieur gauche - clear display and set cursor on the top left corner   display.clearDisplay();   display.setTextSize(2);   display.setTextColor(WHITE);   display.setCursor(0,0);   float h = dht.readHumidity();   float t = dht.readTemperature();   float f = dht.readTemperature(true);   float bat = ESP.getVcc();// / 1024;   // Check if any reads failed and exit early (to try again).   if (isnan(h) || isnan(t) || isnan(f)) {     Serial.println("where is DHT sensor!");     return;   }     // Température en Celcius - Temperature in Celcius // display.println("Temp.");   display.print(t);   display.println(" c");   // Humidité en % - Humidity in % // display.println("Humidity"); //display.setTextSize(1);   display.print(h);   display.print(" %");   display.display(); }

Question by turbiny 1 year ago


Arduino Outdoor Security System - PIR Motion Sensor, Security Lights, Intruder Warning/Alarm & Blynk Notification

I would like to ask your suggestions on how to build an outdoor ESP2866 security and sensors combo. I have seen separate postings on PIR and lights around the site and in other websites so I thought it would be doable. I knew Arduino then but only paid close attention when I realized that my x-10s are outmoded but z-wave devices are expensive. So I am learning about it, how to sketch and trying to understand C++ more. My dream is to build an outdoor ESP2866 combo, powered by an AC120v-5v module, with two PIR motion sensors, three 120v relay switches (two relays for two sets of security floodlights and one relay for an amp/wave speaker with mic), a photo (dusk/dawn) sensor and temperature/humidity sensor (for a future thermostat). Operationally, I imagine that it could be armed and disarmed through Blynk. When armed at daytime, a motion will trigger a low volume intruder MP3 warning alert with 10 minutes of security lights at night. But if the trigger persists for more than 5 minutes, the security floodlights will blink, a loud intruder alarm will sound and push phone notifications. What will be the best way to sketch these? What is the better way of wiring them together? How could I make multiple ESP2866s in the same WAN work together for an event? The desired function is if an alarm event is triggered in one of the ESP2866 that would also set off blinking lights and alarm sounds in the other ESPs. Thanks for all your help.

Topic by EeA2 1 year ago  |  last reply 4 months ago


Bluetooth Class Request

Can we have a bluetooth class please? I'd like to see one with Blynk especially. I've been learning it for the past couple weeks for the Arduino 101 and there's no good resources online, just a bunch of hack and half of them don't work.  I'm actually gonna write a bunch of ible for the community, but a class would be awesome!

Topic by TechMartian 1 year ago  |  last reply 1 year ago


how do I connect the Wemos D1 r2 to an L298n motor driver to control 2 DC mootors?

Hi , I'm new and I'm looking for help to see how we can wire a Wemos d1 r2 and L298n motor driver. My objective is to control 2 DC motors with Blynk. I will really appreciate anyone's answer or sketch or link to help me out. thanks

Question by huguens 2 years ago  |  last reply 2 years ago


Automatic Irrigation using d1 mini

Hi Everyone, I reviewed different automatic irrigation system projects here in instructables and other sites as well and i decided to gather parts to do a simple small project myself. One thing that comes hard is the programming part as I don't know any programming language. I'm looking for some help with code merging, explanation and some general guidance. Could you please let me know, point me to right direction and tell me what you think and if requirements are actually achievable? What I would like to achieve: Intention of this project is to have manual and auto irrigation system which will: 1. Measure soil moisture and dependently on the value activate the usb pump which will water the plant (preferably analog output that will show the measurements in %) 2. Manual activating the pump via hardware button and via mobile phone with internet connection 3. Distance sensor which should measure how much water is left in the tank 4. Email notification with info when to water the plants and soil sensor data regardless of the automatic process that has already started 5. Email notification with info about the water in the tank when it’s near empty 6. Dashboard preferably inside the network (not using third party like blynk or others) with access from the internet (I have QNAP that I think can be used). 7. If possible – have amazon echo (Alexa) read the sensor data to tell me the values and comment if the plant should or shouldn’t be watered or the tank should be refiled or not as well as ability to ask Alexa to start or stop the irrigation Hardware: D1 mini: https://wiki.wemos.cc/products:d1:d1_mini Wemos V2 Relay shield: http://hobbycomponents.com/shields/865-wemos-v2-relay-shield My relay is slightly modified: 2 small wires soldered to the vcc and ground so that when it receives the signal on d1 pin it opens and current flows to female usb connector supposedly activating the usb water pump. All this can be stacked together even with soldered wires YL-69 sensor: http://www.oddwires.com/yl-69-soil-hygrometer-humidity-soil-moisture-detection-sensor/ Ultrasonic Distance Sensor (HC-SR04): https://thepihut.com/products/ultrasonic-distance-sensor-hcsr04 USB mini water pump: www.goo.gl/yUABDd Button x4 if needed: Board x4 if needed: sample codes used in other projects: https://randomnerdtutorials.com/guide-for-soil-moisture-sensor-yl-69-or-hl-69-with-the-arduino/ https://create.arduino.cc/projecthub/nekhbet/using-the-yl-39-yl-69-soil-humidity-sensor-with-arduino-968268 https://community.blynk.cc/t/irrigation-relay-with-timer-esp8266-wip/700 Alexa enabled homemade cat feeder example: https://www.hackster.io/darian-johnson/alexa-powered-automated-cat-feeder-9416d4 Thank you very much in advance for your help and support.

Topic by wube 1 year ago  |  last reply 1 year ago