MAX31865 - Pt100 RTD module

Sdílet
Vložit
  • čas přidán 6. 09. 2024
  • In this video I show you how to use the MAX31865 platinum thermometer module with an Arduino. I tell you some general information about the platinum-based thermometers, how they work, I demonstrate some of the principles, then I show you a simple Arduino code. This thermometer is probably the most precise and accurate one among those which I have introduced on my channel so far.
    You can find other thermometers in this playlist:
    • Temperature measurement
    Please don't forget to subscribe!
    Schematics and source code: curiousscienti...
    If you want to support my work, please consider buying the parts using my affiliate links:
    curiousscienti...

Komentáře • 109

  • @parthmaheshwari3673
    @parthmaheshwari3673 Před rokem +1

    Fantastic video, explanation, and details. This helped me figure out that I was missing the dummy bytes in Line 115-116 for my firmware design. An explanation of why we need to use the dummy bytes (with reference to the SPI single-byte read diagram from the datasheet) would be an additional important detail, without which developing the firmware wouldn't be possible. Nevertheless, I was stuck on this for days and your video/code gave me the insight into the root cause. Thank you so much!

    • @CuriousScientist
      @CuriousScientist  Před rokem

      Thanks! That's why most of the time I try to write my own code instead of using libraries so I can understand the behaviour of the devices. It takes a bit more time, and I usually have to read the datasheet 10-20 times to fully understand it, but after that, I really know what I am doing. I am glad to hear that my in-depth explanation helped you to fix your firmware!

    • @parthmaheshwari3673
      @parthmaheshwari3673 Před rokem +1

      @@CuriousScientist Ah yes same here. I work with MATLAB/Simulink to design firmware so need to know the datasheet very well. Takes a lot of understanding and background knowledge but it's so worth it. In my free time I'm currently trying to design firmware to program a OLED display for a personal project. Do you have any plans to make a similar video explaining the details of OLED registers? Might be of interest to embedded developers who don't want to or cannot use libraries as it is something that's a missing resource.
      If you are ever looking for ideas for videos, another thing could be picking a sensor and explaining its datasheet in detail. Address registers, data registers, timing diagrams, MSB/LSB, etc. I was planning to do this for an I2C and a SPI sensor. I think it would be much appreciated by the embedded community as the heavy usage of libraries has resulted in all the details being ignored. Would love to know your thoughts too!

    • @CuriousScientist
      @CuriousScientist  Před rokem

      I have several videos where I wrote "raw code" for certain sensors just by following their datasheet. Mostly temperature sensors, but I have my own code for the HX711 module as well. Also, I think it is safe to say that I have developed the so far best Arduino library for the ADS1256 24-bit AD converter. I made a dedicated page for it on my website, and I have tons of videos on this specific AD converter. I even developed my own PCB for this AD converter. My library and videos on this device cover all the topics you mentioned: timing diagrams, registers, MSB/LSB...etc.
      Maybe a similar project I have done is based on the TCD1304 linear CCD. But that is not a published code, but it is a step-by-step tutorial on how to write a code. It is also written for STM32 HAL instead of Arduino.
      On the other hand, I am probably not the best person to develop libraries. I am not a software developer, I just do these things out of my own interest and for my own fun. I have so many other topics where I am much more experienced and knowledgeable, so I would rather spend time with those things. OLED registers are pretty far from my area of expertise.

    • @parthmaheshwari3673
      @parthmaheshwari3673 Před rokem +1

      @@CuriousScientist Thanks for your thoughts! I look forward to checking the videos and resources out that you mentioned, and for your future videos too. Thank you for your services and providing knowledge to all that are interested :)

  • @markhannibal5434
    @markhannibal5434 Před 2 lety +1

    Very well explained . Thank you for taking the time to create this video.

  • @qzorn4440
    @qzorn4440 Před 2 lety +1

    very well explained, i have a similar device however it uses modbus rtu rs485 serial communication 😊 thank you

  • @t.l.b6940
    @t.l.b6940 Před 5 měsíci

    thank god i found this , i was going mad , great explenation.

  • @emilrudnicki7607
    @emilrudnicki7607 Před 2 lety +1

    19:11 you need to switch CS high because max wont set config reg to start the conversion, then switch it back to begin reading process

  • @avadhitrivedi8037
    @avadhitrivedi8037 Před 8 měsíci +1

    very nice explanation. Thanks a lot ,it really helped.

  • @moazmousad2938
    @moazmousad2938 Před 8 měsíci +1

    Does the sensor need calibration or just programming ?

    • @CuriousScientist
      @CuriousScientist  Před 8 měsíci

      If you accept the factory calibration, then just use my code, and that's all. It is good enough for everyday use.

  • @sanjaybatra6593
    @sanjaybatra6593 Před 2 lety

    My Question is :
    Suppose you have connected TWO MAX31865 Chip and ONE LCD 16X2 , to ATMEGA328P. These devices can share few common ATMEGA328 pins like
    MISO, MOSI, CS, SCK etc etc
    1. MAX31865 pins (10, 11, 12, 13 )
    2. MAX31865 pins (10, 11, 12, 13 ) ????
    3. MISO/rs=12, MOSI/en=11, d4=5, d5=4, d6=3, d7=2;
    How do we will allocate pins to different devices ??

    • @CuriousScientist
      @CuriousScientist  Před 2 lety

      Hi! You just need to follow the rules of SPI. MISO, MOSI, SCK is shared and each chip has its own CS (chip select) pin. Then you just select one of the chips by reaching out to it via its CS pin. The LCD cannot use these pins as typically they are sold with a presoldered i2c board. The 16x2 LCD would use the SDA (A4) and SCL (A5) on an Arduino Uno/Nano.

    • @sanjaybatra6593
      @sanjaybatra6593 Před 2 lety +1

      @@CuriousScientist thanx for quick and fast response.
      what I understand is : MISO, MOSI, SCK can be common to multiple devices but each device has its own CS pin to make device active when required.
      we can also use multiplexer ?

    • @CuriousScientist
      @CuriousScientist  Před 2 lety

      @@sanjaybatra6593 Yes, MISO, MOSI and SCK is shared between multiple SPI devices and the active device (as the name suggests) is selected by the chip select (CS) pin. There is no need for multiplexing SPI pins.

  • @isidoromaich7226
    @isidoromaich7226 Před 3 lety +2

    Can you make this thing that I need, the way I need it? Wait, it will be even better if you can build it and send it to me, I can give you a thumbs up, thanks. LOL
    Now, seriously, excellent video, thanks for the insight on platinum-based thermometers.

    • @CuriousScientist
      @CuriousScientist  Před 3 lety

      Haha, some requests are ridiculous sometimes. Anyway, Pt100 sensors are really interesting and it's nice to know how they differ from the other type of thermometers.

  • @gilangardiansyah3711
    @gilangardiansyah3711 Před 3 lety +1

    I beg you to help me, why is the temperature reading always -242? the connection between the RTD and the max31865 module is just plugged in or soldered?

    • @CuriousScientist
      @CuriousScientist  Před 3 lety

      I don't know how many more CZcams accounts you will use for asking the same question. Now I assembled the same circuit again, used the same code and I am getting proper temperatures. Did you follow the schematics and the code properly? As I said earlier, if you get -242, it means that the Rt (resistance) was zero. Which also means that something might have gone wrong in the readRegister function. I suspect that there's no communication between the module and the Arduino, so it receives zeroes.

  • @ekosusanto8556
    @ekosusanto8556 Před 7 měsíci

    very well explained, I have a similar device but I want to make a sensor with copper and nickel, can you explain which parts I should change? This is for my school assignment

    • @CuriousScientist
      @CuriousScientist  Před 7 měsíci

      Thanks! Sorry, I won't solve your school assignment for you. Also, what do you mean by making a sensor with Cu and Ni? If you are referring to a thermocouple, then it's an entirely different principle as this RTD thermometer.

    • @ekosusanto8556
      @ekosusanto8556 Před 7 měsíci

      @@CuriousScientist sorry, I didn't mean it like that, and thank you for your reply, so should I use the thermocouple principle? not RTDs?

    • @CuriousScientist
      @CuriousScientist  Před 7 měsíci

      Well, you still haven't explained how and where the Cu and Ni come into the picture. So I can only repeat what I said before. I am not a wizard, I can not figure things out without the necessary information.

    • @ekosusanto8556
      @ekosusanto8556 Před 7 měsíci

      @@CuriousScientist I plan to make a temperature sensor with CU and NI, because it is very easy to get at my place, and I plan to use the RTD principle, but after I studied the resistance of CU and NI it is very small than platinum, so can I use the RTD principle to That?

    • @CuriousScientist
      @CuriousScientist  Před 7 měsíci

      No, you can not use RTD. At least not in an easy way. Why don't you just buy a thermocouple? They are dirt cheap. Or if you must go with the two wires, since they are dissimilar metals, they will act as a thermocouple and you can use them as thermocouples. However, you will need to calibrate it somehow. I am not sure if you can find a lookup table for them. Type T thermocouple is close to it, but it is not the same. It is not pure Cu and pure Ni. It is Cu and Cu+Ni (constantan).

  • @eng1897
    @eng1897 Před 3 lety +1

    thank you so much ,,
    excuse me I have a question do RTD need special wire?? or just wire ordinary??

    • @CuriousScientist
      @CuriousScientist  Před 3 lety

      Hi and you are welcome! I don't exactly understand the question. The specific Pt100 probe I used came with the wire as well. But if you have a Pt100 probe somewhere laying around without any cables, technically you can use any wires. Thank to the method how the module measures the resistance change of the Pt100 probe, the resistance of the wires are cancelled out. Nevertheless, I recommend using some good quality wires, just to be sure.

  • @rustamefendi2701
    @rustamefendi2701 Před 9 měsíci

    Can we make data logger? I have problem when I input #Include , can't work

    • @CuriousScientist
      @CuriousScientist  Před 9 měsíci

      It can be made into a data logger with an SD card, sure. I don't know why it is not working for you.

    • @teknikmesinunsultra5009
      @teknikmesinunsultra5009 Před 9 měsíci +1

      Thank you@@CuriousScientist. I've encountered a problem; the issue is that the 0.96-inch OLED display doesn't work when combined into a data logger. The hardware I'm using consists of two Adafruit MAX31865 amplifiers, a Data Logger Shield (equipped with an RTC and an SD card module), and a 0.96-inch OLED display. The OLED display doesn't function, so I replaced it with a 16x2 character LCD display.

    • @CuriousScientist
      @CuriousScientist  Před 9 měsíci

      It is good to hear that you were able to make it work with a 16x2 display. Actually, they are faster than the OLED, so if it works for you well, then perhaps it is even a better choice.

  • @ezz6928
    @ezz6928 Před rokem

    first of all thank you so much for this incredible work you're doing!
    I would really appreciate if you could take a look at this problem:
    I have the same components but I use a different board:
    Board: NUCLEO-F767ZZI + MAX31865 + PT100 (4 wires)
    here is the code I wrote based on your video:
    #include "mbed.h"
    #include
    #include
    #include
    SPI spi(PB_5, PB_4, PB_3,PA_4);
    DigitalOut cs(PA_4);
    double resistance;
    uint8_t reg1, reg2; // reg1 holds MSB, reg2 holds LSB for RTD
    uint16_t fullreg; // fullreg holds the combined reg1 and reg2
    double temperature;
    // Variables and parameters for the R - T conversion
    double Z1, Z2, Z3, Z4, Rt;
    double RTDa = 3.9083e-3;
    double RTDb = -5.775e-7;
    double rpoly = 0;
    int main() {
    while (true) {
    //spi.lock();
    spi.format(8, 1);
    spi.frequency(1000000);
    cs = 0;
    spi.write(0x80); // 80h = 128 - config register
    spi.write(0xA0); // B0h = 10100000bias ON, 1-shot, start 1-shot, rest are 0
    cs = 1;
    cs = 0;
    spi.write(1); // we want to read the first register
    reg1 = spi.write(0xFF); // dummy data: read part 1 of the first register
    reg2 = spi.write(0xFF); // dummy data: read part 2 of the first register
    cs = 1;
    // combinate reg1 and reg2
    fullreg = reg1; // read MSB
    fullreg = 1; // shift D0 out
    resistance = fullreg; // pass the value to the resistance
    cs = 0;
    spi.write(0x80); // 80h = 128
    spi.write(144); // 144 = 10010000
    //spi.unlock();
    cs = 1;
    printf("Temp=%f
    ", resistance);
    }
    }
    At first I only want to read the RTD resistance (ADC CODE) measured by MAX31865. However, I’m getting a value of 27300, where it should be around 8900 based on table 9 (source: MAX31865 datasheet). Which means my temperature values after the conversion will surely be false as well.
    do you have any ideas about this?
    best regards,
    ezz

    • @ezz6928
      @ezz6928 Před rokem

      I just solved the problem by changing this line " spi.write(144);" to " spi.write(160);"
      160 = 10100000, which matches my 4-wire config
      but did you actually use 144 and not 176 = 10110000?

    • @CuriousScientist
      @CuriousScientist  Před rokem +1

      @@ezz6928 Yeah, I guess it is very useful if you use the code according to your configuration. :) I clearly explained the value of that register @18:30 . If you have 2/4-wire config, D4 must be 0.

  • @karuicote7129
    @karuicote7129 Před 5 měsíci

    Can you explain for me mean of "max.temperature(RNOMINAL, RREF)" please?

    • @CuriousScientist
      @CuriousScientist  Před 4 měsíci +1

      Hi! Where do you see that in my code? I cannot find it.

    • @karuicote7129
      @karuicote7129 Před 4 měsíci

      ​@@CuriousScientist Sorry for the confusion, but may I ask why you don't use max.temperature(100,430);(it contain in max31865 library) instead of using mathematical calculations
      2 ways have diffrent?

    • @CuriousScientist
      @CuriousScientist  Před 4 měsíci

      @@karuicote7129 I wrote my own code, I am not using any library. 😎

  • @cringecorner6828
    @cringecorner6828 Před 9 měsíci

    i want to ask tho, how do you read the resistance changes in a digital pin?

    • @CuriousScientist
      @CuriousScientist  Před 9 měsíci

      You don't. The module passes some known current through the probe and then measures the resulting voltage. Then this voltage is used to calculate the probe's resistance.

  • @hardikshah1792
    @hardikshah1792 Před 3 lety +1

    Hi. I want to use 6 pt100 3 wire all together. What should I do further? Can you please help in coding and connecting circuits

    • @CuriousScientist
      @CuriousScientist  Před 3 lety +1

      Hi! Since it is a standard SPI circuit, you just connect all of them to the same MOSI, MISO and SCLK pins and assign separate CS pins for each one of the 6 Pt100 units. Then, whenever you pull one of the CS pins low, the corresponding unit will start to communicate with the microcontroller. After the reading is finished, you pull the CS high and select another Pt100 unit by pulling its CS low. You can do this in a loop, store the values in an array and just iterate through the 6 pins and array items. I hope this helps.

    • @hardikshah1792
      @hardikshah1792 Před 3 lety

      @@CuriousScientist Yes. I can do that, can you please give me your email so I can send email if any query regarding code?

    • @CuriousScientist
      @CuriousScientist  Před 3 lety +1

      I am not a free support service. I am sorry but I am not doing consultation for free.

  • @pengejarcitacita
    @pengejarcitacita Před 10 měsíci

    Thanks for the explanation
    I want to ask you something. I did the same thing with you, but the temperature measurement by the RTD Sensor is always 9.38 and Resistance is always 32640 doesn't change at all, what do you think is wrong? maybe you can provide a solution. thank you.

    • @CuriousScientist
      @CuriousScientist  Před 10 měsíci

      Hi! Are you using the _exact same_ configuration? What does the probe look like? 2, 3 or 4 cables? Is the module set up accordingly?

  • @rodrigodebenavente8870

    Hi. I made it work. However, after the first set of measurements, the device sends random symbols. I'm looking at it through the serial monitor and I can't figure out where the problem is. By the way, I used the same code without modifications, to see if the system worked. I would really appreciate if someone could give me a hand.

    • @CuriousScientist
      @CuriousScientist  Před 2 lety

      Hi! Do you use the _exact_ same setup? Same hardware and so on? I haven't noticed this issue so I cannot really imagine the cause of it. Do you have the same baud rate on the terminal as in the code?

  • @jameswarren1831
    @jameswarren1831 Před 2 lety

    Is it possible to connect 2 Max31865's to one Arduino controller? Is there any chance you might make a video with the MAX31865 with a PID output for use with an SSR? There might be some interest as the only project I found was a PWM output for a smoker.

    • @CuriousScientist
      @CuriousScientist  Před 2 lety +1

      Yes, it is possible. It is an SPI device, so you can use multiple of them. Unfortunately, I don't know what SSR is. Also, I don't make videos on request for free because my schedule is very limited.

  • @adhibanr6479
    @adhibanr6479 Před rokem

    Sir is it possible to measure the temperature by using ESP32 , PT100 , MAX 31865 these three (Without using arduino) by using MicroPython Sir ?

  • @Johann75
    @Johann75 Před 8 měsíci

    What is the reading speed?

    • @CuriousScientist
      @CuriousScientist  Před 8 měsíci

      It is in the datasheet of the chip. Google it.

    • @Johann75
      @Johann75 Před 8 měsíci +1

      @@CuriousScientist , for max31865 max. 21ms and for max6675 from 100 to 230 ms average 170

  • @hardikshah1792
    @hardikshah1792 Před 3 lety

    Can you please make 4 channel pt100 data logger??

    • @CuriousScientist
      @CuriousScientist  Před 3 lety +1

      Why do you ask the same question again? As I said it under the other video, if you buy me all the components, I am glad to make one and present it.

  • @semsettinsevinc8807
    @semsettinsevinc8807 Před 2 lety

    hi I have arduino klon ch340 . I would like to have temperature controlled relay activation project. I am very new about arduino. I have max31865 + 2 wire PT100 thermokupl + OLED display + SRD 05VDC SLC relay. How can I connect them and should I use any capacitors and resistance.

    • @CuriousScientist
      @CuriousScientist  Před 2 lety

      Hi! There is no need for extra components like capacitors and resistors.

    • @semsettinsevinc8807
      @semsettinsevinc8807 Před 2 lety

      @@CuriousScientist thank you. should I connect 2 wire PT100 red cable RTD and white cable RTD - on MAX31865.
      and MAX31856 VIN ; GND ; 3V3 ; CLK ; SDO ; SDI ; CS ; RDY where should I connect on arduino.

    • @semsettinsevinc8807
      @semsettinsevinc8807 Před 2 lety

      red cable RTD (+) white cable RTD (-)

    • @CuriousScientist
      @CuriousScientist  Před 2 lety

      Everything is explained in the video, why don't you watch it?

  • @maharanisinta3279
    @maharanisinta3279 Před 3 lety

    if i have an RTD with 2 blue wires and 1 red wire will the connection to max31865 stay the same?

    • @CuriousScientist
      @CuriousScientist  Před 3 lety

      Probably yes. But I would recommend checking the resistance between the wires. One pair should be somewhere around 102 Ohm and the other pair should be 2 Ohm. Then you can connect them accordingly. I also recommend you to check Adafruit's tutorial on this topic as they have really nice explanations and a lot of pictures.

    • @maharanisinta3279
      @maharanisinta3279 Před 3 lety

      @@CuriousScientist I've measured it and it's 102 Ohm and 2 Ohm, but I don't know which pair it should go to

    • @CuriousScientist
      @CuriousScientist  Před 3 lety

      The 2 Ohm part goes to F+ and RTD+, and the third wire goes to RTD-.

    • @maharanisinta3279
      @maharanisinta3279 Před 3 lety

      @@CuriousScientist okay sir, thanks for your help

    • @CuriousScientist
      @CuriousScientist  Před 3 lety

      You're welcome! I hope it works now.

  • @sanjaybatra6593
    @sanjaybatra6593 Před 2 lety

    which device more reliable ?
    PT100
    or
    ds18b20 (waterproof )
    PT100 can be replaced with ds18b20 ?
    Actually MAX31865 is not easily available.

    • @CuriousScientist
      @CuriousScientist  Před 2 lety

      You can't even compare them. Pt100 is a much more superior thermometer by design. Better precision, better temperature range, better response time...etc. DS18B20 is a semiconductor-based thermometer. It has it's own advantages, but since you asked which is more reliable, I say Pt100 is easily much-much more reliable.

    • @sanjaybatra6593
      @sanjaybatra6593 Před 2 lety +1

      @@CuriousScientist thanx a lot sir

    • @CuriousScientist
      @CuriousScientist  Před 2 lety

      You're welcome!

  • @alinaasyari9846
    @alinaasyari9846 Před 3 lety

    Thanks for the explanation
    I want to ask you something. I did the same thing with you, but the temperature measurement by the RTD Sensor is always -242 and doesn't change at all, what do you think is wrong? maybe you can provide a solution. thank you.

    • @CuriousScientist
      @CuriousScientist  Před 3 lety

      Hi and welcome! If you receive -242, then the number received from the module is zero. Somewhere something is wrong with the connection. Check with some extra serial.println() if there is reading coming from the module.

    • @alinaasyari9846
      @alinaasyari9846 Před 3 lety

      @@CuriousScientist I have done it and still no change. I'll check the connection again. Thank you for the help

    • @CuriousScientist
      @CuriousScientist  Před 3 lety

      Did you connect the RTD properly? If it is connected wrong or not connected at all, you also get -242.

    • @alinaasyari9846
      @alinaasyari9846 Před 3 lety

      @@CuriousScientist Does this mean there is no problem in adafruit but in RTD connection? I connected the first blue wire to F+, the second blue wire to RTD+ and the red wire to RTD-, is this correct?

    • @CuriousScientist
      @CuriousScientist  Před 3 lety

      Theoretically, it is correct, but you should always measure the resistance values between the pins to make sure you connect them where they belong. Sometimes color coding is not reliable. Also I hope you soldered the 2/3 wire tab and cut the other tab and soldered it too. Next to the flower print on the pcb.

  • @JnanaPhaniAmbadipudi
    @JnanaPhaniAmbadipudi Před 5 měsíci

    18:16:52.927 -> Resistance: 0.00
    18:16:52.927 -> Temperature: -242.02
    But when I run your code I'm getting this kind of output

  • @khadijalahrouni5386
    @khadijalahrouni5386 Před rokem

    Hello every one, please I need to use the max31865 with a raspberry pi 3 B + and I don't have any idea on how to do so, I'm new to this . if anyone could help I would appreciate it. thank you