Noob needs help with temp anywhere project

I am trying to replicate a temp anywhere project I found on instructables:


I got the authors instruction on Dallas Temp and one wire loaded and checked that I was getting temp readings using serial monitor.
Now I am supposed to load the author’s TempMonBlynkExt.ino zip file but I can’t figure out how to do this. I have asked several questions on the instructable and I do not think it is being monitored or perhaps he is too busy.
Could anyone give me a step by step? This is my first Blynk and I would like to see it work.
Thanks in advance,
Dave
age 67 and still trying

Welcome to the Blynk Forum… Step by step instructions are not as simple as it seems… to much depends on your overall knowledge of Arduino, some programming, hardware, etc.

I highly recommend you try out the Help Center to get started learning Blynk… then try a few simple examples from the Sketch Builder and don’t forget the Documents page.

Then once you have a better handle on the basics, installing the files from that Instructable will make more sense.

And as you go along… feel free to ask for any clarifications with commands and such.

Never stop trying :+1:

1 Like

I don’t see a zip file for the ino sketch. It’s a plain text file containing this sketch:

/**************************************************************
 * IoT Temperature Monitor with Blynk
 * Blynk library is licensed under MIT license
 * This example code is in public domain.
 * 
 * Developed by Marcelo Rovai - 05 January 2017
 **************************************************************/

/* ESP & Blynk */
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
char auth[] = "YOUR AUTH CODE HERE";

/* WiFi credentials */
char ssid[] = "YOUR SSID";
char pass[] = "YOUR PASSWORD";

/* TIMER */
#include <SimpleTimer.h>
SimpleTimer timer;

/* DS18B20 Temperature Sensor */
#include <OneWire.h>
#include<DallasTemperature.h> 
#define ONE_WIRE_BUS 2 // DS18B20 on arduino pin2 corresponds to D4 on physical board
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);
float temp;

void setup() 
{
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);
  DS18B20.begin();
  timer.setInterval(1000L, getSendData);
}

void loop() 
{
  timer.run(); // Initiates SimpleTimer
  Blynk.run();
}

/***************************************************
 * Send Sensor data to Blynk
 **************************************************/
void getSendData()
{
  DS18B20.requestTemperatures(); 
  temp = DS18B20.getTempCByIndex(0);
  Serial.println(temp);
  Blynk.virtualWrite(10, temp); //virtual pin V10
}

Are you able to cut and paste this into your IDE?
Have you configured your IDE for use with ESP’s or is it just set up for flashing Arduino’s?

1 Like

Thank You Gunner, I intend to do that but right now I am prepping to go on a trip in 2 weeks and I want to get this up and running to keep an eye on my freezer.

Thank You Costas,

  1. I said zip b/c when I downloaded the ino file to my pc it was a zip.

  2. I did the whole first five steps of the instructible and got temp readings to run using the serial monitor so I got all that to work. IDE must be ok for ESP,
    3.So when I paste the text I should go ahead and put my token where it says authorization code, and the same with my network info? Do I use quotes?
    4.I did a trial without entering the #3 items above and got an exit status 1 #include expects “FILENAME”
    UPDATE: I found on another forum a guy with the same issue and he was told to just delete the #include, so I did that, please tell me if that is wrong. I then compiled and got:

    Arduino: 1.8.3 (Windows 10), Board: “NodeMCU 1.0 (ESP-12E Module), 80 MHz, 115200, 4M (3M SPIFFS)”

    sketch_aug24a:11: error: unable to find numeric literal operator ‘operator"" a94038a814044b1077308f478a1c1’

    char auth[] =328a94038a814044b1077308f478a1c1

I must be inputting info incorrectly.

I think with just a little nudge I can get this and I do promise I will learn this correctly when we get back from our trip.
Thanks,
Dave
below is the full error report, I x’d out my network password for posting:

Arduino: 1.8.3 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, 115200, 4M (3M SPIFFS)"

sketch_aug24a:11: error: unable to find numeric literal operator 'operator"" a94038a814044b1077308f478a1c1'

 char auth[] =328a94038a814044b1077308f478a1c1

              ^

sketch_aug24a:15: error: 'oxxxxxx0' was not declared in this scope

 char pass[] =oxxxxxxx0;

              ^

sketch_aug24a:18: error: 'SimpleTimer' does not name a type

 SimpleTimer timer;

 ^

sketch_aug24a:23: error: 'OneWire' does not name a type

 OneWire oneWire(ONE_WIRE_BUS);

 ^

sketch_aug24a:24: error: 'DallasTemperature' does not name a type

 DallasTemperature DS18B20(&oneWire);

 ^

C:\Users\longb\Downloads\sketch_aug24a\sketch_aug24a.ino: In function 'void setup()':

sketch_aug24a:30: error: 'Blynk' was not declared in this scope

   Blynk.begin(auth, ssid, pass);

   ^

sketch_aug24a:30: error: 'ssid' was not declared in this scope

   Blynk.begin(auth, ssid, pass);

                     ^

sketch_aug24a:31: error: 'DS18B20' was not declared in this scope

   DS18B20.begin();

   ^

sketch_aug24a:32: error: 'timer' was not declared in this scope

   timer.setInterval(1000L, getSendData);

   ^

C:\Users\longb\Downloads\sketch_aug24a\sketch_aug24a.ino: In function 'void loop()':

sketch_aug24a:37: error: 'timer' was not declared in this scope

   timer.run(); // Initiates SimpleTimer

   ^

sketch_aug24a:38: error: 'Blynk' was not declared in this scope

   Blynk.run();

   ^

C:\Users\longb\Downloads\sketch_aug24a\sketch_aug24a.ino: In function 'void getSendData()':

sketch_aug24a:46: error: 'DS18B20' was not declared in this scope

   DS18B20.requestTemperatures(); 

   ^

sketch_aug24a:49: error: 'Blynk' was not declared in this scope

   Blynk.virtualWrite(10, temp); //virtual pin V10

   ^

C:\Users\longb\Downloads\sketch_aug24a\sketch_aug24a.ino: In function 'void setup()':

sketch_aug24a:51: error: redefinition of 'void setup()'

 void setup() {

      ^

sketch_aug24a:27: error: 'void setup()' previously defined here

 void setup() 

      ^

C:\Users\longb\Downloads\sketch_aug24a\sketch_aug24a.ino: In function 'void loop()':

sketch_aug24a:56: error: redefinition of 'void loop()'

 void loop() {

      ^

sketch_aug24a:35: error: 'void loop()' previously defined here

 void loop() 

      ^

exit status 1
unable to find numeric literal operator 'operator"" a94038a814044b1077308f478a1c1'

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Yes, yes and yes.

You can’t delete the #include entries.

If it’s not working paste your code.

1 Like

I’m here at my pc , I have gone back to the instructable and re copied his code to make sure it is clean and un messed with and I’m opening a new pj in IDE.
Pasted his code and put my token in the quotes as well as my ssid and pw, all in quotes.
I’m getting this error that #include wants a “FILENAME”
Here is the paste of the error:

Arduino: 1.8.3 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, 115200, 4M (3M SPIFFS)"

sketch_aug24a:10: error: #include expects "FILENAME" or <FILENAME>

 #include 

          ^

sketch_aug24a:11: error: #include expects "FILENAME" or <FILENAME>

 #include 

          ^

sketch_aug24a:20: error: #include expects "FILENAME" or <FILENAME>

 #include 

          ^

sketch_aug24a:24: error: #include expects "FILENAME" or <FILENAME>

 #include 

          ^

sketch_aug24a:25: error: #include expects "FILENAME" or <FILENAME>

 #include 

          ^

exit status 1
#include expects "FILENAME" or <FILENAME>

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

This is the authors original code:

/**************************************************************
 * IoT Temperature Monitor with Blynk
 * Blynk library is licensed under MIT license
 * This example code is in public domain.
 * 
 * Developed by Marcelo Rovai - 05 January 2017
 **************************************************************/

/* ESP & Blynk */
#include 
#include 
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
char auth[] = "YOUR AUTH CODE HERE";

/* WiFi credentials */
char ssid[] = "YOUR SSID";
char pass[] = "YOUR PASSWORD";

/* TIMER */
#include 
SimpleTimer timer;

/* DS18B20 Temperature Sensor */
#include 
#include 
#define ONE_WIRE_BUS 2 // DS18B20 on arduino pin2 corresponds to D4 on physical board
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);
float temp;

void setup() 
{
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);
  DS18B20.begin();
  timer.setInterval(1000L, getSendData);
}

void loop() 
{
  timer.run(); // Initiates SimpleTimer
  Blynk.run();
}

/***************************************************
 * Send Sensor data to Blynk
 **************************************************/
void getSendData()
{
  DS18B20.requestTemperatures(); 
  temp = DS18B20.getTempCByIndex(0);
  Serial.println(temp);
  Blynk.virtualWrite(10, temp); //virtual pin V10
}

I’LL stay right here for the next hour with it all plugged in if that helps
THANK YOU

It’s because the libraries don’t show correctly with instructables or here of you don’t format the post correctly.
Try the code below but put your credentials in it:

/**************************************************************
 * IoT Temperature Monitor with Blynk
 * Blynk library is licensed under MIT license
 * This example code is in public domain.
 * 
 * Developed by Marcelo Rovai - 05 January 2017
 **************************************************************/

/* ESP & Blynk */
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
char auth[] = "YOUR AUTH CODE HERE";

/* WiFi credentials */
char ssid[] = "YOUR SSID";
char pass[] = "YOUR PASSWORD";

/* TIMER */
//#include <SimpleTimer.h>  // NOT REQUIRED WITH BLYNK LIBRARY VERSION 0.4.8 AND BEYOND
BlynkTimer timer;

/* DS18B20 Temperature Sensor */
#include <OneWire.h>
#include<DallasTemperature.h> 
#define ONE_WIRE_BUS 2 // DS18B20 on arduino pin2 corresponds to D4 on physical board
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);
float temp;

void setup() 
{
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);
  DS18B20.begin();
  timer.setInterval(1000L, getSendData);
}

void loop() 
{
  timer.run(); // Initiates SimpleTimer
  Blynk.run();
}

/***************************************************
 * Send Sensor data to Blynk
 **************************************************/
void getSendData()
{
  DS18B20.requestTemperatures(); 
  temp = DS18B20.getTempCByIndex(0);
  Serial.println(temp);
  Blynk.virtualWrite(10, temp); //virtual pin V10
}
1 Like

Did that, eprhaps I pasted it in the wrong place? I pasted right at the top, I’m just guessing.
Here is the error report:

Arduino: 1.8.3 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, 115200, 4M (3M SPIFFS)"

C:\Users\longb\Downloads\sketch_aug24a\sketch_aug24c\sketch_aug24c.ino: In function 'void setup()':

sketch_aug24c:56: error: redefinition of 'void setup()'

 void setup() {

      ^

sketch_aug24c:31: error: 'void setup()' previously defined here

 void setup() 

      ^

C:\Users\longb\Downloads\sketch_aug24a\sketch_aug24c\sketch_aug24c.ino: In function 'void loop()':

sketch_aug24c:61: error: redefinition of 'void loop()'

 void loop() {

      ^

sketch_aug24c:39: error: 'void loop()' previously defined here

 void loop() 

      ^

exit status 1
redefinition of 'void setup()'

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

What I provided is the full sketch, paste over the top of any other code you have. Then enter your token and WiFi details.

1 Like

You are a Blynk HERO
Thank you, thank you, is there some way I can give you points or something?
I did mark all your help with a like.
And how do I mark this a solved?

1 Like

I replicated a pj I found on instructibles for wifi temp:


Got it all up and running well but want to have the temp readings in F not C
Tried to do it myself by changing the C in the below to F:
DS18B20.requestTemperatures();
temp = DS18B20.getTempCByIndex(0);
Serial.println(temp);
Blynk.virtualWrite(10, temp); //virtual pin V10

Now I get readings in F but they are pretty slow to react (20secs) and Blynk keeps reconnecting to the server.
Should I have made other changes to the code?

/**************************************************************
 * IoT Temperature Monitor with Blynk
 * Blynk library is licensed under MIT license
 * This example code is in public domain.
 * 
 * Developed by Marcelo Rovai - 05 January 2017
 **************************************************************/

/* ESP & Blynk */
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
char auth[] = "YOUR AUTH CODE HERE";

/* WiFi credentials */
char ssid[] = "YOUR SSID";
char pass[] = "YOUR PASSWORD";

/* TIMER */
//#include <SimpleTimer.h>  // NOT REQUIRED WITH BLYNK LIBRARY VERSION 0.4.8 AND BEYOND
BlynkTimer timer;

/* DS18B20 Temperature Sensor */
#include <OneWire.h>
#include<DallasTemperature.h> 
#define ONE_WIRE_BUS 2 // DS18B20 on arduino pin2 corresponds to D4 on physical board
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);
float temp;

void setup() 
{
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);
  DS18B20.begin();
  timer.setInterval(1000L, getSendData);
}

void loop() 
{
  timer.run(); // Initiates SimpleTimer
  Blynk.run();
}

/***************************************************
 * Send Sensor data to Blynk
 **************************************************/
void getSendData()
{
  DS18B20.requestTemperatures(); 
  temp = DS18B20.getTempCByIndex(0);
  Serial.println(temp);
  Blynk.virtualWrite(10, temp); //virtual pin V10
}

Thanks in advance, I know I need to start learning this properly, but today I am on a 2 week deadline to get a monitor running for our chest freezer before we go on a trip.
Dave

@David_Vinch is V10 a display widget and have you changed the default READING RATE from “1 sec” to “PUSH”? It should update at 1 second intervals from the setInterval of 1000ms in your sketch. Something not right if it’s taking 20 seconds.

It could be your error with the READING RATE because ESP’s get confused if they are being pulled by the app and pushed by the sketch. One or the other, not both.

1 Like

Thanks for your suggestion, I’m going to keep a copy in my pj folder and look into it. Apparently the problem I was experiencing this AM was not code related at all, This afternoon all is fine, and again this evening. Just one of those things.
Display is a gauge and a graph.

Same thing applies to a gauge, default is 1sec and you must change to PUSH.

1 Like

O.K. Thanks.

I second this…

Even though I only used virtual pins… and even went as far as adding in this line…

#define BLYNK_NO_BUILTIN // Disable built-in App <--> Analog & Digital pin operations

…to my script, I was chasing reliability issues. Then thanks to @Costas, I realised I had about half my displays (of various types) set to the default 1sec… once I switched them all to PUSH, everything was fine.

1 Like

Did as instructed Thanks.

Hi Folks, I just wanted to check in again. The author made another instructible to up the project to two sensors and since that was my original intention I went ahead. I had a lot of compilation issues until I replaced his simple timer with the blynk timer that Costas used in his rework. Now it is up and running I am getting temps on both sensors, using both gauge and history graph for both.
I am still using PUSH as instructed but again seeing those pesky reconnects, but temp updates are basically o’k’ for response. My intent here is just to monitor freezer temps so I don’t really need instant responses just need to know that it hasn’t shut down and spoiling all my put asides for the winter months. LOL what led to this was last year that did happen all that hard work went in the trash.
V10 handles one and V11 the other. Anyway here is a paste of the code:

/**************************************************************
 * IoT Multiple Temperature Monitor with Blynk
 * Blynk library is licensed under MIT license
 * This example code is in public domain.
 * 
 * Multiple OneWire Sensor: DS18B20
 * Developed by Marcelo Rovai - 25 August 2017
 **************************************************************/

/* ESP & Blynk */
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
char auth[] = " token here";

/* WiFi credentials */
char ssid[] = "router identity";
char pass[] = "network password";

/* TIMER */
BlynkTimer timer;

/* DS18B20 Temperature Sensor */
#include <OneWire.h>
#include<DallasTemperature.h> 
#define ONE_WIRE_BUS 2 // DS18B20 on arduino pin2 corresponds to D4 on physical board
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);
int temp_0;
int temp_1;

void setup() 
{
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);
  DS18B20.begin();
  timer.setInterval(1000L, getSendData);
  Serial.println(" ");
  Serial.println("Testing Dual Sensor data");
}

void loop() 
{
  timer.run(); // Initiates SimpleTimer
  Blynk.run();
}

/***************************************************
 * Send Sensor data to Blynk
 **************************************************/
void getSendData()
{
  DS18B20.requestTemperatures(); 
  temp_0 = DS18B20.getTempFByIndex(0); // Sensor 0 will capture Temp in Celcius
  temp_1 = DS18B20.getTempFByIndex(1); // Sensor 0 will capture Temp in Fahrenheit

  Serial.print("Temp_0: ");
  Serial.print(temp_0);
  Serial.print(" oF . Temp_1: ");
  Serial.print(temp_1);
  Serial.println(" oF");
   
  Blynk.virtualWrite(10, temp_0); //virtual pin V10
  Blynk.virtualWrite(11, temp_1); //virtual pin V11
}

If you see anything amiss give me a shout.
Thank You for making this project a reality and I do put my money where my mouth is, I’m making a contribution to Blynk.
Regards,
Dave

You have these declared twice in your sketch which will normally stop compilation so I have removed the first set from your sketch.

1 Like

Also I think temp_0 and temp_1 should be float not int. So 24.7 degrees not 24 degrees. Unless you have removed most of the useful resolution of the DS18B20’s.

1 Like