DS18b20 Working Example?

Has anyone tried to get the max31850 chips working? I have it working on an Arduino but would like to use my photon. If nobody has worked on this, I’ll give it a try but it will take a while as I’m a little time constrained ATM.

Thanks to everyone for sharing these great resources. I was able to build two wireless thermometers with what you’ve shared. After much testing, I installed one of the thermometers. I’ve mounted the Core in a project box and mounted it to the wall, then routed the DS18b20 into our chest freezer. The Core dutifully reported the temperature down to -14C. The next report showed -127 and that’s all it has shown since. The Core reported reliable temperature readings for over a week in the house. Any ideas as to why it’s doing this in the deep freeze?

Thanks for any ideas!


My experience with these is that when you are reading -127, you are getting all 1’s back on the read and something in the connections is wrong.

Where did you put the pull-up resistor? At the Core end of the wires?

Thanks for your reply. Yes, the resistor is at the core end.

I haven’t test this after the rename to Particle, but this is my source code for sous vide with Core (am using ds18b20). You can try to drop in the libraries as is, and see if it works.

@Soemarko, your source code works great! I edited out everything I didn’t need for my purpose. The core I have monitoring my deep freezer now reports the actual temperature rather than -127.

I had done quite a bit of searching last night and ran across a thread on the arduino forums by someone that was experiencing the same issues. It does appear it has something to do with the DallasTemperature library. Using yours, everything is working great. Thank you!!



Could you share your solution?

Nearly one year later - and it seems that little progress has been made along the lines of putting together a simple working example for getting multiple DS18B20s to work with the Photon.

I published a lib that works, its not as clean as using the onewire lib though, but it works :slight_smile:

Hi everyone,

I’ve been trying a lot of the examples from this thread, but nothing is working. Given that all of these examples are years old, can anyone share working code (bonus points for step-by-step and/or the actual concepts behind getting this to work) utilizing the latest libraries available via Particle Build? I am working on OSX, and am pretty lost overall.


Hi Kenny, I’ve used two of them in this project, maybe you’d like to take a look?

Thanks @gusgonnet! This is definitely pointing me in the right direction, as I am planning to use multiple sensors and a relay as well. It’s not compiling for me, but will see what I can do.

1 Like

sorry to hear that. Make sure you add the libraries included on top of the ino via the BUILD IDE, if you are using it:

#include "Particle-OneWire.h"
#include "DS18B20.h"
#include "NCD4Relay.h"

#include "elapsedMillis.h"
#include "FiniteStateMachine.h"

It could be that the oneWire lib will be added by the DS18b20, according to Libs 2.0.
good luck!

@gusgonnet Thanks again. The double import re: OneWire was the culprit.

I’m now able to log the temp read events to the Particle console, but the value(s) are not updating, so will need to double check my connections.

Very helpful code!


I’m back with a new problem! Code seems to be working, but I am only getting a read value of -1 in the Particle console.

The code is currently set up for 2 sensors, 1 of which I’m just not using until I get the other one working. The unused pin continuously reads 32F/0C.

The serial monitor is consistently displaying a 0 (unused pin, I’m assuming), and a “CRC Failed” message, which should be the -1 value in the Particle console.

Here is a pic of my current wiring in case that might be the problem. Thanks all!

A bit late, but the pull-up resistor looks like Y-V-gold-gold which is 4.7 ohm.
Pullup should be between 1-10 Kohm.