jump to navigation

deviceIndex — OneWire Library (DS18B20) September 15, 2011

Posted by rik94566 in 1-wire, aquaponic automation, aquaponics, arduino, CEA, Controlled Environment Agriculture, DIY aquaponics, DS18B20, indoor aquaponics, indoor gardens, indoor growing, One-wire, sensor, Sensor Hub, Stainless Steel Temp Probe, Temperature Probe.
Tags: , , , , , , , , , , , , , , , , , ,

Miles Burton developed the OneWire Library for use with DS18B20 IC’s.



From what I can tell, a major function in OneWire library is the  “deviceIndex” .  It looks to me that the “deviceIndex” sorts out which IC or in this case which probe get read and when.  I have researched the “deviceIndex” on the internet to gain a better understanding of how it works.  Well, bad news is that I could not find any information on it other than what comes in the sketch the Miles provides on his wiki page for Dallas Temperature Control Library.

It looks like to me that once the sketch starts up each probes HEX code (specific to each probe) gets read and assigned to a device number.  When I added probes starting with PROBE-007 working up through PROBE-011 the device numbers were assigned to each new probe as I added them. Such as —  DEVICE 0 – PROBE-007, then DEVICE 1 – PROBE-008 and so on……   This is all well and good until I made a few minor changes in the sketch and restarted the arduino.  When all the probes were connected no longer would the probe numbers match the device numbers.  I would have PROBE-007 reading from device2 or maybe even 3.

Device numbers get mixed up with PROBE assignments

I think that for simple situations where you can live with random assignments of device numbers to probes this type sketch design might work.  I am looking for each probe to be read consistently each and every time so I can know that the temp reading from the fish tank is always the reading from the fish tank.  Important stuff to me and my fish.  So this is another reason that I had to find a better way when it came to reading my temp probes.



1. deviceIndex — OneWire Library (DS18B20) « Aquaponic DIY … | Free Aquaponics Tips - September 15, 2011

[…] indoor gardens, indoor growing, One-wire, sensor, Sensor … … Read this article: deviceIndex — OneWire Library (DS18B20) « Aquaponic DIY … ← Aquaponic Gardening — City Farmer News Aquaponics: Growing Your Own Vegetables Easily […]

terry king - September 16, 2011

Hi Rik,

i think the time may have come when you will have to handle the device hex IDs yourself. The library is great in simplifying that whole detailled area of knowing the device internal serial number IDs, but it seems he did not anticipate that someone would use so many probes.. ??

Maybe you could communicate with him and see if he understands the problem and might upgrade the library.

When my shipment gets here I will try running a large number of DS18b20 at once (i have only done up to 4)..
Also, since only 1 pin is used for a group, can you make 2 groups?? I have not tried that with this library..

Regards, Terry King
…On the Mediterranean in Italy

rik94566 - September 16, 2011

Terry –

I agree with you on this one. I am moving this direction. I just ordered an additional 15 probes, because I have learned enough now to start to scale. I think I got most everything worked out now and will blog about it in small parts to help others understand how best to use these DS18B20’s. My goal is to get 10 probes working and see where the breaking points are and determine what it will take to hook them up. Not much or any work has been done and documented on the internet using more than 3 or 4 probes (DS18B20), a lot of speculation but no real work that I can find.

2. terry king - September 16, 2011

Hi again, couple of questions:

– are you using the newer ‘1-wire 2’ library suggested on burton’s site?

– Are you configured for +5v power to each probe? or are you uising “parasitic power”?

Regards, Terry King
…On the Mediterranean in Italy

rik94566 - September 16, 2011

Terry –

I am using the newer ‘1-wire 2’ library, so I am good on this one.

I am using parasitic power. So this will be one of my next options. I am getting set up run with external power using one of your 5v wall warts.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: