Page 1 of 1

DS18B20 5V external power with 3V3 dataline

Posted: Sat Jan 19, 2013 8:29 pm
by albundy
Powering the DS18B20 with 3V3 while using long lines doesn't seem to work well. The VDD pin of the DS18B20 drops below 3V.

Is it possible to power the DS18B20 VDD pin with 5V and use the pull up resistor of 4K7 connected to 3V3 and the dataline in order to keep the GPIO pin of the raspi at 3V3 max?
I believe the DS18B20 dataline uses some sort of open collector transistor or open drain mosfet to drive the dataline.

Using 5V as external power for the DS18B20 makes it possible to use longer lines while staying below 3V3 because of the open collector/drain dataline to protect the GPIO pin against overvoltage.

Re: DS18B20 5V external power with 3V3 dataline

Posted: Mon Jan 21, 2013 3:45 pm
by albundy
I asked the same question to the manufacturer. They replied:

Yes, you can make VDD = 5V and Vpullup = 3.3V. The Data line (DQ)
is open-drain so it can only go as high as the Vpullup voltage.

So it seems to be safe to connect the VDD of the DS18B20 to +5V and still keep the dataline at max 3V3 for the raspi.
This way it must be possble to use longer cables to connect the DS18B20.

Re: DS18B20 5V external power with 3V3 dataline

Posted: Sat Jul 09, 2016 12:44 pm
by dentex
Hello!
I asked a similar (basically the same) question in another post and received the same answer... so I may be happy with that.
But just out of curiosity, did you ever use the sensor like this? I'm away from my stuff and I can't try myself until tomorrow :mrgreen:

Re: DS18B20 5V external power with 3V3 dataline

Posted: Sun Jul 10, 2016 5:08 pm
by yv1hx
Hi,

I used to have my DS18B20 operating with my RasPi continuously about a year and half gathering the ambient temp in the room while was installed my RasPi, with any glitches.

My line between the RasPi ant the temp sensor was about 30 ~ 40 cms, twisted wire, BTW be sure to use good quality twisted wire when connecting long runs of sensor cables.

Good Luck! :mrgreen:

Re: DS18B20 5V external power with 3V3 dataline

Posted: Fri Sep 09, 2016 5:54 pm
by dentex
yv1hx wrote:Hi,

I used to have my DS18B20 operating with my RasPi continuously about a year and half gathering the ambient temp in the room while was installed my RasPi, with any glitches.

My line between the RasPi ant the temp sensor was about 30 ~ 40 cms, twisted wire, BTW be sure to use good quality twisted wire when connecting long runs of sensor cables.

Good Luck! :mrgreen:
Thanks for your answer.
Sorry for the long silence.
I forgot to "watch" the thread. ;)
I'm actually attempting to connect all the things for my latest project, lately, and I read again this thread.

Re: DS18B20 5V external power with 3V3 dataline

Posted: Fri Sep 09, 2016 6:35 pm
by yv1hx
dentex wrote:
yv1hx wrote:Hi,

I used to have my DS18B20 operating with my RasPi continuously about a year and half gathering the ambient temp in the room while was installed my RasPi, with any glitches.

My line between the RasPi ant the temp sensor was about 30 ~ 40 cms, twisted wire, BTW be sure to use good quality twisted wire when connecting long runs of sensor cables.

Good Luck! :mrgreen:
Thanks for your answer.
Sorry for the long silence.
I forgot to "watch" the thread. ;)
I'm actually attempting to connect all the things for my latest project, lately, and I read again this thread.
No problema!

Good luck, please keep us posted..

Re: DS18B20 5V external power with 3V3 dataline

Posted: Fri Sep 09, 2016 8:11 pm
by dentex
yv1hx wrote: No problema!

Good luck, please keep us posted..
Thanks mate! Much appreciated.

At this point, sorry if I dare ask... but I was trying to understand once and for all the relationship between 3v3 and 5v on the RPi...
and I came to the problem of having, i.e., an I2C-LCD screen powered with 5V and an i2C RTC clock powered with 3v3...

I asked something in: viewtopic.php?p=1035415#p1035415
...if you ever want to take a look.

Thanks again.

Re: DS18B20 5V external power with 3V3 dataline

Posted: Mon Oct 14, 2019 8:09 pm
by Misiu
albundy wrote:
Mon Jan 21, 2013 3:45 pm
I asked the same question to the manufacturer. They replied:

Yes, you can make VDD = 5V and Vpullup = 3.3V. The Data line (DQ)
is open-drain so it can only go as high as the Vpullup voltage.

So it seems to be safe to connect the VDD of the DS18B20 to +5V and still keep the dataline at max 3V3 for the raspi.
This way it must be possble to use longer cables to connect the DS18B20.
I'm aware this is a very old topic, but I have problems with long wires and star topology and I'm trying every possible I can.
Is this the correct schema:

Image

I want to connect DS18B20 gnd to gnd of PI, 5V from PI to DS18B20 VDD and GPIO4 to the data line of DS18B20.
Because DS18B20 needs a 4,7k resistor I want to add a resistor between the data line and 3.3V on Pi.

The last thing I wast is to damage my pi, so is someone can confirm if this is valid. Thank You :)

Re: DS18B20 5V external power with 3V3 dataline

Posted: Tue Oct 15, 2019 10:59 am
by Burngate
Looks good to me - assuming the colour code on the resistor is yellow (4), purple (7), red (10^2), (gold (10%))

Re: DS18B20 5V external power with 3V3 dataline

Posted: Tue Oct 15, 2019 12:37 pm
by pcmanbob
You sensor will work just fine using 5v VCC and 3.3v pull up, but don't use a star topology, you will only have problems doing it that way due to reflected signals.

you need to chain the sensor one form another like this

Image

If you have a number of sensors to run and the gpio pins to spare, you can set more that one gpio pin to work as a 1-wire interface and then spread your sensors across the gpio pins, which might help reduce you cable run lengths.