GarraTheWinnie
Posts: 221
Joined: Tue Jul 28, 2020 10:34 am

A DS18B20 with 5v

Thu Apr 22, 2021 10:19 pm

Hey everyone.

I’m using a DS18B20 Thermometer. Due to how I have my project set up, it made sense to use the 5v to power it, and use a LLC to convert the logic down to 3.3v

I set it up, and it didn’t work. I then tried hooking it up without the LLC and it worked perfectly.

I checked the data sheet, and from what I can tell, it should be sending out a 5v logic signal. Assuming it is doing that, is there any danger in this?

Does anyone know if it’s automatically convert the logic to 3.3?

User avatar
joan
Posts: 15564
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: A DS18B20 with 5v

Thu Apr 22, 2021 10:22 pm

It is okay to power with 5V. Make sure the data line pull-up is to 3V3.

GarraTheWinnie
Posts: 221
Joined: Tue Jul 28, 2020 10:34 am

Re: A DS18B20 with 5v

Thu Apr 22, 2021 10:27 pm

joan wrote:
Thu Apr 22, 2021 10:22 pm
It is okay to power with 5V. Make sure the data line pull-up is to 3V3.
I’m not sure what you mean. I just tested data line, and I got 4.5

GarraTheWinnie
Posts: 221
Joined: Tue Jul 28, 2020 10:34 am

Re: A DS18B20 with 5v

Thu Apr 22, 2021 10:39 pm

Is this what you mean?

Image

What is the danger with leaving it how it is, if it’s working?

User avatar
Imperf3kt
Posts: 4409
Joined: Tue Jun 20, 2017 12:16 am
Location: Australia
Contact: Twitter

Re: A DS18B20 with 5v

Fri Apr 23, 2021 12:36 am

Why is gpio 4 connected to 3v3 via a resistor?
55:55:44:44:4C
52:4C:52:42:41

Rose tinted glasses are difficult to see through.

GarraTheWinnie
Posts: 221
Joined: Tue Jul 28, 2020 10:34 am

Re: A DS18B20 with 5v

Fri Apr 23, 2021 2:09 am

Imperf3kt wrote:
Fri Apr 23, 2021 12:36 am
Why is gpio 4 connected to 3v3 via a resistor?
1wire needs the data line to be wired parallel to a power source with a 4K resistor

GarraTheWinnie
Posts: 221
Joined: Tue Jul 28, 2020 10:34 am

Re: A DS18B20 with 5v

Fri Apr 23, 2021 3:40 pm

This work ended up working.

It’s now coming out at the right voltage

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

Re: A DS18B20 with 5v

Fri Apr 23, 2021 4:36 pm

Imperf3kt wrote:
Fri Apr 23, 2021 12:36 am
Why is gpio 4 connected to 3v3 via a resistor?
Because the data pin on the sensor is an open drain output so you have to apply a pull up to be able to read the data.
GarraTheWinnie wrote:
Thu Apr 22, 2021 10:39 pm
What is the danger with leaving it how it is, if it’s working?
as the pi gpio is not 5V tolerant if you apply a 5V pull up you will end up latching gpio4 high and so damage your pi , eventually the pi will likely stop working all together.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

User avatar
joan
Posts: 15564
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: A DS18B20 with 5v

Fri Apr 23, 2021 4:37 pm

Your schematic looks correct. I'm not sure why you read 4.5V on the data line. The data line is open drain and should be at the same voltage as the pull-up (which must be 3V3 on the Pi).

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

Re: A DS18B20 with 5v

Fri Apr 23, 2021 4:48 pm

joan wrote:
Fri Apr 23, 2021 4:37 pm
Your schematic looks correct. I'm not sure why you read 4.5V on the data line. The data line is open drain and should be at the same voltage as the pull-up (which must be 3V3 on the Pi).
I think the OP was originally using a 5V pull up as they were powering the sensor with 5V.

4.5V would probably be about right if using a 4.7K resistor for the pull up.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

User avatar
joan
Posts: 15564
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: A DS18B20 with 5v

Fri Apr 23, 2021 5:02 pm

pcmanbob wrote:
Fri Apr 23, 2021 4:48 pm
joan wrote:
Fri Apr 23, 2021 4:37 pm
Your schematic looks correct. I'm not sure why you read 4.5V on the data line. The data line is open drain and should be at the same voltage as the pull-up (which must be 3V3 on the Pi).
I think the OP was originally using a 5V pull up as they were powering the sensor with 5V.

4.5V would probably be about right if using a 4.7K resistor for the pull up.
Yes, I confused myself.

Return to “Beginners”