I have a DS18B20 connected to a photon. I am using a three-wire configuration with power to 3v3, ground to ground and data to D4. I have a 4.7K resistor between 3v3 and D4. This photon is powered 24x7 so I am not using any sleep or power saving modes in my code.
I am using the code (with some modification) from the Particle.io site for doing temperature:
So I am seeing consistent readings for a while and then a spike to 188 degrees F (or similar very high temperature) for (what seems like) no reason. I have tried three different DS18B20 sensors and get the same results each time. Everything is going great, then a big spike.
The Photon is running 0.8.0-rc.11 and is powered off a 2.1A USB adaptor.
I shared the code above. Any ideas as where to look would be great.
I usually get spikes when using DS18B20 too, although they are usually negative and consistent. I just have the photon ignore any spike values and use the previous reading.
For me the spike was always -196.6 so I made it reject any readings less than -190. For your code you could have it reject readings greater than 180 for example.
Thanks! I’ll work on that. So these spikes are just the DS18B20 when paired to the Photon? I don’t see these spikes using an Arduino with the same sensor.
I am looking at my Arduino code and I am using the Dallas library. Unfortunately that does not seem to be available as a working version within the WebIDE for Particle. I guess I will try a different IDE.
If you don’t mind me asking, waht IDE do you use for your Particle boards?
There is some bug according to the forum here. When you try to compile it calls …/OneWire/OneWire as opposed to just OneWire.
So you cannot do it on the WebIDE since you cannot modify the library.
That is why I was asking what you were using as your IDE. I use the Arduino IDE for everything related to the the boards and PyCharm for all of my Python stuff.
I guess I have to download their desktop IDE to be able to manage my own libraries…
lib/spark-dallas-temperature/spark-dallas-temperature.h:27:36: ../OneWire/OneWire.h: No such file or directory
YEah, I am trying the Particle workbench plugin for Visual Studio Code right now, never used VSC before so not sure how much (if at all) I will like it.
I thought the WebIDE was pretty cool until I hit that Library snag.
I might give that a try as well and see how well it works. According to the Particle.io website they are going to stop using that and go with Visual Studio Code so I downloaded it and I am playing around with it. Seems to run pretty good under Linux for a M$ product…