# I need advice on Debugging Node for Temperature Sensor Project

**URL:** <https://forum.xod.io/t/i-need-advice-on-debugging-node-for-temperature-sensor-project/6894>\
**Category:** XOD Programming Questions\
**Created:** [June 18, 2024, 5:22am UTC](https://forum.xod.io/t/i-need-advice-on-debugging-node-for-temperature-sensor-project/6894 "2024-06-18T05:22:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mini90](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/mini90/32/3930_2.png) [@mini90](https://forum.xod.io/u/mini90)\
**Post date:** [June 18, 2024, 5:22am UTC](https://forum.xod.io/t/i-need-advice-on-debugging-node-for-temperature-sensor-project/6894/1 "2024-06-18T05:22:53Z")

</div>

Hi guys! 🥰

I am working on a project where I need to interface a DS18B20 temperature sensor with an Arduino using XOD. I’ve followed a few tutorials and have managed to get some basic readings, but I am facing issue where the readings sometimes spike to unrealistic values (e.g., -127°C).

Here are the steps I’ve taken so far:

- Connected the DS18B20 to the Arduino with the appropriate pull-up resistor on the data line.
- Used the XOD DS18B20 node to read the temperature values.
- Added a watch node to monitor the readings in real-time.
- Despite these steps, I still get occasional incorrect readings. I suspect it might be a problem with my wiring or perhaps a glitch in the code. Has anyone else experienced similar issues? If so, how did you resolve them? Any advice on debugging techniques or code adjustments in XOD would be greatly appreciated.  
I also check this : [https://forum.xod.io/t/temperature-sensor-am2302-dht22-not-workin](https://forum.xod.io/t/temperature-sensor-am2302-dht22-not-working/980)[gcp](https://www.igmguru.com/cloud-computing/gcp-certification-training/) But I have not found any solution.

Thanks! 😇

---

<div class="post-metadata">

**Author:** ![gweimer](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@gweimer](https://forum.xod.io/u/gweimer)\
**Post date:** [June 18, 2024, 1:59pm UTC](https://forum.xod.io/t/i-need-advice-on-debugging-node-for-temperature-sensor-project/6894/2 "2024-06-18T13:59:30Z")

</div>

Reading through the code for the XOD node, it requires very precise timing. My guess would be that Arduino board gets busy doing something else & that timing gets messed up occasionally. The odds of that happening would increase as you add more timers (like delay nodes, PWM pins, servos, etc.) that generate interrupts.

Do you usually only see one bad reading, then return to normal? You could use average temperature, but that would still be thrown off by these drastically different values. You could write wrapper code that ignores values that are too far from previous value. This will require adding a buffer node to remember the previous value, and NOT updating it if new value too drastic a change from previous value. This requires setting initial value on boot (and hoping that 1st value isn’t a bad one…)

---

<div class="post-metadata">

**Author:** ![helen](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/helen/32/3933_2.png) [@helen](https://forum.xod.io/u/helen)\
**Post date:** [July 1, 2024, 6:06am UTC](https://forum.xod.io/t/i-need-advice-on-debugging-node-for-temperature-sensor-project/6894/3 "2024-07-01T06:06:16Z")

</div>

Hello @mini90  
I think you should try to find the error

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/1X/eb7348baa04192c2ef932d1db54d44f09f8a7888.png) [@system](https://forum.xod.io/u/system)\
**Post date:** [July 31, 2024, 6:07am UTC](https://forum.xod.io/t/i-need-advice-on-debugging-node-for-temperature-sensor-project/6894/4 "2024-07-31T06:07:01Z")

</div>

Closed on July 31, 2024, 6:07am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
