DS18B20 Temperature Sensor Help!!

Dear Friends, I am in the process of getting my Ardunio to control my REEF tanks (have 2)..

Thought of adding three temperatures Ds18B20 to measure the 2 tank temperature and 1 ambient temperature.

I am unable to locate any code that locates a particular DS18B20 (say, my First tank) get that temperature, then onto my second and then onto the Ambient. If i put this in a loop, as done by many using parasitic mode, (750ms Delay) there is no format as to which temperature comes first,second and third. there seems to be variation, sometimes the order is 1,2,3.. next it is 1,3,2... and so on.. so i am unable to determine which temperature is from which probe.

So, would like to know whether is there anyway i can get the 16bit address, store it and access the DS18b20 using this address so that every time i access the correct sensor that i am looking for?

kindly help.

regards Peri

I am very new in arduino, so probably i will not help to you so much.

However, as far i know, it could be related to the serial number of each sensor, that is unique for each one.

Here you have a code that read the code of each ds18b20, in that way you could know "who is who" independantly to wich number is asigned by arduino (1,2,3 or 1,3,2, or whatever as you said). Here s the first link:http://www.sherkhan.net/blogs/frikadas/?p=178 It is in spanish, but the code is very pristine.

Here is other code that read the serial number of each sensor that you should run firstly to know "who is who" in your chain of sensors. Moreover, there is a second code that call one by one to each sensor using their serial number, so it is a "personal call" to each sensor to know it temperature reading. You only need to run the first code ones, meanwhile the second code is "forever" if you donĀ“t change the location of each sensor or the sensor itself. Here is the second link:http://tutorialpedia.org/tutorials/Working+with+Dallas+DS18S20+and+DS18B20+temperature+sensors+from+Arduino.html This one is in english and also very clear code.

I hope it could be useful to you, but i am sure that there are a lot of experts in this forum that probably could help more.

Cheers,

As madepablo says, once you get the readings coming from the sensors, the order is governed by their serial number, so unless you physically reorder or add new sensors to the chain they'll always appear in the same order.

thanks a ton.. will try it out immediately...

You might want to take a look at this link. http://docmorbius.net/arduino/libraries.html

It points to a library which pretty much does what you need. It currently has code to read and process temperatures from DS18S20 sensors, not the DS18B20, but the search and device management part may be useful, and changing it to get the data from the 18B20 should be relatively easy

Here you have a code that read the code of each ds18b20, in that way you could know "who is who" independantly to wich number is asigned by arduino (1,2,3 or 1,3,2, or whatever as you said). Here s the first link:http://www.sherkhan.net/blogs/frikadas/?p=178 It is in spanish, but the code is very pristine.

You should know that the linked code is actually incorrect. He merely divides the 12 bit return value by 16, without checking the sign bit. You'll get crazy numbers when the temp is below 0 degC. Check out the OneWire library and sample code for dealing with DS18X20 family of temperature sensors:

http://www.arduino.cc/playground/Learning/OneWire

That code properly handles the return value from your sensor. :)

Cheers!

thanks all.. it worked brilliantly...

MrRoot - yes, his code was wrong.. had to do some modifications as indicated in onewire library. and also the circuit was wrong, the pin 3, is to be grounded whereas he has indicated as just "Hanging"...

DocMorbious - the website seems to be having no data!!...

Thanks MrRobot,

I only saw the webpage, but i never tried it..., so thanks for inform that the code is wrong...