Temperature Sensor (DS18B20) Raspberry Pi

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ต.ค. 2024
  • Basic tutorial of how to setup a DS18b20 temp sensor with the raspberry pi.
    Official Website: www.piddlerinth...
    Required Parts:
    RPI 3 - amzn.to/2VA9pQY
    4 Amp Power Adapter - amzn.to/2CTptWu
    16GB micro SD - amzn.to/2SFMwd3
    120 pcs jumper cable: ebay.to/2VAb9cY
    ds18b20 sensor - amzn.to/2M5yHSN
    Music:
    "Too Cool" Kevin MacLeod (incompetech.com)
    Licensed under Creative Commons: By Attribution 3.0 License
    creativecommons...
    Direct to Video by Chris Zabriskie is licensed under a Creative Commons Attribution license (creativecommon...)
    Source: chriszabriskie....
    Artist: chriszabriskie....
    Support the channel with Bitcoin!
    blockchain.inf...

ความคิดเห็น • 91

  • @PapiJack
    @PapiJack 5 ปีที่แล้ว +3

    I have an issue. After a few hours of running the script it stops and throws this error:
    IOError: [Errno 2] No such file or directory: '/sys/bus/w1/devices/28-0216924510f2/w1_slave'
    It's like the folder suddenly disappears. If I reboot the Rpi the problem persist. I have to shut it down then it works for another few hours. It works for what I'm doing but it's inconvenient for long term monitoring. Any ideas?

    • @cathamburger3161
      @cathamburger3161 5 ปีที่แล้ว +2

      ok so for some reason the sensor i put on my pi does this too, and the sensor seems to like to randomly reset itself for no reason.
      the way i fixed it is by disconnecting and reconnecting the resistor.

    • @PapiJack
      @PapiJack 5 ปีที่แล้ว +2

      @@cathamburger3161 I used the code in this tutorial and now it doe snot fail. www.circuitbasics.com/raspberry-pi-ds18b20-temperature-sensor-tutorial/

    • @ΚΩΣΤΑΣΞΑΝΘΟΠΟΥΛΟΣ-ν8ζ
      @ΚΩΣΤΑΣΞΑΝΘΟΠΟΥΛΟΣ-ν8ζ 5 หลายเดือนก่อน

      F

  • @krillenummer1
    @krillenummer1 7 ปีที่แล้ว +22

    For all of you who is using a sensor like this with Raspberry Pi, that does not have the breakout board. You put a 4.7k resistor connecting the red and yellow wire together before connecting it to the raspberry pi.
    You know that you have to do this when you get 00-8xxxxxxxx instead of the 28-xxxxxxxx number and it varies.

    • @superfounder9918
      @superfounder9918 7 ปีที่แล้ว

      Hello , can you help me finding out what's the problem of my Raspberry Pi ? I mean , sensor . I try to connect the sensor (same as in the video) to the breakout board 0.8000000000 , used flooder to stick the resistor to the red and yellow and still 0.8000000 , i don't understand what to do , i am browsing for 6 hours and still nothing.

    • @SweetyHeaven
      @SweetyHeaven 6 ปีที่แล้ว

      Since I did not have a resistor I've tried running in parasite mode but it did not help... when I got resistor it worked but it's kinda weird you need an extra resistor to make it work.

    • @edw4699
      @edw4699 6 ปีที่แล้ว

      from a technical point of view it is explainable as it has an open collector.
      As for the ' why'? Well you could connect a whole bunch of these sensors to one pin,so if you would have an inbuilt 4k7 resistor and you would connect 10 sensors.... tghe combined pullup would be 470 ohm and that is just a little bit over the top

    • @edw4699
      @edw4699 6 ปีที่แล้ว +1

      just a word of warning..... apparently NOT all breakoutboards have a pull up resistor attached.
      Although you could use the internal pull up of the raspberry pin, I found it more reliable to have a seperate 4k7-10k resistor for pull up

    • @teroojala5436
      @teroojala5436 5 ปีที่แล้ว

      In this video there is Pluggable Terminal that (usually) comes with DS18b20 sensor. It has 4.7k resistor attached and wired correctly. So you can attach multiple sensors with single terminal (just by jamming more sensors to connector). If in doubt, just check if your terminal has tiny resistor that has numbers "472" on it.

  • @JimmiJaz
    @JimmiJaz 5 ปีที่แล้ว +5

    Your videos helped with almost every step of my projects. Thanks a tonne for taking the time to create

  • @wvpolekat
    @wvpolekat 7 ปีที่แล้ว +13

    It can go in boiling water no problem. Boiling water is 212 F
    Usable temperature range: -55 to 125°C (-67°F to +257°F)

  • @baconfly11
    @baconfly11 3 ปีที่แล้ว

    this is my first raspberry pi project (I'll be saving the temp data to a T-SQL database in addition) thanks for a great video!

  • @adheeshk93
    @adheeshk93 6 ปีที่แล้ว +5

    I try to follow the tutorial and do the exactly same thing, but I don't get 28-xxxxxxxx, instead I get something as 00-xxxxxxxx. I use just one set of jumper cables i.e. connect the temperature adapter to the pi without using another set of cables (as I have jumper cables without the clips on one side) Is there something I am doing wrong?

  • @virgilcalinescu4938
    @virgilcalinescu4938 3 ปีที่แล้ว +1

    very nice!
    I am new in this field, for 1 sensor I understood how to do it but I want to measure in 20 points so with 20 ds18b20 sensors.
    can you help me by showing how the respective code changes?
    Thank you very much!

  • @AtlantaTerry
    @AtlantaTerry 7 ปีที่แล้ว +11

    It is not good practice to change the colors of the wires. Try to maintain the wire colors all the way.
    Why? Well, IF you need to troubleshoot, it will keep you sane. Just look at how many times during the video you had to refer back to the sensor board to make sure your changed colors were connected to the correct pins.

    • @PiddlerInTheRoot
      @PiddlerInTheRoot  7 ปีที่แล้ว +7

      I absolutely agree that you shouldn't change the wire colors whenever possible... but sometimes in life you experience a shortage of jumper cables and have to make due. :)

  • @alamagoseniora8128
    @alamagoseniora8128 6 ปีที่แล้ว +1

    you have the most clear explanation. step by step. all components listed. thanks!

  • @bensavage6389
    @bensavage6389 6 ปีที่แล้ว

    hey just wanted to let you know this was very helpful. i have a gas water heater that sometimes doesn't kick on and needs to be turned on again. will use the temp sensor taped to the hot water heater tank with hvac tape to make sure the water is heating up and if it doesn't it will turn the water heater on again with the relay switch. anyway.. happy that I won't have to use a ugly breadboard

    • @HiralPatel007
      @HiralPatel007 3 ปีที่แล้ว

      I need to to do the same thing, but I want it so when temp of pipe drops below a certain temp I get an email notification, My system has recirculating pump and sometimes it does not activate

  • @simayaaaliyah3615
    @simayaaaliyah3615 6 ปีที่แล้ว

    Thanks very much sir. This video is very usefull to me. Now i'm trying to set multiple Temp Sensor and increase temp accurate

  • @zhlchlv
    @zhlchlv 3 ปีที่แล้ว

    ништяк, барток. все работает. спасибо за туториал.

  • @ΒασιληςΤογης
    @ΒασιληςΤογης 3 ปีที่แล้ว

    Hi and congrats for your video. Well, im encountering a problem, I did exactly what you say and when I hit the ls command, I get nothing

  • @jayamohank
    @jayamohank 3 ปีที่แล้ว +1

    is there a link to the code used in the video

  • @edw4699
    @edw4699 6 ปีที่แล้ว +2

    ofcourse we all fiddle with cable colors but for an instructional video it might not be the best. A female to female cable in the right colors would have helped a lot.
    It might be a good idea to check the datasheet for simple facts such as the temperature range.
    Where you type in code it is in fact unreadable
    It is a pity (but not your fault) that the DS18B20 values apparently have to be put in a file first

    • @PiddlerInTheRoot
      @PiddlerInTheRoot  6 ปีที่แล้ว +3

      Right, thanks for the feedback. Definitely trying to address some of those quality issues in future videos.

    • @edw4699
      @edw4699 6 ปีที่แล้ว +2

      such a reply deserves respect

  • @pistifesus1785
    @pistifesus1785 5 ปีที่แล้ว +1

    Thanks for this tutorial! Any info on how to manage multiple sensors. I have to add around 6 DS18B20 so I need to chain them somehow. Thanks in advance.

    • @PiddlerInTheRoot
      @PiddlerInTheRoot  5 ปีที่แล้ว +1

      I think it's possible, follow this forum: www.raspberrypi.org/forums/viewtopic.php?f=29&t=167896

  • @ericjohn3817
    @ericjohn3817 5 ปีที่แล้ว +1

    Fantastic job! Thank you so much for sharing. Have you done anything with the salinity sensor connecting to rpi?

  • @parastoupoursoltan5527
    @parastoupoursoltan5527 4 ปีที่แล้ว

    Thank you so much. It was very helpful.

  • @barraca87
    @barraca87 4 ปีที่แล้ว

    Thanks for your video! A question, how many sensors of this kind can you put in a Raspberry 3? I would like do something like yours but I need 4 Temp sensors and 1 extra sensor that just make contact when the water touch it

  • @infoinfo7015
    @infoinfo7015 3 ปีที่แล้ว

    Is there a way to get this output to display on a Raspberry Pi display connected via DSI cable?

  • @simayaaaliyah3615
    @simayaaaliyah3615 6 ปีที่แล้ว

    Thanks very much sir. This video is very usefull to me. Thanks ones again

  • @txsatelectronics6156
    @txsatelectronics6156 6 ปีที่แล้ว

    I have my sensor working just fine but was wondering if there is a way that I can run a script from my homepage by just clicking on an icon ? Thanks !!

  • @olafgunther9401
    @olafgunther9401 3 ปีที่แล้ว

    thank you so much this as amazing!!

  • @jonassal6937
    @jonassal6937 5 ปีที่แล้ว +1

    Can I use this with my own temperature sensor to get my EGTs(exhaust gas temperature ) on my truck?

    • @hamnetsouthafrica5787
      @hamnetsouthafrica5787 4 ปีที่แล้ว

      Probably not as the sensor only goes to 85 deg C. EGT is much higher than that.

  • @muhammadsyafiq7760
    @muhammadsyafiq7760 4 ปีที่แล้ว

    If I want to display the output on the lcd monitor connected to pi, is it same or I need different coding.

  • @Iq-gondal
    @Iq-gondal 4 ปีที่แล้ว

    i have an issue in command prompt ls command doesnt work ,as shown in your video plz help if u can

  • @SXRSkibum
    @SXRSkibum ปีที่แล้ว

    Can you hook up 2 of theses to 1 pi?

  • @txsatelectronics6156
    @txsatelectronics6156 6 ปีที่แล้ว

    Does anyone have a wiring diagram and script that would allow us to control a fan once the Pi reaches a certain temperature?....that way your fan is not running all the time especially in cooler weather if your pi will be used in an outside enclosure as we are going to be doing for certain applications. Thanks for any help!

  • @maxbaszkiewicz3199
    @maxbaszkiewicz3199 4 ปีที่แล้ว

    i can conect more than 1 temperature sensors to rassbery pi? pls i need help

  • @miladavaz
    @miladavaz 6 ปีที่แล้ว

    Thanks for the vid. Where did you find the sensor with the breakout board? I can't seem to find it anywhere.

  • @farhanahnabilah8308
    @farhanahnabilah8308 6 ปีที่แล้ว

    Hi.. I have followed this tutorial but I can not get the serial number.Is there something I am doing wrong?Please help me..

    • @hariseldon2577
      @hariseldon2577 5 ปีที่แล้ว

      To explain the 4.7k resistor wiring th-cam.com/video/M_P9synPVcQ/w-d-xo.html

  • @meerrayyanali9
    @meerrayyanali9 6 ปีที่แล้ว

    I want to measure body temperature of an infant , please suggest me a good body temperature sensor which could be interfaced with raspberry p....it would be a great help

    • @edw4699
      @edw4699 6 ปีที่แล้ว

      ds18b20 will do that, but for a child it seems easier to just buy a digital thermometer

    • @raymondchiu7582
      @raymondchiu7582 6 ปีที่แล้ว

      As a biomedical engineer, please consider the electrical safety (IEC60601) for your infant

  • @Mthmgful
    @Mthmgful 3 ปีที่แล้ว

    `what is your IDE for python please ?

  • @jocadasneves
    @jocadasneves 4 ปีที่แล้ว

    what is the name of the conector were you connect the thermal wires ?

    • @legohistory
      @legohistory 5 หลายเดือนก่อน

      "Plugable Terminal" says mine

  • @fabietto80
    @fabietto80 6 ปีที่แล้ว

    Could you please provide a link to the breakout board? Thanks

    • @PiddlerInTheRoot
      @PiddlerInTheRoot  6 ปีที่แล้ว

      Link in the description, the sensor and board usually come bundled together.

  • @mihail-viorelpaun5536
    @mihail-viorelpaun5536 6 ปีที่แล้ว

    hello! i have a problem. when i try to run the code it says UnboundLocalError: local variable 'ds18b20' referenced before assignment.

    • @mihail-viorelpaun5536
      @mihail-viorelpaun5536 6 ปีที่แล้ว

      i tried to put nonlocal before ds18b20 but it says syntax error and if i put global, it says that it is undefined :(

  • @yarabanda9639
    @yarabanda9639 3 ปีที่แล้ว

    can i use this sensor to measure skin temperature?

  • @KT-ut9zg
    @KT-ut9zg 7 ปีที่แล้ว

    I had thought that the Pi only did digital pins and that you would get either low or high from a pin. How is this receiving data in what seems to be an analogue form? Be interested to know as a Pi noob :) For instance I have a project for which I'll be using a sound sensor. The sensor has both analogue and digital out and I though I'd only be able to use digital. This video seems to suggest otherwise.

    • @PiddlerInTheRoot
      @PiddlerInTheRoot  7 ปีที่แล้ว

      www.maximintegrated.com/en/app-notes/index.mvp/id/4377

    • @KT-ut9zg
      @KT-ut9zg 7 ปีที่แล้ว

      Thanks for taking the time to shove a link in there. I appreciate the lack of verbosity of the reply but unfortunately it doesn't help with my question much. I can see how the sensors work but not how the data is represented at pin level. Like I said in my question, I thought the Pi had just on/off for each pin, not a voltage level. Anyway, not to worry, I can look elsewhere for the answer.

    • @PiddlerInTheRoot
      @PiddlerInTheRoot  6 ปีที่แล้ว

      I'm not entirely sure how the sensor works at the pin level... but this article seems to imply that the output pin communicates via serial to the raspberry pi. learn.adafruit.com/adafruits-raspberry-pi-lesson-11-ds18b20-temperature-sensing/ds18b20

    • @KT-ut9zg
      @KT-ut9zg 6 ปีที่แล้ว

      Ok. Now I get it. So, I guess what I'm interested in is reading the pin data directly with Python. You are opening the file on the Raspi and parsing that data. From your second link I'm seeing that with a serial library I can actually pick the serial data up directly from the pin and the temperature probe itself is communicating directly in serial. That is VERY interesting - I didn't know I could do that with the Pi, so in effect I'm getting a type of analogue readout through a digital pin. Thanks for the info. I happen to have one of those probes from another project using a BlueTooth device to transmit the temp data but I'd like to try and use it now to read the serial data directly.

    • @edw4699
      @edw4699 6 ปีที่แล้ว

      well the DS18B20 measures an analog value, but sends it in a digital format
      Whereever one sees the ds18b20 on a raspberry explained, it is the same old 'write to a file' which is a pity. The DHTxx series for instance can be read directly into a variable without the help of a file. Somehow should be possible with the DS18B20 as well. It is possible on a PIC or Atmel chip

  • @stefanzenz4775
    @stefanzenz4775 4 ปีที่แล้ว

    good video

  • @kenstovall7216
    @kenstovall7216 6 ปีที่แล้ว

    Does anyone know of an app that can run on an Apple phone that will allow you to log in to a Raspberry to get the temp reading or program to run on the Pi?...Thanks!

    • @OriginalAJX
      @OriginalAJX 5 ปีที่แล้ว

      I use Termux (For Android) to SSH into my Raspberries when I need to. I think Apples's equivalent to this app is Blink, and according to google it can be used for SSH connections.

  • @davidbeiler6364
    @davidbeiler6364 5 ปีที่แล้ว

    what about humidity levels?

    • @PiddlerInTheRoot
      @PiddlerInTheRoot  5 ปีที่แล้ว

      The DS18B20 sensor does not measure humidity.

  • @SaifUllah-zs6vo
    @SaifUllah-zs6vo 5 ปีที่แล้ว

    sir! wich breakout board did you use? i mean is there is some special module?

    • @PiddlerInTheRoot
      @PiddlerInTheRoot  5 ปีที่แล้ว

      It usually comes with the sensor. You can find them on ebay.

  • @nvhustle190
    @nvhustle190 6 ปีที่แล้ว

    Hello, first off you are awesome been looking at your tutorials they are very helpful. I will like to know if you will be willing to help me out in a project Im currently working on. If you have an email or somewhere I can send you details that will be great. Is mainly on the programming the rasp and coding side. Hope to hear from you.

  • @kathiac3299
    @kathiac3299 5 ปีที่แล้ว

    Would this work with BeagleBone Black?

    • @PiddlerInTheRoot
      @PiddlerInTheRoot  5 ปีที่แล้ว

      Different setup and code, but yes the sensor should be compatible. www.bonebrews.com/temperature-monitoring-with-the-ds18b20-on-a-beaglebone-black/

  • @nickolasormond6637
    @nickolasormond6637 5 ปีที่แล้ว

    Can you post the model number for the breakout board?

    • @PiddlerInTheRoot
      @PiddlerInTheRoot  5 ปีที่แล้ว +2

      Hey Nickolas, the boards are unlabled. However, if you search "Ds18b20 Adapter Module" in ebay you should see them.

    • @nickolasormond6637
      @nickolasormond6637 5 ปีที่แล้ว

      @@PiddlerInTheRoot Thanks bud

    • @cvtierney
      @cvtierney 5 ปีที่แล้ว

      @@PiddlerInTheRoot Thank you!! i could not find just the board anywhere.

  • @tugratr8267
    @tugratr8267 7 ปีที่แล้ว +1

    Motor driver L298N Stepper motor driving please

  • @superfounder9918
    @superfounder9918 7 ปีที่แล้ว

    Hello , I did as shown in the video (i put the resistor) and when i put the codes it shows me that way w1_bus_master1 with no number , and if i take out the resistor i get 00.8xxxxxxxxx , some hel pplease?

    • @PiddlerInTheRoot
      @PiddlerInTheRoot  7 ปีที่แล้ว

      What is your resistor value? Check out this thread www.raspberrypi.org/forums/viewtopic.php?f=28&t=155941

    • @superfounder9918
      @superfounder9918 7 ปีที่แล้ว

      It's 4.6ohms

    • @edw4699
      @edw4699 6 ปีที่แล้ว

      that's a tadd low.pick 4.7 kiloohms

  • @legohistory
    @legohistory 5 หลายเดือนก่อน

    This did not work for me.

  • @DH-ik1vf
    @DH-ik1vf 4 ปีที่แล้ว

    How do I get the python script to run in the background permanently and to write the data to a log? I'm using a pi3 and running it headless to track the temperature and defrost cycle in my fridge

  • @georgezviadgoglodze7810
    @georgezviadgoglodze7810 5 ปีที่แล้ว

    Good JOB!

  • @RightToSelfDefense
    @RightToSelfDefense 6 ปีที่แล้ว

    Can't see your screen.

    • @simayaaaliyah3615
      @simayaaaliyah3615 6 ปีที่แล้ว

      set full screen and set quality to 1080p. Then you can read :)

  • @hariseldon2577
    @hariseldon2577 5 ปีที่แล้ว

    To explain the 4.7k resistor wiring th-cam.com/video/M_P9synPVcQ/w-d-xo.html