I’ve been playing with Arduino boards in my limited spare time over the past few months.  It’s a fun way to spend quality hands-on geek time that is clearly distinct (at least to me) from my day job.  Plus, I’m able to start actually instantiating some of the ubiquitious computing / distributed sensor ideas that have been floating around in my head.

I’ve been working on a simple wireless light, temp, and motion sensor.  Light was a trivial CDS photocell connected to the analog port of the arduino.  My first attempt at temp is using the Dallas Semiconductor DS-18B20 digital one-wire sensor, which is pretty slick for $4.25.

There was some good sample code on the main arduino site, but I spent a small bit of time to flesh it out more completely, adding the ability to configure sensor resolution and extracting the temp value from the returned data.  Code is here, if this is interesting or useful to you.

  4 Responses to “temperature sensing from arduino”

  1. Yeah, this is going to be endlessly useful to me. I have many ideas of what you’re talking about. =)

  2. Hi, trying to get this working myself with either Max/MSP or Processing. Think I’m missing something basic. Could use some help. Could you e-mail me if possible? I promise not to take up too much of your time. Thanks.

  3. Was very glad to see that you had implemented a translation of the two’s complement temperature into something human readable. It looks, though like the interpretation of the resolution is backwards? With bits 5 and 6 set the device should is full resolution, so the resolution floor should be lowest (rather than highest). I could be reading something wrong, though.

  4. Hi Casey -

    You’re completely right — thanks for the close eye! I had the logic around resolution_floor carelessly backward, and obviously wasn’t really paying attention to the less significant parts of the readings while testing.

    This seems to take care of it (already applied to the file linked above):

    @@ -172,15 +172,15 @@
    if ((data[CONFIG_REG] & (1 0) {
    if ((data[CONFIG_REG] & (1 0) { // bits 6 and 5 are set
    - resolution_floor = 3;
    + resolution_floor = 0;
    } else { // bit 6 is set, 5 is clear
    - resolution_floor = 2;
    + resolution_floor = 1;
    } else {
    if ((data[CONFIG_REG] & (1 0) { // bits 6 is clear, 5 is set
    - resolution_floor = 1;
    + resolution_floor = 2;
    } else { // bit 6 and 5 are clear
    - resolution_floor = 0;
    + resolution_floor = 3;

    thanks again,

 Leave a Reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Spam Protection by WP-SpamFree

© 2011 Joshua Heling Suffusion theme by Sayontan Sinha