Interfacing multiple DS18b20 #55743
-
I am wondering how to Interface multiple ds18b20 by using the sensor API. Is there a way to Interface multiple ds18b20 in a way that lets me permanently identify them? |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 10 replies
-
any info/opinions about this? |
Beta Was this translation helpful? Give feedback.
-
Yes interfacing multiple ds18b20 is possible. And putting multiple sensors in the device tree will allow you to handle the w1 sensors like any other sensors during runtime. It is also used as an indication to the 1-wire subsystem to use a match rom command instead of the skip rom command in order to select a specific slave. However due to the fact that 1-wire slaves can only be identified via a unique rom-id, an additional setup step is required where you assign a rom-id to a device. For the ds18b20 this can be done via the sensor attribute interface.
You can use
This duty really depends on the use case and is therefore the responsibility of the application.
Yeah this would be a valid use case, and you could detect them via a search. However if such slaves don't have programmed any identifier onto them it would be hard to find out where they are connected and what they measure. |
Beta Was this translation helpful? Give feedback.
-
thanks for your answer! |
Beta Was this translation helpful? Give feedback.
-
@str4t0m I tried to understand how todo it, but I cant figure it out... I can search and get the ROMs of all connected devices, and I think I understand what w1_rom_to_sensor_value does, but I dont know why I would want to do this..? |
Beta Was this translation helpful? Give feedback.
-
@str4t0m any more Infos on this? |
Beta Was this translation helpful? Give feedback.
-
I just got it working.
then you can specify the rom for a given device like so:
|
Beta Was this translation helpful? Give feedback.
-
Thank you for everything. It's been hard to get help on this issue and I saw you have been through the same issues and not everyone share their findings. You are a nice person. Let me know if you open that FR, I have a huge interest on that subject. |
Beta Was this translation helpful? Give feedback.
-
I think I will have to do something similar. Interfacing too many sensors here. |
Beta Was this translation helpful? Give feedback.
I just got it working.
just some infos for the next guy who stumbles across this:
make sure to have at least 2 devices in the devicetree like this:
then you can specify the rom for a given device like so: