I have setup test for DS18B20 sensor with Raspberry Pi to find out whether it works with 3,3V and 5V respectively as advertised.

I have found that it is working on both voltages, but temperature measured on 5V is roughly 1°C higher than on 3,3Vcc.

I have used 4k7 pull up resistor in both case.

So can someone confirm which setup is correct? I have read that it is dangerous for RPI's data pin to bring it to 5V with pullup resistor when connected on 5Vcc. So it seems like the way would be 3,3V just need to confirm pullup resistor to use in this setup too.


1 Answer 1


You can power it from 5V or 3V3. Choose which one you prefer.

The pull-up on the data line must be to 3V3 on the Pi as the Pi's GPIO are all 3V3.

The data pin pull-up of the DS19B20 is completely independent of the Vcc voltage (it may well be clarified in the datasheet).

  • so I almost fried my gpio pin with 5V --confirmed; with this sensor not working without pull-up for me only option that remains is to use it with 3V3. however if I would be using Arduino, I no longer have 3V3 restriction and readings will differ with 1°C (same sensor, instantly swapped Vcc) --unresolved
    – greengold
    Apr 8, 2023 at 17:56
  • How? You can connect Vcc to 5V at the same time as having a pull-up to 3V3 on the data line. How did you connect 5V to a GPIO?
    – joan
    Apr 8, 2023 at 19:15
  • well, i had a pull-up 5V -> data
    – greengold
    Apr 8, 2023 at 19:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.