DS18B20 Temperature Sensors and Arduino
Tuesday, April 28th, 2009Spent the day working with DS18B20 temperature sensors and getting an Arduino to read the data they spit out. Lucky for me and you, we have the shoulders of giants to stand upon as we copy and paste some magical code to get us started!
DS18B20 Temperature Sensors + Arduino from Morgellon on Vimeo.
The DS18B20 is a small 3 pin temperature sensor that closely resembles a transistor. Each one has a “unique” 64bit serial code and can communicate over a “1 Wire” protocol. With a bit of code, we can have multiple temperature sensors all communicating and sending data over just one pin!
I’ve taken some pictures of my project today. I have three DS18B20 all communicating over pin 10 on an Arduino.
- DS18B20 Temperature Sensor and Arduino
- DS18B20 Temperature Sensor and Arduino
- DS18B20 Temperature Sensors and Arduino
- DS18B20 Temperature Sensors and Arduino
- DS18B20 Temperature Sensors
- “Screen Shot”
The first, or closest to the Arduino, is wired in “Normal” or “Master” mode.
- GND(pin1) to Arduino GND
- DQ(pin2) to Arduino Pin 10
- VDD(pin3) to Arduino 5V
- a 4.7K Resistor between DQ(pin2) and VDD(pin3)
The last two, or middle and furthest away from the Arduino are wired in “Parasitic” or “Slave” mode. These two require no power (as their name sake implies).
- GND(pin1) and VDD(pin3) to Arduino GND
- DQ(pin2) to Arduino Pin 10
The bit of sample code scans through the DS18B20 64bit serial codes until it finds no more unique codes. It displays the information in HEX, followed by Celsius, then Fahrenheit of each sensor before moving to the next.
Download the code used in the example here: http://serverwillprovide.com/icuubi/examples/multiDS18B20.pde
Read more about the DS18B20 Temperature Sensors and the Arduino!






