Go Down

Topic: 1 wire temp sensor (Read 669 times) previous topic - next topic

Packhorse

I have a project that will ultimately have 5 ( or more) DS18b20  sensors on each of 2 pins.

The issue is that these 5 sensors may change from time to time. eg I will have 3 sensor arrays (A,B and C) and any one of these may be on pin0 while one other may be on pin1 while the third will not be in use.

What I would like to do is have the sketch read the address of the sensors in each sensor array then use "RequestTemperaturebyAddress" as opposed to "RequestTemperatureByIndex"

I have read the "One Wire Address Finder Sketch" but I cant figure out how to read an address, store the address then read from it later.

Can anyone help?




wildbill

discoverOneWireDevices populates the addr variable with each address in turn. Use memcpy in the while loop to copy those addresses to a global array of addresses.

This is problematic though because if you have multiple devices on a bus, you can find the addresses of each of them, but you will have no idea which is which. If they're all doing the same job, perhaps that doesn't matter, but if you're hoping to monitor kitchen temp, basement temp, attic temp, you have a problem.

Suriken

You can test them before plug them in final version so you have all addresses and can set: X addr is kitchen, Y is bathroom.... Save that values in eeprom and check them any time arduino reset or power off-on

I guess, address are always the same, aren't them?

robtillaart

Quote
I guess, address are always the same, aren't them?

yes!

There are two strategies, (1) is hard-coding them by there internal address or (2) use one digitalpin per sensor (OK you can use a multiplexer tricks too)

If you have pins to spare (2) is the easiest option imho
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Packhorse

I found this page that shows a sketch that does what I wanted.

Thanks for you help guys.

I will of course need to put the sensors in order from lowest address to highest ( or do that via code) but that is not an issue.

http://www.vwlowen.co.uk/arduino/ds18b20/ds18b20.htm

Go Up