BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

[SOLVED] DS18b20 high value on blynk app

Do you get correct temperatures from the sensor in the serial monitor?

@Pavel Some people never learn:)

with blynk no, only with the arduino exemple cod is working

in blynk app i have on v0 100 value

First of all, don’t write data to virtual pins in Loop() because its easy to send too much data and it can get your project disconnected. Use the example from here like it is, because I can see you used parts of it, and then commented them out for some reason.: https://github.com/blynkkk/blynk-library/blob/master/examples/GettingStarted/PushDataOnRequest/PushDataOnRequest.ino#L26

Second thing is, that I’m not sure what code do you use, you posted here 4 different codes, a lot of parts are commented out which also creates some confusions.

Start with the example, make sure it is running and you can see in blynk the correct runtime value at V0, then add your function float getTemp() to the code and in the loop try printing out to serial monitor the value (Serial.println(temperature)). If thats correct, then pass the temperature value to the Blynk.virtualWrite function.

Ah, and this:

Blynk.virtualWrite(0, temperature); // Virtual 0

Probably should be:

Blynk.virtualWrite(V0, temperature); // Virtual 0

Hi Blynkers,
I played with the DS18b20 using a library and it worked easily, I can tell you the one I used (I’m not at home right now). Let me know and I’ll share with you all the information.

1 Like

@psoro I am currently working with these sensors and would like to see what you’ve done with them. code and libraries would be great! Thanks

Hi superjuice,
If you want to “play” with the DS18b20 you need two libraries: “OneWire” and “DallasTemperature”

You can find below both libraries:

http://www.pjrc.com/teensy/arduino_libraries/OneWire.zip
https://github.com/milesburton/Arduino-Temperature-Control-Library/archive/master.zip

After that, I did a small PCB (I enjoy soldering small boards… call me crazy :wink: ) because a 4.7k pull-up resistor must be connected to the 1-wire bus.

The code is like this:

#include <ESP8266_HardSer.h>
#include <BlynkSimpleShieldEsp8266_HardSer.h>
#include <SimpleTimer.h>
#include <OneWire.h> 
#include <DallasTemperature.h>

#define EspSerial Serial1 // Serial 1 Arduino Pro Micro!!!
SimpleTimer timer;
ESP8266 wifi(EspSerial);
#define Pin 3//  pin DATA ds18b20

char auth[] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";


OneWire ourWire(Pin); 
DallasTemperature sensors(&ourWire); 

void setup()
{
 // Set console baud rate
 Serial.begin(9600);
 delay(10);

 EspSerial.begin(9600);
 delay(10);
 
 Blynk.begin(auth, wifi,"xxxxx","xxxxxxxxxxxxxxxx","xxx.xxx.x.xx");
 delay(10);

 sensors.begin();
 delay(10);
 
 timer.setInterval(2000L, leeTEMP);
}


void leeTEMP()
{
  sensors.requestTemperatures();
  Blynk.virtualWrite(0, sensors.getTempCByIndex(0)); 
}



void loop()
{
  Blynk.run();
  timer.run();
}

And some photos:

Let me know your comments!
Regards

5 Likes

Hi guys,
I’m brand new to Blynk and very limited in my circuits knowledge, but I have a project that is very similar to this one. My project’s goal is to use two DS18b20 and a 4.7k resistor connected to one of the DS18b20. The object is that the DS18b20 connected to the 4.7k resistor will show a higher temperature than the DS18b20 that is not connected to the resistor, and then I can use the difference in temperature because I need delta T for another part of my project.
I would like to design a PCB in eagle that could do this. I am also brand new to eagle. What would the schematic look like in eagle?
Thanks!

@psoro can you please try the DS18B20 temperature probe on your WeMos and let me know if it works.

Not sure what it is with the ESP’s but a 4.7K pull-up doesn’t work even though the probes are rated from 3 to 5V. They will actually work on an Arduino down to about 1.9V.

Hi @Costas,
The DS18B20 with the 4.7K resistor works fine with my WeMos…
23.2 ºC at 11 PM! The summer is already here!

Thanks for checking @psoro.
28.5ºC here at almost 1am.
Did you take power from 5V or 3V3?
We had some success with 5V but very little with the 3V3.

My pleasure :slight_smile:!
In this case (with the WeMos) I power the sensor from 3V3.
When I use the Pro Micro or Nano I power from 5V.
In both situations, it works fine.

Regards!!

With a DS18B20 chip the circuit from 3V3 gives 28.25 ºC, with the probe the not connected -127.00 reading.
One last favour.

I and others have picked up almost zero voltage between the data pin and GND when the probe is connected, for me it is just 0.02V.

What does your meter show?

I suspect there is a bad batch of probes doing the rounds. With your working probe can you take the resistance readings across the following leads with the red probe (+ve) of your meter on the first colour shown on each row:

Red and Yellow (140.3K)
Red and Black (90.5K)
Black and Yellow (15.6K)

I don’t think a regular DS18B20 chip shows these resistance figures, other than between GND and data (black and yellow for the probes).

Sorry @Costas, I don’t understand… Signal from data pin is digital, I haven’t got a oscilloscope, I have only a multimeter.
The 3V3 output is 3.29V, the Data Pin shows 3.29V till I request reading values and goes to 3.24V then to 2.92V and come back again to 3.29V…
I’m a bit lost here…
Time to go to sleep mate…

Yes multimeter is fine. With the suspect probes connected the voltage of around 3.3V drops to around 0.02V. See resistance readings in my last post.

Night.

Hello Costas,

I was wondering did you mange to figure out what is causing this issue with DS18B20 probe and ESP?
I have the same problem, data line goes low and reading is always -127.

Yes, faulty components from 2 different suppliers. @psoro did me a few favours and gave me his suppliers details. The batch we bought from his supplier were all fine.

There are 2 possibilities AFAIK.

There are some that only work at 5V and not down to the 3.3V the first 2 suppliers stated or they were just faulty probes.

Do you want the supplier details?

Thank you, also tried 2 probes from two different suppliers,no luck.
You can write me the supplier info, don’t know if I will be able to get it in my county.

Sent you the details.

I know others that have bought faulty ones too.