# Compatibility issue with Temperature sensor between Photon and Electron

**URL:** https://community.particle.io/t/compatibility-issue-with-temperature-sensor-between-photon-and-electron/42687
**Category:** Troubleshooting
**Created:** [June 25, 2018, 7:53pm UTC](https://community.particle.io/t/compatibility-issue-with-temperature-sensor-between-photon-and-electron/42687 "2018-06-25T19:53:42Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![TrikkStar](https://avatars.discourse-cdn.com/v4/letter/t/85f322/32.png) [@TrikkStar](https://community.particle.io/u/TrikkStar)
#### Post date: [June 25, 2018, 7:53pm UTC](https://community.particle.io/t/compatibility-issue-with-temperature-sensor-between-photon-and-electron/42687/1 "2018-06-25T19:53:42Z")

</div>

I’m trying to run an application I originally wrote for the Electron on a Photon and am not quite sure where I’m going wrong. My application is simply trying to read the temperature off a [probe](https://www.digikey.com/product-detail/en/sparkfun-electronics/SEN-11050/1568-1228-ND/5721423) and spit the results into the serial output. The code/wiring works fine on the Electron but not on the Photon(1kΩ pull-up between VCC and the OneWire Bus, tried different resistances but still encountering the same problem)

The issue occurring is that the Photon configuration only intermittently(\<25%) recognizes a probe on the bus, but it works fine when running on the electron. I’ve tried switching probes around and trying different devices but I’m kinda stuck as to what’s going on, aside from some hardware difference between the Electron and Photon that I may have missed.

[Link of the code I’m running.](https://go.particle.io/shared_apps/5b3147a00ae16841fe000378)

---

<div class="post-metadata">

### Author: ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)
#### Post date: [June 25, 2018, 8:32pm UTC](https://community.particle.io/t/compatibility-issue-with-temperature-sensor-between-photon-and-electron/42687/2 "2018-06-25T20:32:04Z")

</div>

I haven’t looked at your code yet, but one difference between Electron and Photon that might impact your readings is the execution speed of the background task between iterations of `loop()` on single-threaded mode (i.e. _not_ using `SYSTEM_THREAD(ENABLED)`).

While the cellular connection only allows `loop()` to run aproximately 100 times per second, on the Photon it’s called about 1000 times.  
If the probe can’t keep up with the faster reading speed, that could impact the outcome.

* * *

Update:  
On first glance at your code, I see you are using `spark-dallas-temperature` library which isn’t that well maintained by the original contributor.  
Can you try the [DS18B20 library](https://build.particle.io/libs/DS18B20/0.1.8/tab/example/ds18b20_SingleDrop.ino) instead? (I know this library is maintained and has currently no open issues in the GitHub repo 😉 )

BTW, how many sensors are you actually reading?

---

<div class="post-metadata">

### Author: ![TrikkStar](https://avatars.discourse-cdn.com/v4/letter/t/85f322/32.png) [@TrikkStar](https://community.particle.io/u/TrikkStar)
#### Post date: [June 25, 2018, 9:05pm UTC](https://community.particle.io/t/compatibility-issue-with-temperature-sensor-between-photon-and-electron/42687/3 "2018-06-25T21:05:45Z")

</div>

Looks like adding SYSTEM\_THREAD(ENABLED) was all I needed to do. My probes are recognized consistently by the Photons now, still need to test the Electron’s though.

I’m currently only reading one device but my goal for the code was to be able to read an arbitrary number of sensors connected to the bus.

Thanks for the recommendation on the alternative library, I’ll be sure to check it out.
