Wiltshire, UK
Offline
Newbie
Karma: 0
Posts: 44
Arduino rocks
|
 |
« on: February 04, 2011, 04:03:20 pm » |
Hi All
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...
1. 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.
2. Assuming I'm fine on the above point, is a shift reg the best/simplest way to go?
Thanks
Olly
|
|
|
|
|
Logged
|
|
|
|
|
Oxford, UK
Offline
Newbie
Karma: 0
Posts: 41
Arduino rocks
|
 |
« Reply #1 on: February 05, 2011, 10:46:43 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Wiltshire, UK
Offline
Newbie
Karma: 0
Posts: 44
Arduino rocks
|
 |
« Reply #2 on: February 05, 2011, 12:20:06 pm » |
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.
Cheers
Olly
|
|
|
|
|
Logged
|
|
|
|
|
Netherlands
Offline
Tesla Member
Karma: 91
Posts: 9441
In theory there is no difference between theory and practice, however in practice there are many...
|
 |
« Reply #3 on: February 05, 2011, 02:11:52 pm » |
Interesting problem:
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.
pseudocode:
setshift(bathroom); // make only the bathroom pin high. startConvert(); Cbath = getTempC(); .... setShift(living); startConvert(); Cliving = getTempC(); .... etc
probably making a function that does it all
float readRoomTemp(int Room) { SetShift(2^Room); startConvert(); return getTempC(); }
Is this an option?
Rob
|
|
|
|
|
Logged
|
|
|
|
|
Wiltshire, UK
Offline
Newbie
Karma: 0
Posts: 44
Arduino rocks
|
 |
« Reply #4 on: February 05, 2011, 05:41:56 pm » |
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.
Cheers
Olly
|
|
|
|
|
Logged
|
|
|
|
|
Netherlands
Offline
Sr. Member
Karma: 2
Posts: 433
A naughty mind is a joy forever.
|
 |
« Reply #5 on: February 12, 2011, 06:47:13 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Central MN, USA
Offline
Faraday Member
Karma: 35
Posts: 5941
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
|
 |
« Reply #6 on: February 12, 2011, 10:15:11 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Cumming, Ga
Offline
Edison Member
Karma: 12
Posts: 1389
Ultimate DIY: Arduino
|
 |
« Reply #7 on: February 12, 2011, 11:42:33 am » |
There already are 1 wire chips designed to "switch" the 1-wire bus. DS2409 MicroLAN Coupler does what you describe
|
|
|
|
|
Logged
|
|
|
|
|
Netherlands
Offline
Tesla Member
Karma: 91
Posts: 9441
In theory there is no difference between theory and practice, however in practice there are many...
|
 |
« Reply #8 on: February 12, 2011, 03:09:26 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
North Germany
Offline
Newbie
Karma: 0
Posts: 6
Abacom Board user.
|
 |
« Reply #9 on: February 15, 2011, 05:03:16 pm » |
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)
|
|
|
|
|
Logged
|
Chips: Atmega 168 / Atiny 2313 SPI+I2C Port expander (MCP23S17+MCP23016) 1-Wire Temperature sensor (DS18S20) RFID reader DCF-77 receiver 3 Phase Powermeter Dozens of relais Next thing: Access to wireless light/plugs on 433mhz Questions to anything? Just msg me Ger/Eng
|
|
|
|
|