Author Topic: DS18B20 temp sensor addressing issue  (Read 3488 times)

0 Members and 1 Guest are viewing this topic.

Offline SeekonkTopic starter

  • Super Contributor
  • ***
  • Posts: 2152
  • Country: us
DS18B20 temp sensor addressing issue
« on: December 15, 2014, 02:44:44 pm »
I've just started working with the DS18B20 temp sensor.  One of the good things is the addressing, it is also the bad thing.  Entering addresses is fine for a hobby project, entering addresses in a production environment is not.   And then there is that sensor that has to be replaced in the field.  My project would only have four sensors so I could devote a pin to each one.  There are lots of addressable things out there so there must be a plug and play method out there and I'm just having a brain cloud.  There must be a method to put sensors in a string and have a first come first served, RC on power buss?  Is this a case where 90% of the code will be devoted to sensor selection?  Looking for a clue.
 

Offline DmitryL

  • Regular Contributor
  • *
  • Posts: 245
  • Country: gb
Re: DS18B20 temp sensor addressing issue
« Reply #1 on: December 15, 2014, 03:42:59 pm »
I've just started working with the DS18B20 temp sensor.  One of the good things is the addressing, it is also the bad thing.  Entering addresses is fine for a hobby project, entering addresses in a production environment is not.   And then there is that sensor that has to be replaced in the field.  My project would only have four sensors so I could devote a pin to each one.  There are lots of addressable things out there so there must be a plug and play method out there and I'm just having a brain cloud.  There must be a method to put sensors in a string and have a first come first served, RC on power buss?  Is this a case where 90% of the code will be devoted to sensor selection?  Looking for a clue.

Am I missing something here ?
http://www.maximintegrated.com/en/app-notes/index.mvp/id/187

On the other hand... Ok, you put all your sensors on the same 1-wire bus and using search algorithm find that they have UIDs N1, N2, N3, N4. Then how do you tell which UID  has  the _physical_ sensor chip you are looking at, even if you know that it is one of N1, N2, N3 or N4  ? :)
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3671
  • Country: gb
Re: DS18B20 temp sensor addressing issue
« Reply #2 on: December 15, 2014, 07:07:41 pm »
I went through this a few years ago.  The solution I implemented was a semi-automated sensor selection.  At power on the firmware checked an EEPROM for the existence of (checksummed) sensor addresses. If the checksum failed (i.e. new unit or corrupted EEPROM) it went into set up mode.

First it ran the discovery algorithm and checked for the presence of the required number of sensors. It then worked though each address and via the display instructed the user to warm the sensor whilst polling the temperature of all the sensors.  The one with the increasing temperature is assigned the appropriate sensor ID, saved to EEPROM with checksum and then the firmware moved onto the next address.

Might not be very useful for production purposes though.  Would it be possible to fit one sensor at a time and power up the module after each one has been fitted so it can discover the address of the next sensor in the sequence?
 

Offline LabSpokane

  • Super Contributor
  • ***
  • Posts: 1899
  • Country: us
Re: DS18B20 temp sensor addressing issue
« Reply #3 on: December 16, 2014, 05:03:06 am »
Another option is to try mikerj's discovery scheme but with hot plugging the sensors into the bus. As long as one builds in some protection to the bus with TVSS devices or such, I don't think there is much hazard in this. I've hot plugged my DS18B20s and been able to incrementally discover them.

 

Offline SeekonkTopic starter

  • Super Contributor
  • ***
  • Posts: 2152
  • Country: us
Re: DS18B20 temp sensor addressing issue
« Reply #4 on: December 16, 2014, 09:36:52 am »
In all their great wisdom, this was likely designed for a market I don't fully understand.  It does seem like an obvious problem for production.  It would be nice to set a bit to use an address supplied by the customer into the scratchpad.    A simple test jig would allow programming the sensor to be #15.  That seems more useful than the high temperature limit.  Isn't that what the micro is supposed to do?  You could put a pseudo address in the high temp, then have the micro find all the sensors and assign a location based on that. 
 

Offline Kjelt

  • Super Contributor
  • ***
  • Posts: 6736
  • Country: nl
Re: DS18B20 temp sensor addressing issue
« Reply #5 on: December 16, 2014, 09:43:00 am »
Yeah the one wire multiple device protocol is not very friendly. As long as the number of sensors is limited < 10 why not use a GPIO per device. Much easier.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->