Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Hardware
  3. 1W Temperature Sensor 18s20 shows old values

1W Temperature Sensor 18s20 shows old values

Scheduled Pinned Locked Moved Hardware
temperature
2 Posts 1 Posters 1.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dirk_H
    Contest Winner
    wrote on last edited by
    #1

    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".

    1. TempSensor is at 20°C and reports 20°C
    2. I'm heating up the Sensor to e.g. 60°
    3. I reqeust the temperature, it tells me 20°C (although it is 60)
    4. I request temperature again, now its 60°C
    5. I wait for temp on sensor to settle back at 20°C
    6. I request temperature it tells me 60°C (altough it is 20)
    7. I request temperature again, it tells me 20°C

    Is anyone able to help me, please
    Thanks so much
    Dirk H.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      Dirk_H
      Contest Winner
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      22

      Online

      12.0k

      Users

      11.2k

      Topics

      113.4k

      Posts


      Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • MySensors
      • OpenHardware.io
      • Categories
      • Recent
      • Tags
      • Popular