DS18B20 Arduino Temperature Sensor - How to Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 ก.ย. 2018
  • Using the DS18B20 one wire digital temperature sensor is easy with some Arduino libraries to provide a simplified interface. Configuring the device and retrieving temperature data are very fast and simple.
    The waterproof probe version is tested here and we compare the probe against a K type thermocouple in ice water, hot water, and at room temperature in air.
    Sketch and Schematic: github.com/GadgetReboot/Ardui...
    There are 2 versions of the sketch, one using OLED display and one just using serial monitor if you just want to get the sensor working.
    Required DS18B20 libraries for OLED, OneWire Bus and DallasTemperature Sensor:
    github.com/adafruit/Adafruit_...
    github.com/PaulStoffregen/One...
    github.com/milesburton/Arduin...
    DS18B20 Datasheet:
    datasheets.maximintegrated.co...
    Patreon: / gadgetreboot
    Pinterest: www.pinterest.ca/GadgetReboot
    Twitter: @GadgetReboot / gadgetreboot
  • วิทยาศาสตร์และเทคโนโลยี

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

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

    Nice. Always glad to see a new video on your channel.

  • @ryanrinn4041
    @ryanrinn4041 11 หลายเดือนก่อน +1

    Thank you for explaining that in such detail. I found your video useful

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

    Useful video 👍 Excellent 👍

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

    Thank you very much for your sharing. But I have a problem when I verify the code that " no matching function for call to 'Adafruit_SSD1306::Adafruit_SSD1306(int)' ". Could you please help me to solve this problem?
    Thank you for your support

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

    Hi! Is it possible to use this device on other controler like stm32f446RE with the same library as you used? I'm quite unfamilliar with I2C comunication and your library look user friendly. Thank you in advance!

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

    Brilliant video

  • @malapropism9036
    @malapropism9036 4 ปีที่แล้ว +3

    It's naturally slower than the thermocouple, because the sensor's heat transfer function is a function of specific heat, mass of the sensor, surface area of the heat sensing element, i.e., the time constant (time it takes to reach 63% of equilibrium condition).

    • @a1nelson
      @a1nelson 2 ปีที่แล้ว

      Yeah, those are important. The thermal mass of the sensor and its metal can are likely much larger than the little thermocouple - even with their wires (which are probably of similar gauge). I would have preferred to have seen both fully submerged, as the heat transfer would have been faster, reaching equilibrium sooner, and the readings a touch more accurate, as the Dallas sensor wouldn’t have been influenced by the ambient air and/or ice (if the ice and water hadn’t yet agreed on 0C). Of course, doing so might have shorted the sensor, given it’s iffy seal - a situation unlikely to yield good results.

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

    hiee bro i need your help. I am using this sensor, for the first time it worked perfectly but after that, I had cut the wire to solder jumper wires but after soldering it is showing -126 degree celcius only. How to resolve this??

  • @rezaainur3299
    @rezaainur3299 4 ปีที่แล้ว +2

    Thanks for your demo video for DS18B20 sensor, Sir. I want to ask, can the DS18B20 sensor measure the temperature for soil ?
    Thank you...

    • @GadgetReboot
      @GadgetReboot  4 ปีที่แล้ว +1

      I don’t know if the metal cover would corrode in the soil and I also wouldn’t trust the existing black sleeve to be completely waterproof where it ends, so I would probably coat the exposed metal With either epoxy or silicone sealant to cover the metal and go partway on the sleeve to seal that area. Then I would also coat the other end of the black sleeve where it meets with the rest of the cable so the metal is now covered and what looks like black heat shrink tubing on my probe at least, is sealed on both ends of it.

    • @rezaainur3299
      @rezaainur3299 4 ปีที่แล้ว +1

      ​@@GadgetReboot Ohhh, I see, i didn't think about the corrosion before, thanks for your suggestion. One more question Sir, will the silicone reduce capability of the sensor ?

    • @GadgetReboot
      @GadgetReboot  4 ปีที่แล้ว +2

      I’m not sure to what extent the sensor will change its profile such as becoming slower to respond to changes or being less able to discern between steps in temperature changes but for measuring a slow environment like soil temperature it probably doesn’t need to be so accurate or fast responding so if I were doing it I would apply just a thin coat to provide some protection with minimal obstruction and then test it out and re-characterize it and go with that.

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

      @@GadgetReboot Ohh I understand, thanks a lot Sir for your explanation ! I will try to implement your suggestion with DS18B20 sensor.

    • @a1nelson
      @a1nelson 2 ปีที่แล้ว

      @@GadgetReboot Totally agree. The thermal mass of the soil is huge compared with the sensor. So, the signal output will change _very slowly - just like the soil.

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

    thank you very
    much

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

    what is the difference between sensor DS18B20, DS18S20, DS1822, DS1820?

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

    where did you simulate the circuit?

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

    Are you able to "extend" probes to put them in different corners of a room (for instance)?

    • @a1nelson
      @a1nelson 2 ปีที่แล้ว

      Yes, but if you may need one or more transceiver to buffer (boost and sharpen) the data signal. Also, the greater the distance, the more susceptible the data signal may be to interference. So, I’d recommend the 4-wire version mentioned in the video, with the shield grounded. This is pure speculation, but the voltage drop associated with long, thin wires may result in inaccurate readings. This could largely be resolved by running sufficiently larger gauge wire (e.g. 18ga). Keep in mind that you can use this wire to power the transceivers. Powering the sensor with the highest voltage your MCU/Arduino supports would mitigate the potential issue with voltage drop.

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

    I really like to know how to use the parasitemode. Coz I you read about this mode every where so asumed it was a working mode. I allready have the 2 wire connectors in place and I do not have 3 wire connectors or cables. You hinted that you need 2 arduino pins to control the pull up and thats fine. Any suggestions whee I can find arduino examples that work in parasite mode?

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

      I looked at parasite mode here th-cam.com/video/145ml4ii1ao/w-d-xo.html

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

    sir i have arduino mega and temperature sensor (ds18b20) and a lcd 1602A sir please tell me how to connect all these which shows temperature on lcd please sir help or give me a link

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

      I think I will actually try to quickly put together a video to do that because I’ve worked on the temperature sensor in one project before and used that LCD in a different project so I will see if I can put something together and do a video in the next couple of days.
      Does the 1602 LCD you have use a serial interface or does it just have all those 16 or so pins only?

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

      I put together a demo
      th-cam.com/video/lr1x96s3TKY/w-d-xo.html

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

    hello sir.. i don't have OLED display, please give me code temperature sensor (ds18b200) without OLED display but i can see temperature in serial monitor. thank you

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

      I just edited the OLED sketch and made it serial monitor only and uploaded that new sketch. Try that.
      github.com/GadgetReboot/Arduino/tree/master/Uno/DS18B20_Temp_Sensor

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

      @@GadgetReboot it's work well, thank you very much sir

  • @michaelgaul2244
    @michaelgaul2244 4 ปีที่แล้ว +1

    i want to add a relay to this to turn on a pump when the water teemp drops below a set point. is it possible?

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

      If the relay can handle switching the pump and it just needs the coil actuated, then if there is a transistor driver circuit to handle that and allow logic level on/ off control, then the Arduino can turn the relay on and off anytime it wants and that can occur when the temperature is below a certain level.
      There are some Arduino compatible relay boards out there that might be suitable for switching AC loads.

    • @michaelgaul2244
      @michaelgaul2244 4 ปีที่แล้ว +1

      @@GadgetReboot thanks. its just a 12v dc pump.

    • @a1nelson
      @a1nelson 2 ปีที่แล้ว

      @@michaelgaul2244 sorry if this sounds too pedantic, but don’t forget the flyback diode on the control circuit/s. Both the pump and the relay primary can create a large spikes when they’re turned Off - leading to premature death of your relay (secondary, due to bounce pitting) and/or Arduino. A zener & switching diode combo is also popular. Watch the voltage ratings for the diode/s.

  • @yasmineyachmina8898
    @yasmineyachmina8898 4 ปีที่แล้ว +3

    hello sir, I have a problem that my Ds18b20 sensor always displays on the serial monitor -127.00 and I don't know where the fault is

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

      I had this, I think flipping the SDA and SCL into the board fixed this for me.

    • @vic-san12
      @vic-san12 3 ปีที่แล้ว

      same here. i tried this today at december 7, 2020. got this problem too.

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

      @@vic-san12 send me ur email i will send uo a program

    • @vic-san12
      @vic-san12 3 ปีที่แล้ว

      @@yasmineyachmina8898 fixed my problem. I just need to install the library. thank you for taking the time to reply tho. really appreciated

    • @geraldojim7356
      @geraldojim7356 2 ปีที่แล้ว

      @@vic-san12 which library did you install ?

  • @MuhammadAkbar-ij4lm
    @MuhammadAkbar-ij4lm 4 ปีที่แล้ว +2

    I have some problems when i get data from sensor. It always show -127 celcius can you give me the solution??

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

      me too the same probleme

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

      Same problem. Were you able to figure out what’s wrong!

    • @MuhammadAkbar-ij4lm
      @MuhammadAkbar-ij4lm 3 ปีที่แล้ว

      @@cdavid0624 i already solve this issue. You need to put resistor 5k on 5v connection on ds18b20 and Arduino

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

    What kind of pullups? I didn't hear any numbers nor see any on the datasheet

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

      On the project schematic it shows 4.7K raw.githubusercontent.com/GadgetReboot/Arduino/master/Uno/DS18B20_Temp_Sensor/DS18B20_Schematic.jpg
      and the datasheet says on page 10 the pull up is around 5K datasheets.maximintegrated.com/en/ds/DS18B20.pdf

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

    i have a project " contoling system of climatisation with arduino uno and ds18 and wifi card " i have some difficult can u help me pliz ?

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

      I don’t know how much help I can give, what is the Wi-Fi card? I have only used Wi-Fi with ESP 8266. What does the project need to accomplish?

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

      @@GadgetReboot i have a problem with the creaction of application on Android to remote the system .. thnx so much

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

    Can we use modbus protocol for ds18b20 with arduino?

    • @a1nelson
      @a1nelson 2 ปีที่แล้ว

      If you’re talking about the Modbus serial protocol, then the Arduino should have no problem with that at all. If you’re interfacing with other devices, such as a PC or PLC, you’ll almost certainly need an RS232 or RS422 driver on the Arduino serial lines to boost the signal and make the signal differential. Take a look at the MAX232 series. They’re easy to use and, last time I looked, they were still available in DIP packages. Pro tip: add a TVS diode array or low capacitance, high-voltage capacitors on the signal lines (on the 232/422 side). This will reduce sadness caused by the discharge of static electricity, nearby motor coils, long wires and the like.
      If you’re talking about Modbus TCP, then you’ll need a serial-to-Ethernet module. They’re also readily available and straightforward to use. For those, take a look at ones based on the WizNet 5500.

  • @priyanujborthakur5519
    @priyanujborthakur5519 4 ปีที่แล้ว +1

    Can this sensor be used to measure the human body temperature accurately?

    • @GadgetReboot
      @GadgetReboot  4 ปีที่แล้ว +1

      This sensor can have an accuracy up to +/ -0.5°C and to properly measure the temperature of something, I would think the entire sensor should be immersed in the environment being measured so that other ambient temperatures don’t interfere, so it depends how the sensor is going to be measuring the temperature. If it is just being pressed against something then it’s partly measuring the room and partly measuring what it’s pressed against.

    • @a1nelson
      @a1nelson 2 ปีที่แล้ว

      I’m tempted to make a joke, but seriously, it depends on where is the probe is placed. This would be no different from a typical thermometer place under the tongue, in the armpit or inserted rectally.

    • @a1nelson
      @a1nelson 2 ปีที่แล้ว

      The resolution is adjustable. According to the data sheet, it can be operated with a resolution from 0.5 C to 0.0625 C by changing the requested bit depth, from 9-bit through 12-bit, as shown. Presumably, the speed (sampling rate) and repeatability (noise) are influenced by the resolution setting. As with nearly _all temperature sensors, accuracy beyond ~0.5 C requires calibration. The method shown in the video, using ice water (at equilibrium) and boiling water (actually boiling) is a very common technique used for this purpose. Then, using the initial measurements obtained, output from the sensor can then be scaled (aka interpolated) to obtain the actual, real-world temperature.

    • @a1nelson
      @a1nelson 2 ปีที่แล้ว

      @@GadgetReboot Totally agree. Respectfully, I wonder if the response time and accuracy of the Dallas probe in the video was influenced by the probe not being fully submerged (and completely below the ice) like the thermocouple.
      Edit: to be effective, the sensor not only needs to be fully immersed, but it also needs to be given time to reach a point of stability/equilibrium. Given the probe’s relatively large thermal mass, this will take longer than a small thermocouple or a drugstore thermometer.

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

    why it don't know the address when i open serial monitor

    • @GadgetReboot
      @GadgetReboot  4 ปีที่แล้ว +1

      Is there a pull up resistor on the data line?

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

    Plz help sir, i have some problem here. why my measurement result is -127?

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

      have you resolve it? i have same problem

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

      @@adisurya6408 me too i have the same probleme

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

      Make sure the temp sensor is connected and has power as i had this problem and found my sensor had no power dur to a bad crimp in one of the dupont connectors i have used after replacing the connector it worked ok after.

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

    There is a library that support parasitic with 1 gpio, and another that supports parasitic without a resistor milesburton/Arduino-Temperature-Control-Library , bigjosh/OneWireNoResistor, I had moderate success with them. But I know there is 2 versions of these s model maybe

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

      I guess there’s a way to make use of the single GPIO to do the parasitic feature if it’s sitting idle anyway during that time. I’ll check it out at some point. It would be fun to get it working that way and to possibly use the knowledge to be creative with GPIO pins in other projects too. Thanks.

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

    Can this be done with 14 thermometers?

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

      www.instructables.com/Multiple-Fermenter-Temperature-Control-With-Arduin/
      Yes i think that is possible becuase that link suggests that they want to control temperatures of multiple fermenters

    • @a1nelson
      @a1nelson 2 ปีที่แล้ว +1

      Beware: of the most common libraries has an arbitrary limit of eight sensors. However, the protocol from the data sheet appears capable of having an absurdly large number of sensors - like trillions (only on paper, of course). 14 seems totally reasonable, once the driver code is tweaked from 8 to, say, 16.

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

    Sir , may i get code for this project

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

      The link to the sketch is in the description

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

    what resistor i need

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

      4.7K worked for me

    • @carljavier5248
      @carljavier5248 4 ปีที่แล้ว +1

      Oled display Temp: -127.0 c only.

    • @carljavier5248
      @carljavier5248 4 ปีที่แล้ว +1

      help

    • @carljavier5248
      @carljavier5248 4 ปีที่แล้ว +1

      im using arduino arduino uno r3 atmega 328, OLED Display Module 128X64 I2C SSD1306 12864 LCD Screen Board GND VDD SCK SDA for Arduino

    • @GadgetReboot
      @GadgetReboot  4 ปีที่แล้ว +2

      @@carljavier5248 It sounds like the data isn't being read so it's the default reading. Do you have an extra sensor? It could be bad. It would also help to see some sort of wiring diagram - what GPIO pin is the sensor on? Do you have an oscilloscope to look at the data signal to see if it's communicating?

  • @user-uz1bj4mc3o
    @user-uz1bj4mc3o 3 ปีที่แล้ว

    I need a code.
    Who knows let him write a code

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

    please help me brother