1W Temperature Sensor 18s20 shows old values
-
Hello everybody,
I'm trying to transmit temperatures from 1Wire 18S20 Sensors via MySensors. However MySensors just works fine, but I always get old Data from the 18S20 Sensors using onewire and DallasTemperature libs.
I Transmit and get the temps in the following manner
TempSns.requestTemperatures(); gw.wait(750); for (i=0; i<j; i++) { uint8_t Adr[8]; temperature = TempSns.getTempCByIndex(i); Serial.println(temperature); gw.send(TempVals[i]->set(temperature,1)); }
However when I use a lighter to heaten up the Temperature Sensor I first get the old value. I have to request a second sample to get the "real value".
- TempSensor is at 20°C and reports 20°C
- I'm heating up the Sensor to e.g. 60°
- I reqeust the temperature, it tells me 20°C (although it is 60)
- I request temperature again, now its 60°C
- I wait for temp on sensor to settle back at 20°C
- I request temperature it tells me 60°C (altough it is 20)
- I request temperature again, it tells me 20°C
Is anyone able to help me, please
Thanks so much
Dirk H.
-
Ok, finally I found the Problem.
I changed the prescaler value of Timer0 becuase I needed a higher PWM Frequenciy.Unfortuneatly this also affects the millis() function that is used in gw.wait.
It turns out taht with the changed TImer 0 Prescaler 1ms was not 1ms anymore but less. So the gw.wait(750) where only 750ms/64 which is not enough for DS18S20 conversion to take place.
Suggested Topics
-
Custom Interrupt routine for door sensor
Development • 11 Jan 2015, 16:27 • funksoulbrother 11 Jan 2015, 22:00 -
Simple Temp/Light/Time setup with LCD 1.4 (no beta anymore)
My Project • 13 Aug 2014, 12:00 • John 31 Aug 2014, 21:47 -
Problem with connecting several temperature sensors
Troubleshooting • 23 Dec 2014, 13:31 • Mouridsen 28 Dec 2014, 20:51 -
MAX6675
Development • 26 Nov 2014, 21:15 • Mrlynx 31 Jan 2017, 15:09 -
💬 MySensors node
OpenHardware.io • 7 Jan 2016, 14:34 • openhardware.io 18 Jan 2016, 15:27 -
💬 Temp_Hum sensors
OpenHardware.io • 2 Jan 2019, 08:41 • openhardware.io 2 Jan 2019, 08:41 -
💬 Aeos : a NRF52 versatile, up to 9in1, device
OpenHardware.io • 28 Jun 2017, 22:24 • openhardware.io 13 Apr 2020, 14:05 -
💬 Sensebender Micro mk2
OpenHardware.io • 16 Nov 2016, 22:30 • openhardware.io 10 Jul 2018, 19:37