albundy
Posts: 31
Joined: Tue Jul 17, 2012 4:56 pm

DS18B20 5V external power with 3V3 dataline

Sat Jan 19, 2013 8:29 pm

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.

albundy
Posts: 31
Joined: Tue Jul 17, 2012 4:56 pm

Re: DS18B20 5V external power with 3V3 dataline

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.

User avatar
dentex
Posts: 180
Joined: Sun May 20, 2012 7:58 am
Location: Italy
Contact: Website

Re: DS18B20 5V external power with 3V3 dataline

Sat Jul 09, 2016 12:44 pm

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:
One of my projects with the Raspberry Pi:
--------------------------------------------------------
(Raspberry) Pi Aquarium Controller: https://github.com/dentex/piac
...and its dashboard: https://freeboard.io/board/O17ACD

User avatar
yv1hx
Posts: 374
Joined: Sat Jul 21, 2012 10:09 pm
Location: Zulia, Venezuela
Contact: Website

Re: DS18B20 5V external power with 3V3 dataline

Sun Jul 10, 2016 5:08 pm

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:
Marco-Luis
Telecom Specialist (Now Available for Hire!)

http://www.meteoven.org
http://yv1hx.ddns.net
http://twitter.com/yv1hx

User avatar
dentex
Posts: 180
Joined: Sun May 20, 2012 7:58 am
Location: Italy
Contact: Website

Re: DS18B20 5V external power with 3V3 dataline

Fri Sep 09, 2016 5:54 pm

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.
One of my projects with the Raspberry Pi:
--------------------------------------------------------
(Raspberry) Pi Aquarium Controller: https://github.com/dentex/piac
...and its dashboard: https://freeboard.io/board/O17ACD

User avatar
yv1hx
Posts: 374
Joined: Sat Jul 21, 2012 10:09 pm
Location: Zulia, Venezuela
Contact: Website

Re: DS18B20 5V external power with 3V3 dataline

Fri Sep 09, 2016 6:35 pm

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..
Marco-Luis
Telecom Specialist (Now Available for Hire!)

http://www.meteoven.org
http://yv1hx.ddns.net
http://twitter.com/yv1hx

User avatar
dentex
Posts: 180
Joined: Sun May 20, 2012 7:58 am
Location: Italy
Contact: Website

Re: DS18B20 5V external power with 3V3 dataline

Fri Sep 09, 2016 8:11 pm

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.
One of my projects with the Raspberry Pi:
--------------------------------------------------------
(Raspberry) Pi Aquarium Controller: https://github.com/dentex/piac
...and its dashboard: https://freeboard.io/board/O17ACD

Misiu
Posts: 1
Joined: Mon Oct 14, 2019 8:03 pm

Re: DS18B20 5V external power with 3V3 dataline

Mon Oct 14, 2019 8:09 pm

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 :)

User avatar
Burngate
Posts: 6181
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: DS18B20 5V external power with 3V3 dataline

Tue Oct 15, 2019 10:59 am

Looks good to me - assuming the colour code on the resistor is yellow (4), purple (7), red (10^2), (gold (10%))

pcmanbob
Posts: 7925
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: DS18B20 5V external power with 3V3 dataline

Tue Oct 15, 2019 12:37 pm

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.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Return to “Automation, sensing and robotics”