I'm embarking on a project where I have a central unit with sockets where you can plug in DS18B20 sensors. Obviously the 1-wire search will let me know how many I have attached, but I want to know the port number that each one is plugged into. It seems the best way to do this would be to supply power to each port individually on boot, and check what addresses are on each port. I've been trying to think of a way to do this, and it seems that a shift reg which powers each port individually during boot and then all together during operation would be the best way to go. So 2 questions really...
Will the DS18B20 chips that are not powered definitely not respond to the 1-wire search? My concern is that they may "try" to power by parasitic power on the data bus, but from the datasheet I don't think this will happen. Wanted to check though.
Assuming I'm fine on the above point, is a shift reg the best/simplest way to go?
I’m not really clear on your hardware set-up but can’t you plug each sensor into a port, run the one wire sample sketch and get the address of the sensor on that port? You communicate with the devices on the bus by their address rather than any position on the bus.
Hi, thanks for the response.
My intention is that the end user of this device wouldn’t know anything about the underlying hardware or addresses. All they would know is that the sensor in port 1 leads to their living room (for example). So when viewing the data, via a webpage probably, the user will be going on port number. That’s why I need a mapping of hardware addresses to ports on the device when the system boots, so that when readings are taken going forwards, they can be associated to the port and therefore the location of the sensor.
If I understand your idea correctly the shift register is used to select only one DS18B20 to get its number. Then why not using this same shift register to get the temperature of the right sensor every time. You can skip the whole internal DS number administration, but it depends a bit on how fast things must go and the resolution needed. If you need one reading per minute it should work.
setshift(bathroom); // make only the bathroom pin high.
Cbath = getTempC();
Cliving = getTempC();
probably making a function that does it all
float readRoomTemp(int Room)
Is this an option?
Nice idea Rob, thanks for that! Certainly the resolution won't need to be any higher than once perminute, so it's definitely an option to consider.
I'm curious and have no experience...
Would it be possible to use one or more analog de-/multiplexers like the CD4067 in combination with 1-wire?
One would give you the possibility to check a 16-room house and the next layer (if possible) a 256-room castle.
How much current is the sensor rated at? My typical shift register can do maximal 20mA on its output. Make sure the device won't need more than what the shift register can supply.
There already are 1 wire chips designed to "switch" the 1-wire bus. DS2409 MicroLAN Coupler does what you describe
just checked - http://datasheets.maxim-ic.com/en/ds/DS2409.pdf - and it states "not recommended for new design" over it.
But still an interesting option.
the sensor only needs about 1mA while measuring. You could check the "device parasitic power" flag wether it is directly powered or not
I think the multiplexer will be the best job since the other sensors are completly ignored. The only 'problem' is that you can't use parasitic power (the sensor needs about 600-800ms for the first measurement)
Im wondering, if I use input shift register, will i be able to switch between output of the sensors(after a buffer of data)? rather than turning on each sensor one after another. i have to use 10 temperature sensors for a project.