DS18B20

Hello folks,

I have been trying to setup a small temperature probe beacon for my garden. I have been using the Adafruit HUZZAH ESP8266 Breakout packages with an FTDI cable to write code using the ArduinoIDE.

For the temperature sensing, I purchased some DS18B20 sensors that are encased in a waterproof housing. The sensor is broken-out into 3 leads (power, ground, data). I was able to wire the sensor into my breadboard successfully, and, using the example sketch online, I was able to read the temperature from the sensor successfully from my Arduino Uno.

Then I moved onto recompiling and uploading the firmware to the ESP8266. The code compiles without a problem and uploads, when paired with a WiFi client, the connection is made unhindered.

[u]The problem I'm having is that the ESP8266 is always reading 262.29 for the temperature (I assume logic high), regardless of which pin I try to move it to and replicated on both ESPs I have.[/u]

I checked to make sure that there were no touching wires and that the circuit was proper. I uploaded the same sketch to an extra Arduino Mega 2560 I had laying around and connected a switch to the data line so I could toggle both devices.

Watching both serial outputs, it is clear that the Mega handles the input from the sensor properly and the ESPs do not. I would really love to get this solved so I can move into board prototyping.

If there are any gurus out there who know what I should test or what the heck I'm missing, please help a brother out!

Thank you for your time and attention, Neurax

Sounds very close to what I am going to do soon, however, I have not put any hardware together yet, so I can't experiment. My first guess would be a timing issue though - the 8266 has a much faster clock than the Arduino and if you don't have it set up right, the delays are wrong. It would be handy if you could look at the signal with a scope to check the timing, but timing would be my first guess (probably too fast).

I was able to figure out a solution and wanted to share for anyone looking to implement in the future.

The problem was the amount of current coming from the data lines of the ESP8266. The DS18B20 has 2 power modes, normal and parasitic, where the voltage pin is shorted to ground and the IC receives power from the data line. If the Host device cannot supply enough current over the data line, the IC sketchpad will deliver deliver erratic results.

The solution in this case was to revert to normal power mode. I connected the IC's Vcc line to my 5V bus, grounded the GND line, and left the 4.7kOhm resistor as a pullup for the data line. This was just the change necessary to get actual readings from the temp sensor.

Another user on a different forum had recommended that a potential solution might be to add delay between sensor reads and to use a small pullup resistor. I haven't tested either of those solutions.

The parasitic power mode is, to my mind, a bit of a hack to save one wire, I'd avoid using it unless you have to, the three-wire mode is simply more robust, and you can properly decouple the supply at each sensor.

I didn't pick up on the fact you were trying to use the parasitic power - when I read the "power, ground and data" part, my mind promptly connected them that way (which is how I intend to use them). I agree with MarkT on the parasitic issue - if you search on it, you find more people trying to solve it than actually using it it seems. The KISS principal here is better.

My suspicion is that its a lot more sensitive to noise and interference so you should use coax if you do use it.