Hi folks, having an odd one;
I have 5 waterproof DS18B20 sensors (the ones in a metal can on a flying lead), hooked up to the GPIO ports in the configuration described here; http://www.cl.cam.ac.uk/projects/raspbe ... mperature/
I have found through trial and error that I can connect 2 (any two, which rules out a faulty sensor) sensors and have them work just fine.. but add a third and I get no slaves, nothing showing as a device.
I guess I am really looking to find out if this is expected; is anyone out there using four or five sensors this way?
My RPi is a 1st gen Type B (one of the original element 14 order into the UK no less!),
running a NOOBS Raspbian image - uname tells me that it's "#474 PREEMPT Thu Jun 13 17:14:42 BST 2013"
SD Card is a Kingston sdc4/16gb in one of the adafruit micro SD adapters
I have tried a couple of PSUs, and this one seems very stable - it's a 2A Samsung tablet one.
I'm hoping to use this RPi as a controller for my solar thermal water system, so this is a bit of a disappointment. annoyingly, I did a wee proof of concept with just two sensors, and it worked just fine, and wrote some code around that. I'd rather not change technology completely to owfs or i2c if there's something simpler that I can do...
So, any ideas or insights?
-
- Posts: 2
- Joined: Mon May 28, 2012 8:40 pm
- FLYFISH TECHNOLOGIES
- Posts: 1750
- Joined: Thu Oct 03, 2013 7:48 am
- Location: Ljubljana, Slovenia
- Contact: Website
Re: Can't add more than 2 DS18B20 using GPIO driver
Hi,

So, what you can do is to connect each sensor to a dedicated GPIO pin and modify the code accordingly.
Another option is to purchase a dedicated chip which either handles the capacitance better, and/or which natively offers more 1-wire buses.
If you pick the second option, you could consider using chip listed here: http://www.flyfish-tech.com/FF32. Sample code for reading temperature from DS18B20 is also available for download there.
Best wishes, Ivan Zilic.
Most likely, the problem is capacitance of wires, what is the first limit you typically bump in. This is not specific to RasPi, but a result of non-ideal world we live in.TheoraJones wrote:So, any ideas or insights?

So, what you can do is to connect each sensor to a dedicated GPIO pin and modify the code accordingly.
Another option is to purchase a dedicated chip which either handles the capacitance better, and/or which natively offers more 1-wire buses.
If you pick the second option, you could consider using chip listed here: http://www.flyfish-tech.com/FF32. Sample code for reading temperature from DS18B20 is also available for download there.
Best wishes, Ivan Zilic.
Running out of GPIO pins and/or need to read analog values?
Solution: http://www.flyfish-tech.com/FF32
Solution: http://www.flyfish-tech.com/FF32
Re: Can't add more than 2 DS18B20 using GPIO driver
How you know that , did you see connection picture ? I never have any capacitance problem with 1-Wire devices, and connect a lot of it. So very probably isnt that problem at all.FLYFISH TECHNOLOGIES wrote:Hi,Most likely, the problem is capacitance of wires, what is the first limit you typically bump in. This is not specific to RasPi, but a result of non-ideal world we live in.TheoraJones wrote:So, any ideas or insights?![]()
Did you ever try that solutions on RPi ? From my knowledge Kernel modules support only one GPIO pin for 1-Wire master bus. Did you kreate a new kernel module ?FLYFISH TECHNOLOGIES wrote: So, what you can do is to connect each sensor to a dedicated GPIO pin and modify the code accordingly.
Nice try, how user spouse to connect your microcontroler to RPi ? I dont see any support for RPi on your page, did i miss something ?FLYFISH TECHNOLOGIES wrote: Another option is to purchase a dedicated chip which either handles the capacitance better, and/or which natively offers more 1-wire buses.
If you pick the second option, you could consider using chip listed here: http://www.flyfish-tech.com/FF32. Sample code for reading temperature from DS18B20 is also available for download there.
Best wishes, Ivan Zilic.
Regards,
Dubravko Penezic
Re: Can't add more than 2 DS18B20 using GPIO driver
Hi,TheoraJones wrote:Hi folks, having an odd one;
I have 5 waterproof DS18B20 sensors (the ones in a metal can on a flying lead), hooked up to the GPIO ports in the configuration described here; http://www.cl.cam.ac.uk/projects/raspbe ... mperature/
I have found through trial and error that I can connect 2 (any two, which rules out a faulty sensor) sensors and have them work just fine.. but add a third and I get no slaves, nothing showing as a device.
I guess I am really looking to find out if this is expected; is anyone out there using four or five sensors this way?
...
I have tried a couple of PSUs, and this one seems very stable - it's a 2A Samsung tablet one.
So, any ideas or insights?
did you check 3.3V on all sensors ? , did you have any other extended board connected to RPi on same time ... I did try to connect 5 of DS18B20 on my RPI and work normal. May you send picture of your connection ?
Regards,
Dubravko Penezic
- FLYFISH TECHNOLOGIES
- Posts: 1750
- Joined: Thu Oct 03, 2013 7:48 am
- Location: Ljubljana, Slovenia
- Contact: Website
Re: Can't add more than 2 DS18B20 using GPIO driver
Hi,
Although, this doesn't mean that it cannot happen to anybody... but when the same person mentions also trial and error actions he already did, you should better think twice.
Best wishes, Ivan Zilic.
In messages we can usually get a feeling what is the background of poster. When somebody mentions proof of concept he already did, then it should be very clear to anybody, that the person has some mileage... and asking him if "all wires are connected" is a bit disrespectful.dpenezic wrote:How you know that , did you see connection picture ?FLYFISH TECHNOLOGIES wrote:Most likely, the problem is capacitance of wires, what is the first limit you typically bump in.
Although, this doesn't mean that it cannot happen to anybody... but when the same person mentions also trial and error actions he already did, you should better think twice.
Google for "bit-banging".dpenezic wrote:Did you ever try that solutions on RPi ? From my knowledge Kernel modules support only one GPIO pin for 1-Wire master bus. Did you kreate a new kernel module ?FLYFISH TECHNOLOGIES wrote:So, what you can do is to connect each sensor to a dedicated GPIO pin and modify the code accordingly.
USB comes to mind.dpenezic wrote:Nice try, how user spouse to connect your microcontroler to RPi ?FLYFISH TECHNOLOGIES wrote:Another option is to purchase a dedicated chip
Is it confusing for you that the support exists despite the fact that there is no big Raspberry Pi logo present ?dpenezic wrote:I dont see any support for RPi on your page, did i miss something ?
Best wishes, Ivan Zilic.
Running out of GPIO pins and/or need to read analog values?
Solution: http://www.flyfish-tech.com/FF32
Solution: http://www.flyfish-tech.com/FF32
Re: Can't add more than 2 DS18B20 using GPIO driver
Hi,
first user have only one post, secondly it is usual mistake, third your knowledge of electronic is higher then many person on this forum. So good question for this user will be how you connect your DS18B20 , and check a picture of that connection.
According many response and experience bit-banging isnt very well supportet on RPi (https://raspberrypi.stackexchange.com/q ... ample-code).
For you and your module is good that support exist, how ever i like to see it available on suggested link too .
Regards,
Dubarvko Penezic
first user have only one post, secondly it is usual mistake, third your knowledge of electronic is higher then many person on this forum. So good question for this user will be how you connect your DS18B20 , and check a picture of that connection.
According many response and experience bit-banging isnt very well supportet on RPi (https://raspberrypi.stackexchange.com/q ... ample-code).
For you and your module is good that support exist, how ever i like to see it available on suggested link too .
Regards,
Dubarvko Penezic
FLYFISH TECHNOLOGIES wrote:Hi,In messages we can usually get a feeling what is the background of poster. When somebody mentions proof of concept he already did, then it should be very clear to anybody, that the person has some mileage... and asking him if "all wires are connected" is a bit disrespectful.dpenezic wrote:How you know that , did you see connection picture ?FLYFISH TECHNOLOGIES wrote:Most likely, the problem is capacitance of wires, what is the first limit you typically bump in.
Although, this doesn't mean that it cannot happen to anybody... but when the same person mentions also trial and error actions he already did, you should better think twice.
Google for "bit-banging".dpenezic wrote:Did you ever try that solutions on RPi ? From my knowledge Kernel modules support only one GPIO pin for 1-Wire master bus. Did you kreate a new kernel module ?FLYFISH TECHNOLOGIES wrote:So, what you can do is to connect each sensor to a dedicated GPIO pin and modify the code accordingly.
USB comes to mind.dpenezic wrote:Nice try, how user spouse to connect your microcontroler to RPi ?FLYFISH TECHNOLOGIES wrote:Another option is to purchase a dedicated chip
Is it confusing for you that the support exists despite the fact that there is no big Raspberry Pi logo present ?dpenezic wrote:I dont see any support for RPi on your page, did i miss something ?
Best wishes, Ivan Zilic.
- FLYFISH TECHNOLOGIES
- Posts: 1750
- Joined: Thu Oct 03, 2013 7:48 am
- Location: Ljubljana, Slovenia
- Contact: Website
Re: Can't add more than 2 DS18B20 using GPIO driver
Hi,
Another question is timing - what are your time slots requirements. In the link you provided, the question is about UART at speed 9600...
Don't generalize. Quick math returns a value of at least 25x higher sampling rate needed for 9600 UART bit-banging comparing to 1-Wire communication. Very important fact is also that UART bit-banging requires significantly more resources due to its asynchronous nature.
Best wishes, Ivan Zilic.
We might have (also) here some terminology issues with understanding what "support on RPi" means. My understanding is that if you can directly control pins level and direction (and you can), then bit-banging is supported.dpenezic wrote:According many response and experience bit-banging isnt very well supportet on RPi
Another question is timing - what are your time slots requirements. In the link you provided, the question is about UART at speed 9600...
Don't generalize. Quick math returns a value of at least 25x higher sampling rate needed for 9600 UART bit-banging comparing to 1-Wire communication. Very important fact is also that UART bit-banging requires significantly more resources due to its asynchronous nature.
It is listed ever since the web page was composed.dpenezic wrote:For you and your module is good that support exist, how ever i like to see it available on suggested link too .
Best wishes, Ivan Zilic.
Running out of GPIO pins and/or need to read analog values?
Solution: http://www.flyfish-tech.com/FF32
Solution: http://www.flyfish-tech.com/FF32
-
- Posts: 2
- Joined: Mon May 28, 2012 8:40 pm
Re: Can't add more than 2 DS18B20 using GPIO driver
Hi guys,
Quite a discussion! - Flyfish, thanks for your input, but I am really not looking for such complexity in my solution.
I am not so sure capacitance would be te problem here, simply because of the small size of my board etc; Maxim seem to have suggest that legs of up to 3m are okay and bus lengths of >30 metres. each sensor is on a 70cm wire, and total bus length is only about 1.5m with three sensors.
Here's a picture;


there's not a lot to it!
Quite a discussion! - Flyfish, thanks for your input, but I am really not looking for such complexity in my solution.
I am not so sure capacitance would be te problem here, simply because of the small size of my board etc; Maxim seem to have suggest that legs of up to 3m are okay and bus lengths of >30 metres. each sensor is on a 70cm wire, and total bus length is only about 1.5m with three sensors.
Here's a picture;


there's not a lot to it!
- FLYFISH TECHNOLOGIES
- Posts: 1750
- Joined: Thu Oct 03, 2013 7:48 am
- Location: Ljubljana, Slovenia
- Contact: Website
Re: Can't add more than 2 DS18B20 using GPIO driver
Hi,

I wondered if each sensor includes sealed also pull-up resistor, but according to various responses in forums, this is not the case.
The only idea I have right now is to perform measurements what is going on. If you have an oscilloscope available, check the communication at voltage level and bit timing.
Best wishes, Ivan Zilic.
This is exactly the overall mystery...TheoraJones wrote:there's not a lot to it!

I wondered if each sensor includes sealed also pull-up resistor, but according to various responses in forums, this is not the case.
The only idea I have right now is to perform measurements what is going on. If you have an oscilloscope available, check the communication at voltage level and bit timing.
Best wishes, Ivan Zilic.
Running out of GPIO pins and/or need to read analog values?
Solution: http://www.flyfish-tech.com/FF32
Solution: http://www.flyfish-tech.com/FF32
- pluggy
- Posts: 3635
- Joined: Thu May 31, 2012 3:52 pm
- Location: Barnoldswick, Lancashire,UK
- Contact: Website
Re: Can't add more than 2 DS18B20 using GPIO driver
I've had problems with DS18X20's disappearing on an Arduino setup in a similar manner to the OPs problem. I resolved it by sticking some more pullup resistors around the place. I'd always have one at the end of the run as well as the beginning, they are quite tolerant to more pullup, not so tolerant to less in my experience. Probably tied up with lead capacitance..... 

Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......
I must not tread on too many sacred cows......
- iinnovations
- Posts: 621
- Joined: Thu Jun 06, 2013 5:17 pm
Re: Can't add more than 2 DS18B20 using GPIO driver
90+% of 1 wire issues can be solved with a 1wire bus master and owfs. Don't reinvent the wheel. Ds2483 is $1.
Colin
Colin
CuPID Controls :: Open Source browser-based sensor and device control
interfaceinnovations.org/cupidcontrols.html
cupidcontrols.com
interfaceinnovations.org/cupidcontrols.html
cupidcontrols.com
-
- Posts: 3529
- Joined: Thu Dec 27, 2012 4:05 am
- Location: Québec, Canada
Re: Can't add more than 2 DS18B20 using GPIO driver
This is really strange
I got my Pond system with 5 sensors and never had a problem with my RPi model B version 1.0
The system is working since november 2012 and it is outside Checking the pond during the winter. I'm in Canada so i get down often below -20C.
If you check closely the picture , I do have the same setup than you . The only thing I had was a 0.1 uF between the ground and 3.3V.

Did you try to decrease or increase the 4k7 resistor.
Maybe one of your sensor misbehaves.
Daniel.
I got my Pond system with 5 sensors and never had a problem with my RPi model B version 1.0
The system is working since november 2012 and it is outside Checking the pond during the winter. I'm in Canada so i get down often below -20C.
If you check closely the picture , I do have the same setup than you . The only thing I had was a 0.1 uF between the ground and 3.3V.
Did you try to decrease or increase the 4k7 resistor.
Maybe one of your sensor misbehaves.
Daniel.
Re: Can't add more than 2 DS18B20 using GPIO driver
@Daniel,
What is the reason for the capacitor between ground and +3.3V?
What is the reason for the capacitor between ground and +3.3V?
-
- Posts: 3529
- Joined: Thu Dec 27, 2012 4:05 am
- Location: Québec, Canada
Re: Can't add more than 2 DS18B20 using GPIO driver
old habit,
spike filtering on power.
electronic device tends to drive current when they are activated and this will be induce on the power line. This is why it i always a good idea to have decouple capacitor, to reduce the current surge , near each I.C.
Daniel
spike filtering on power.
electronic device tends to drive current when they are activated and this will be induce on the power line. This is why it i always a good idea to have decouple capacitor, to reduce the current surge , near each I.C.
Daniel