Arduino icon indicating copy to clipboard operation
Arduino copied to clipboard

help with multiple DS18B20 bus position

Open grahamehorner opened this issue 11 years ago • 14 comments

I'm attempting identify the position on a daisy chained DS18B20 sensor in the OneWire bus; is this possible? if so how can I do this ?

grahamehorner avatar Nov 09 '15 14:11 grahamehorner

Each DS18B20 has uniq serial number. check example of lib https://github.com/milesburton/Arduino-Temperature-Control-Library or https://arduino-info.wikispaces.com/MultipleTemperatureSensorsToLCD

chaeplin avatar Nov 09 '15 15:11 chaeplin

Discovery of the physical order or "position" is a non-trivial task. Some of the newer components allow for "chaining" that you can read about here: https://www.maximintegrated.com/en/app-notes/index.mvp/id/4037

Without chaining, the normal "search" algorithm follows an address based search documented here: https://www.maximintegrated.com/en/app-notes/index.mvp/id/187

Humancell avatar Nov 09 '15 16:11 Humancell

Before soldering them in place, attach them one at a time and run something like the example sketch so you can associate the unique serial number with each sensor.

jeffryr avatar Nov 09 '15 16:11 jeffryr

@chaeplin yes I'm aware the DS18B20s have a unique identifier; but I need to know where in the daisy chain the sensor is located. @jeffryr I can't do what you suggest as the daisy chain is built by the end user, pluging together 3.5mm jack plugs together and thus the DS18B20s could change and/or be replaced; the OneWire bus is not fixed in length or which OneWire devices get attached.

@Humancell thanks for the links; I'll read up and see if I can figure out how to determine the location of the sensor in the linear chain.

grahamehorner avatar Nov 09 '15 16:11 grahamehorner

The OneWire bus is not designed to do this, the response order is linked to the unique identifier not to the order on the bus.

the easiest way is a kind of setup process for the end-user where he must say I now plug sensor 1, if he plug it in you see by scanning there is one new device. which this information you now can match the unique identifier to sensor 1. if this is repeated for every sensor on the bus you end up with a little database to match unique identifier to sensor id / position.

Links2004 avatar Nov 09 '15 17:11 Links2004

@links2004 thanks but this is not a limit of the onewire bus but the sensors connected, I have abandoned the idea of using the ds18b20 for the ds28ea00

grahamehorner avatar Nov 09 '15 18:11 grahamehorner

As I understand the ds28ea00, what you're wanting to do is possible (with an extra pair of lines for each sensor to allow the 'daisy chaining') but it will fail if any intermediate sensor is removed, because the 'chain' will be broken i.e. unplug 2 and 3 & 4 no longer have the chain information...

On 9 November 2015 at 19:51, Grahame Horner [email protected] wrote:

@links2004 https://github.com/links2004 thanks but this is not a limit of the onewire bus but the sensors connected, I have abandoned the idea of using the ds18b20 for the ds28ea00

— Reply to this email directly or view it on GitHub https://github.com/esp8266/Arduino/issues/994#issuecomment-155153470.

duncan-a avatar Nov 10 '15 00:11 duncan-a

@duncan-a this differs to my understanding; my understanding is that the OneWire bus is able to detect the position on the sensor by signal which sensors respond to in sequence; the bus still uses the same number of wires however the sensor have additional pins to allow this to operate.

https://www.maximintegrated.com/en/products/analog/sensors-and-sensor-interface/DS28EA00.html

grahamehorner avatar Nov 10 '15 10:11 grahamehorner

According to the page you have linked, DS28EA00 is using extra lines for sequence detection.

Unlike other 1-Wire thermometers, the DS28EA00 has two additional pins to implement a sequence detect function.

igrr avatar Nov 10 '15 10:11 igrr

@igrr yes the sensor has two addition pins; but the bus still only has 3 wires VCC, GN, DQ ? or am I reading this wrong ? I'll find out as I'm following reference designs to build the daisy chain.

grahamehorner avatar Nov 10 '15 10:11 grahamehorner

Check the schematic image at the page you have linked. Additional line is shown between PIOA pin of one sensor and PIOB of the next one.

igrr avatar Nov 10 '15 10:11 igrr

@igrr I have; yes I can see PIOB and PIOA; PIOA is connected to the next sensor in the chain, and I understand that; but the bus still only has three wires? no VDD is connection to the sensors (shown as dotted line) PIOB-> PIOA connection, GND and IO?

https://www.maximintegrated.com/en/app-notes/index.mvp/id/4334

grahamehorner avatar Nov 10 '15 10:11 grahamehorner

If you don't need VDD connection, then yes, this makes it just three lines.

igrr avatar Nov 11 '15 13:11 igrr

@igrr @Humancell thanks for everyone that helped; thought in I was going mad; and needed someone to verify ;)

grahamehorner avatar Nov 11 '15 14:11 grahamehorner