Hi Martin
Thanks that worked, just one small thing is that the temp is out by +- 5°C is there a way to correct that or must I just subtract 5 from ThermistorCalc variable.
DS18B20 not reading every time
-
- Posts: 136
- http://meble-kuchenne.info.pl
- Joined: Mon Mar 08, 2021 11:25 am
- Location: Cape Town South Africa
- Has thanked: 41 times
- Been thanked: 12 times
-
- Matrix Staff
- Posts: 1920
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 622 times
- Been thanked: 645 times
Re: DS18B20 not reading every time
There are a few things you can do if the temperature is out.
5 deg is a lot as I was getting much better accuracy, but does depend on the component tolerances.
Make sure the pullup resistor is measured with an accurate meter, and the value is entered on the Flowchart.
Check and enter the correct thermistor beta value.
It should be within the thermistor datasheet.
Change the TemperatureOffset constant from 0 to -50 Make sure all the constants are at the correct values.
Use the built-in thermistor component if the beta is not known.
5 deg is a lot as I was getting much better accuracy, but does depend on the component tolerances.
Make sure the pullup resistor is measured with an accurate meter, and the value is entered on the Flowchart.
Check and enter the correct thermistor beta value.
It should be within the thermistor datasheet.
Change the TemperatureOffset constant from 0 to -50 Make sure all the constants are at the correct values.
Use the built-in thermistor component if the beta is not known.
Martin
-
- Posts: 136
- Joined: Mon Mar 08, 2021 11:25 am
- Location: Cape Town South Africa
- Has thanked: 41 times
- Been thanked: 12 times
Re: DS18B20 not reading every time
Hi Martin
Thanks for that what I did is measure resistor it is 9.9k so I put that in and chanced the temp offset as you suggested now seams to be pretty close. I have looked at the data sheet but they don"t give the thermistor beta value. I do not have the sensor package as of yet so can't use the thermistor component.
Not sure if you can work out the beta from this data sheet
Thanks for that what I did is measure resistor it is 9.9k so I put that in and chanced the temp offset as you suggested now seams to be pretty close. I have looked at the data sheet but they don"t give the thermistor beta value. I do not have the sensor package as of yet so can't use the thermistor component.
Not sure if you can work out the beta from this data sheet
-
- Matrix Staff
- Posts: 1926
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 503 times
- Been thanked: 686 times
Re: DS18B20 not reading every time
Hello,
I have managed to replicate the problem but only ocasionally, for me the data is correct most of the time and every so often it is corrupt when the WIFI is active. Out of interest what value of pull up resistor are you using? It could be linked with network activity or how much data the ESP32 is transferring so maybe there is a way to create a pause in the data flow when you are sampling the temperature. It might also be worth monitoring the VCC and see how stable that is, e.g. if the WIFI comms is causing ripples or dips in the supply voltage due to lack of current.
I tweaked the timings in the OneWire component to try and correct the problem but it didn't really make any difference.
I have added a new property to the DS18B20 component which enables CRC checking so now if the data is not correct and the CRC is not a match we return 999.9 instead of an unknown value. This should mean you can rely on the temperature readings you do get. I'll roll this out to the other one wire temperature sensor components.
I have managed to replicate the problem but only ocasionally, for me the data is correct most of the time and every so often it is corrupt when the WIFI is active. Out of interest what value of pull up resistor are you using? It could be linked with network activity or how much data the ESP32 is transferring so maybe there is a way to create a pause in the data flow when you are sampling the temperature. It might also be worth monitoring the VCC and see how stable that is, e.g. if the WIFI comms is causing ripples or dips in the supply voltage due to lack of current.
I tweaked the timings in the OneWire component to try and correct the problem but it didn't really make any difference.
I have added a new property to the DS18B20 component which enables CRC checking so now if the data is not correct and the CRC is not a match we return 999.9 instead of an unknown value. This should mean you can rely on the temperature readings you do get. I'll roll this out to the other one wire temperature sensor components.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
-
- Posts: 136
- Joined: Mon Mar 08, 2021 11:25 am
- Location: Cape Town South Africa
- Has thanked: 41 times
- Been thanked: 12 times
Re: DS18B20 not reading every time
Hi Ben
Thanks I'm using a 4.7k pull up resistor, I will check the power supply voltage and see whats happening there and let you know
Thanks I'm using a 4.7k pull up resistor, I will check the power supply voltage and see whats happening there and let you know
-
- Matrix Staff
- Posts: 1920
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 622 times
- Been thanked: 645 times
Re: DS18B20 not reading every time
Hi.
From the datasheet, I have entered the resistance values in this calculator for 25C and 85C
The beta derived is 3990.
I hope Ben's fix works for you as the DS18B20 is a great component.
Especially after Ben has modified the component to allow multiple sensors connected to the single data line.
From the datasheet, I have entered the resistance values in this calculator for 25C and 85C
The beta derived is 3990.
I hope Ben's fix works for you as the DS18B20 is a great component.
Especially after Ben has modified the component to allow multiple sensors connected to the single data line.
Martin
-
- Matrix Staff
- Posts: 1926
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 503 times
- Been thanked: 686 times
Re: DS18B20 not reading every time
I'm using a 1K pull up so might be worth trying and see if it makes any difference.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
-
- Posts: 136
- Joined: Mon Mar 08, 2021 11:25 am
- Location: Cape Town South Africa
- Has thanked: 41 times
- Been thanked: 12 times
Re: DS18B20 not reading every time
Hi Ben
I fitted a 1K no difference , how I'm controlling the ESP32 is through app developer I have 2 probe's and i can switch between the max6675 and the DS18b20. What I have just noticed that if I only initialise the WLAN and the network comm's it reads reads and then every now and then I get the 999. But when I initialise the ModbusTCPSlave that's when all goes to hell and all I get is 999. When I look at the signals on the scope of the one wire it looks very clean so not sure whats going on. It seems to be something in the ModbusTCPSlave can PM both programs to you if you like
I fitted a 1K no difference , how I'm controlling the ESP32 is through app developer I have 2 probe's and i can switch between the max6675 and the DS18b20. What I have just noticed that if I only initialise the WLAN and the network comm's it reads reads and then every now and then I get the 999. But when I initialise the ModbusTCPSlave that's when all goes to hell and all I get is 999. When I look at the signals on the scope of the one wire it looks very clean so not sure whats going on. It seems to be something in the ModbusTCPSlave can PM both programs to you if you like
-
- Posts: 136
- Joined: Mon Mar 08, 2021 11:25 am
- Location: Cape Town South Africa
- Has thanked: 41 times
- Been thanked: 12 times
Re: DS18B20 not reading every time
Hi Guys
I am totally confused with this, When I start the program running and I have WLAN, networkComms & ModbusTCPSlave initialised sometimes it runs for a short while then stops then I need to remove power leave it off for a about 20 second then power up and sometimes the system restarts some time not. If i disable the WLAN, networkComms & ModbusTCPSlave and run the system It runs forever.
Running then stops working picture of the comms on the probe when it has stopped working Whats also strange is that when I flash the NodeMCU ESP32 after it has stopped working and fire it up again it still dos not run until I remove the power leave it off for a few seconds then power back up. I though it could be the module so I have tries another one and I have the same results
I am totally confused with this, When I start the program running and I have WLAN, networkComms & ModbusTCPSlave initialised sometimes it runs for a short while then stops then I need to remove power leave it off for a about 20 second then power up and sometimes the system restarts some time not. If i disable the WLAN, networkComms & ModbusTCPSlave and run the system It runs forever.
Running then stops working picture of the comms on the probe when it has stopped working Whats also strange is that when I flash the NodeMCU ESP32 after it has stopped working and fire it up again it still dos not run until I remove the power leave it off for a few seconds then power back up. I though it could be the module so I have tries another one and I have the same results
-
- Posts: 136
- Joined: Mon Mar 08, 2021 11:25 am
- Location: Cape Town South Africa
- Has thanked: 41 times
- Been thanked: 12 times
Re: DS18B20 not reading every time
Hi Guys
I did a full update yesterday but problem persists, I can use another probe for this project but that will only solve one problem as I'm busy with another project that also uses the one wire bus and I need to be able to control it over WIFI. It will be using the DHT22 Temp Humidity sensor. I do not want to spend +-R700.00 (35.00 pounds) for the sensor package and I still sit with the same problem
One thing I have just noticed is that I can connect to WLAN, networkComms & ModbusTCPSlave the system runs without a problem the minute I enable the WLAN_ESP32::ConnectToSSID that's when everything goes to hell.
I did a full update yesterday but problem persists, I can use another probe for this project but that will only solve one problem as I'm busy with another project that also uses the one wire bus and I need to be able to control it over WIFI. It will be using the DHT22 Temp Humidity sensor. I do not want to spend +-R700.00 (35.00 pounds) for the sensor package and I still sit with the same problem
One thing I have just noticed is that I can connect to WLAN, networkComms & ModbusTCPSlave the system runs without a problem the minute I enable the WLAN_ESP32::ConnectToSSID that's when everything goes to hell.