DS18B20 Temperature Sensors and Arduino

Spent 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.

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!

8 Comments zu “DS18B20 Temperature Sensors and Arduino”

  1. noms

    Link to the code is broken :( Oh well, gotta make my own then :D



  2. swherdman

    Can you provide a copy of the code? site linked to doesnt appear to exist anymore

    nslookup serverwillprovide.com 8.8.8.8
    Server: google-public-dns-a.google.com
    Address: 8.8.8.8

    *** google-public-dns-a.google.com can’t find serverwillprovide.com: Non-existen
    t domain

    nslookup http://www.serverwillprovide.com 8.8.8.8
    Server: google-public-dns-a.google.com
    Address: 8.8.8.8

    *** google-public-dns-a.google.com can’t find http://www.serverwillprovide.com: Non-exi
    stent domain



  3. Toni Lähdekorpi

    The link for the example code doesn’t work.
    Could you upload or email it to me?



  4. Jennifer

    I am trying to download the code:
    http://serverwillprovide.com/icuubi/examples/multiDS18B20.pde

    However, the link is broken. Would you mind sending me the code to kmng@buffalo.edu?

    Thanks.



  5. John Doe

    Your code is down please update the link.



  6. mark

    Any chance of post the code? the link is down.
    thanks



  7. Puntz

    Hey, it seams the source code link is down and I really could use a hand with this.

    Would you please email it to me or fix the link?

    Thanks a bunch! :D



  8. Impossible

    Could we get the example uploaded again?

    the serverwillprovide.com url doesnt work :(



Leave a Reply