Arduino, Thermocouples, MAX6675 and SPI - The Fine Points

Sdílet
Vložit
  • čas přidán 11. 07. 2024
  • Just install the library and you’re done. Or so you might think …
    ↓↓↓ Complete description, time index and links below ↓↓↓
    You want to measure temperatures up to 1.000°C/1.800°F with an Arduino? Use a MAX6675 thermocouple-to-digital module! They’re a cheap, supported and easy solution, featuring a SPI-compatible interface.
    However, the raw data from the MAX6675 needs some filtering. And while there is a MAX6675 library available for the Arduino, there are reasons not to use it. Also, be aware of shorts you might create using multiple thermocouples.
    00:00 Intro - where I left off during a mailbag video
    02:02 Code and circuit - from the internet: fast and easy
    05:06 Data - lots of noise and not very precise
    08:55 Filtering - a simple (modified) moving average does the job
    13:29 Timing - the MAX6675 is not the fastest
    18:18 Multiplying - the number of sensors, because it’s easy enough
    23:26 Shorting - things out using thermocouples
    29:19 Rewriting - the Arduino MAX6675 library for real SPI
    Tutorials: • Tutorials
    Mailbag: Hot Plate, Arduino Nano, Thermocouple, MAX6675 Module and More • Mailbag: Hot Plate, Ar...
    #robertssmorgasbord #tutorials #tutorial #how-to #Arduino #thermocouple #MAX6675 #SPI
  • Věda a technologie

Komentáře • 159

  • @andymouse
    @andymouse Před 4 lety

    I came back to this one for a refresher!...Its a favorite because it has so much info about the module that is hard to find...cheers.

    • @robertssmorgasbord
      @robertssmorgasbord  Před 4 lety +1

      As always, you're welcome!
      BTW I'm currently shooting an addendum to this and two other videos. It will focus on the additional current/power requirements for the digital isolation (of the MAX6675).

  • @poirou9110
    @poirou9110 Před 2 lety +2

    Cannot even describe how helpful this video is. Thank you very much

  • @nalinux
    @nalinux Před 3 lety

    I love your meter !
    I had the Dm27XL :)
    Worked correctly for 30 years before I lost it.

    • @robertssmorgasbord
      @robertssmorgasbord  Před 3 lety

      Yeah, those Backman DRMs were not bad. And while they are no longer available, you can still get repair and calibration services for them.

  • @lampartzjardu7734
    @lampartzjardu7734 Před rokem

    Thank you so much for this tutorial. You much speeded up my project

    • @robertssmorgasbord
      @robertssmorgasbord  Před rokem

      You're very welcome! I'm always happy when my videos are helpful to somebody 🙂

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

    Great video - 14k views and only 226 likes?? I don't get it - this was a wonderfully clear and helpful video - it should have at least 5000 likes by now.

    • @robertssmorgasbord
      @robertssmorgasbord  Před 3 lety

      Thanks for the praise! From what I'm seeing the ratio between view and likes is always very low on CZcams (1% to 5%). But you're right, the video could have gotten more likes by now. Not quite 5000 but maybe 1000.

  • @Alkz774
    @Alkz774 Před 5 lety +2

    Great tutorial! Thank you!

  • @e.a.debeijer1376
    @e.a.debeijer1376 Před 4 lety

    Thank you very much for this informative video. I am a NOOB when it comes down to electronics but i am able to apply "The science" when it has been shown to me :) This helps me a lot in further building my smoker temperature meter where i want to be able to measure the temperature in de the smoker as well as the core temperature of whatever i have in my oven at thst time. Now i am just looking for a way to connect an o-led display to show the values...

    • @robertssmorgasbord
      @robertssmorgasbord  Před 4 lety

      You're welcome!
      And regarding the OLED display, try that video: czcams.com/video/9tBxXPTLM6Y/video.html

  • @yeyac98
    @yeyac98 Před rokem +1

    Very valuable video! Thanks a lot!

  • @andymouse
    @andymouse Před 5 lety

    This is fascinating to me as I have used this module myself for a homemade tandoor (oven) I also had to average out the data but my maths is rubbish, so I just added together 10 readings and divided it, also I only update my Oled display every couple of seconds this works fine for the oven (great chicken!) I have also run into the "ground" issue. Not using the library is something i'm gonna go away and play with Its quite simple the way you put it...cheers.

    • @robertssmorgasbord
      @robertssmorgasbord  Před 5 lety +1

      Well, I gather the MAX6675 is good enough to cook some tandoori dishes then :-) Regarding the grounding issue you are in luck: In two weeks or so I will publish a video where I solve exactly that problem ;-)

    • @robertssmorgasbord
      @robertssmorgasbord  Před 5 lety

      The video explaining how to overcome the grounding issue is out now: "Galvanic Isolation of SPI Devices (e.g. Arduino, MAX6675 and SI8631)" czcams.com/video/6rEJh4yPekg/video.html

  • @jamie3641
    @jamie3641 Před 4 lety

    Great information. Well done. Thank you

  • @electronic7979
    @electronic7979 Před 4 lety +1

    Helpful video 👍

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

    Great great explanation! Thanks

  • @seo-para-ecommerce
    @seo-para-ecommerce Před 4 lety

    thank you! great explain

  • @grmahuntsegay48
    @grmahuntsegay48 Před 4 lety +1

    Thank you Sir!!!

  • @41_ahwaszargar73
    @41_ahwaszargar73 Před 3 lety +2

    I really appreciate the time you have invested in making this video.Considering how very well written it was coupled with easy explanantion thank you Sir So much for this video it was a pure gold mine of information.I want to know How you came to the conclusion of choosing this particular formula for moving avergae because i have seen a different one for it .Also Sir why did u choose mov_avg =-100 in start

    • @robertssmorgasbord
      @robertssmorgasbord  Před 3 lety

      You're welcome - and thank you for praise! Regarding the moving average I used: I choose that modified moving average (MMA), aka running moving average (RMA) or smoothed moving average (SMMA), (see Wikipedia en.wikipedia.org/wiki/Moving_average) because it doesn't require an array to store past values. α = 1/N, so if you replace that in my formula you get NEW = (1/N)*VALUE + (1-(1/N))*OLD = (N*(1/N)*VALUE + N*(1-(1/N))*OLD) / N = (VALUE + N-1*OLD) / N, which might look more familiar to you. I initialized my moving average with an obviously invalid number (here -100), so I would see that it's not yet calculated correctly when I start the program. That was just my laziness. A better approach would have been to initialize average=NAN (not a number) and then use the expression (isnan(average) ? value : average) when accessing the average. My bad!

    • @41_ahwaszargar73
      @41_ahwaszargar73 Před 3 lety

      Tysm for your reply It might seem a bit much to you But I have become your Fan After watching just a single video.I mean I loved how detailed the video was and so easy to comprehend.I remember Jordan Peterson saying "If its hard for you to understand something it means its the authors fault".Based on this how easy it was to comprehend I believe You Really Know your stuff

    • @robertssmorgasbord
      @robertssmorgasbord  Před 2 lety

      @@41_ahwaszargar73 Thank you again for the praise! I'm blushing here 😊 Anyway, it's very satisfying for me when people get something out of my video.

  • @ovi_4
    @ovi_4 Před 4 lety

    Hi, great video and very instructional as well. However, I wonder what modification in code as well as in hardware you need to do if you only have the MAX31855 modules instead? I have several but none of the MAX 6675.
    And by the way, my modules are 3.3V but the Arduino is 5V so, I'm thinking, I will probably need to use some sort of logic level shifter modules (bidirectional maybe? I'm not sure) to communicate with the MCU. Also, another question is what library? The Adafruit one or...is there any other I can use? It would be great if you could make a video with the above modules or perhaps some ideas on how I need to do it? Thank you.

    • @robertssmorgasbord
      @robertssmorgasbord  Před 4 lety

      Hi, have a look at the Adafruit MAX31855 module: www.adafruit.com/product/269
      It's 5V compatible and they provide a schematic for that board ( learn.adafruit.com/assets/35637 ) so you can see how that's done: No need for logic level shifters, just two diodes and two resistors - though that technique won't work if you have other 5V SPI devices on the bus that actually receive data from the hots! You can probably use the 3.3V pin of an Arduino to supply the 3.3V - I don't see the need of an extra regulator.
      Using the Adafruit library for that module should be alright (haven't done any research regarding MAX31855 libraries).

  • @edgarinv
    @edgarinv Před 4 lety

    Great video! I wanted to read the temperature of 3 fermenting vesels using pt100's I think your video help me a lot. Is it similar when using multiple MAX31865 ?
    one other question, If I wanted to display the temperatures on an OLED screen will it work also with SPI ?

    • @robertssmorgasbord
      @robertssmorgasbord  Před 4 lety

      In principle, yes. But ... The MAX31865 uses bi-directional SPI, so you will need an additional data line (MISO - Master In Slave Out, respectively, SDO - Slave Data Out. Of course you'll need a suitable Arduino library. Fortunately one is available from Adafruit: Adafruit_MAX31865.h. Connecting an OLED to the same SPI bus isn't a problem, because the slaves on a SPI bus are addressed by chip select pins (one for each slave).

  • @spacetime8963
    @spacetime8963 Před 3 lety

    awesome vid! thanks so much. one question: how did you claculate error of +-2.25C from LSD of +-9.0 thanks.

    • @robertssmorgasbord
      @robertssmorgasbord  Před 3 lety

      Thanks for the praise! And you're welcome! The error calculation is simple: 1 LBS is 0.25°C according to the datasheet. You can also calculate that by dividing the temperature range of 1024°C by the 12 bit resolution of 2^12 = 4096. So an error of ±9 LSB is an absolute error of ±9 LSB * 0.25°C per LSB = ±2.25°C.

  • @bintangaldoni3142
    @bintangaldoni3142 Před 2 dny

    Hi robert Thank you very much for the video its reallay give me a lot of new knowlade. i have a questions about the thermocouple with the max6675,now im in a project to make deep frying machine and i've used the thermocouple. everytimes the themocouple touching the survaces of this machine which is made by stainless steel its get failure for the thermocouple read the temperature.
    i hope you have any sugest or recommendations for it, should i do special methode for this thermocouple max6675 or i must to use other module for it?
    thanks, have a nice day

  • @ricg40
    @ricg40 Před 2 lety

    Hi Robert,
    The max6675 data sheet seems to indicate 3.3v to 5v can be used.
    The library was apparently written with 5v in mind ? I get correct temps when using 5v (comparing to a ds18b20).
    My readings using 3.3v are about 10-12 degrees Fahrenheit higher, but i'm not sure if simply subtracting this differential will give me a correct reading over a large temperature range.
    Your thoughts are appreciated. i hope it's as simple as subtracting, but usually things like this are much more complicated than they appear. thank you.

    • @robertssmorgasbord
      @robertssmorgasbord  Před 2 lety

      Mhh ... The MAX6675 can indeed operate with a supply voltage down to 3V. However, the library (which one exactly?) doesn't care at all / is in no way affected by / can't be affected by the operating voltage of the MAX6675. The interface between the Arduino and the MAX6675 is purely digital (SPI). The analog-to- digital conversion of the thermocouple voltage happens inside the MAX6675, and the MAX6675 does take care of variations in the supply voltage using an internal reference. So ... maybe you've got a bad Chinese chip or something else is wrong with your MAX6675.

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

    Thank You for the video.
    So if you have multiple thermocouples you would have to insulate them from each other? It seems like that might effect the accuracy of the readings?
    Guess I would have to experiment with them to figure something out.
    Thanks again, great info on using the arduino and thermocouples.

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

      You're welcome! If you have multiple thermocouples you only have to isolate them when they are in contact with metal surfaces with different voltage potentials. E.g. you measuring the temperature of one heat sink that is connected to ground and another that is connected to your power rail. For isolation of thermocouples see the video "Galvanic Isolation of SPI Devices (e.g. Arduino, MAX6675 and SI8631)" czcams.com/video/6rEJh4yPekg/video.html (no loss of accuracy - the isolation happens on the digital side).

    • @patrickmclaughlin6013
      @patrickmclaughlin6013 Před 3 lety

      @@robertssmorgasbord
      Thank You for the info and follow up reply.

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

      @@patrickmclaughlin6013 You're welcome :-)

  • @piyushsharma5205
    @piyushsharma5205 Před 4 lety

    Sir can you please tell that ,19:22 will this method work if i want to have 8 max6675 modules and also want to add a 1602 lcd display shield on arduino mega 2560?
    when there will be a voltage problem?

    • @robertssmorgasbord
      @robertssmorgasbord  Před 4 lety +1

      Will that also work with eight MAX6675 modules? Yes, no problem, just use six more pins for six additional chip select (CS) lines. Will it work with a 1602 LCD shield on an Arduino Mega 2560? Sorry, I can't say for sure. I don't know what kind of 1602 LCD shield you're using. Generally: As long as the shield allows you access to (and is not using itself) MOSI and at least eight more pins for the chip select (CS) lines there shouldn't be a problem.
      The power supply (voltage) will definitely not be a problem. These MAX6675 modules draw only a few mA.

  • @paultestman606
    @paultestman606 Před 4 lety

    would this be good for a gas convection oven? i plan to use 2 Thermocouples like you have there to measure the temperature inside the oven

    • @robertssmorgasbord
      @robertssmorgasbord  Před 4 lety

      In general, yes, absolutely. But it depends on the maximum temperature in your oven ;-) You can buy type K thermocouples that are good for up to 1100°C (those Chinese I had probably won't).

  • @jamesmac6102
    @jamesmac6102 Před 2 lety

    I don't know who is enjoying it more, you by making the video or me by watching your video :) How can I contact you regarding technical questions?

    • @robertssmorgasbord
      @robertssmorgasbord  Před 2 lety

      I'm happy you enjoyed the video :-) I certainly enjoy making those tutorials. Unlike in my project videos usually nothing goes wrong in my tutorial videos ;-) As for contacting me: The CZcams comment section is currently the only way to communicate with me. CZcams is just a hobby for me and for privacy reasons I don't give out any contact information.

    • @jamesmac6102
      @jamesmac6102 Před 2 lety

      @@robertssmorgasbord I'm using Max31865, what do you think should I use ferrites to each wire of 3wires PT100?If so what type?

  • @NicedayNice-wp1bp
    @NicedayNice-wp1bp Před 18 dny

    Hello, nice explanation. For detecting fire, what is the best sensor for arduino uno?

    • @robertssmorgasbord
      @robertssmorgasbord  Před 15 dny

      Thanks! And sorry, I haven't worked with fire detectors (neither smoke, nor heat, nor gasses like CO2) so far. So I can't really recommend any sensors.

  • @LuigiZotti
    @LuigiZotti Před 2 lety

    Hello I have an electric oven that mounts a type K probe inside the chamber, then it must be connected to the controller (plc), do you think I can also connect the same probe to max6675?

    • @robertssmorgasbord
      @robertssmorgasbord  Před 2 lety

      Yes you can - but not parallel to the build in controller. It's either connect it to your MAX6675 (but then your oven would stop working I guess) or connect it to the build in controller! Best to install a second thermocouple for your MAX6675. But watch out for that AC mains voltage, which can cause serious injury or death!

  • @mumbaiverve2307
    @mumbaiverve2307 Před 3 lety

    Hi Robert,
    In a moving average as you have implemented, by choosing alpha=0.1, the sample size automatically becomes 10 ? So for eg, if i chose 0.01, would it mean i am averaging over 100 samples ? I am writing some code to calculate the average value of a mains voltage sine wave , so could i use something like this for that ?
    Thanks for your great videos :)

    • @robertssmorgasbord
      @robertssmorgasbord  Před 3 lety

      In principal yes. The equivalent sample size is indeed 1/alpha. However, the MODIFIED moving average behaves differently than the (normal) moving average. See en.wikipedia.org/wiki/Moving_average#Modified_moving_average and my video here czcams.com/video/HK1JmZx7Swg/video.html . If you're averaging just over the peak values of a 50Hz sine wave (using some peak detector, sample rate 50Hz or 100Hz) you can use either the modified moving average or the (normal) moving average. However, if you're really sampling the sine wave, like an oscilloscope would (so sample rate >> 100Hz) the modified moving average won't work. BTW you're welcome :-)

    • @mumbaiverve2307
      @mumbaiverve2307 Před 3 lety

      @@robertssmorgasbord Thanks for clarifying. I am actually measuring the values of the entire (full rectified) sine wave and then averaging, to calculate Vavg. I guess " (normal) moving average" may be suitable ?
      Looking forward to your next video on the heater plate controller :-) !

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

      @@mumbaiverve2307 Your welcome! And yes, you should better use a normal moving average.

  • @raminkermani54
    @raminkermani54 Před 11 měsíci

    Thank you

  • @robertssmorgasbord
    @robertssmorgasbord  Před 5 lety +4

    The code shown in the video is now available on Google Drive: drive.google.com/open?id=1Jr1x3gAqk6qdJrtftl6BtrlDJwdOymKi
    Note that this code already includes the extensions from "Galvanic Isolation of SPI Devices (e.g. Arduino, MAX6675 and SI8631)" czcams.com/video/6rEJh4yPekg/video.html

  • @saurmaruli7864
    @saurmaruli7864 Před 4 lety

    How can this thermocouple with SPI be integrated with Modbus protocol so that the data log can be sent & processed in computer software like Artisan for coffee roasting temperature analysis?

    • @robertssmorgasbord
      @robertssmorgasbord  Před 4 lety

      Well, I had to google "Modbus" first, so don't expect a finished solution from me ... Anyway, are we talking about Modbus over EIA/RS-485, EIA/RS-232 or Ethernet?

  • @rohitbhosle6521
    @rohitbhosle6521 Před 3 lety

    Thanks for detailed video about module really helpful 🙏
    I want to measure temperature of copper pipe at 4 different location so if I connect 4 Thermocouples on pipe then I will experience short problem. Can you suggest any solution like Thermocouples whose tip is electrically isolated or something like that
    Thanks

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

      You're welcome!
      As long as your copper pipe(s) (I assume for warm water) are at the same electrical potential (according to the building codes in most countries they should be grounded) you don't need electrical isolation between your four thermocouples. E.g. I just measured the temperature on both ends of an aluminum profile (heating one end with a lighter) with two non-isolated thermocouples - no problem.

    • @rohitbhosle6521
      @rohitbhosle6521 Před 3 lety

      @@robertssmorgasbord thanks for reply 🙏

    • @robertssmorgasbord
      @robertssmorgasbord  Před 3 lety

      @@rohitbhosle6521 You're welcome 😀

  • @rhenry74
    @rhenry74 Před 2 lety

    Where can i find a thermocouple with that flat thru-hole mount? Everything T see is k-type?

    • @robertssmorgasbord
      @robertssmorgasbord  Před rokem

      I've got mine from eBay quite a while ago: czcams.com/video/Q4XTfRTT3I4/video.html
      K type thermocouples are by far the most prevalent (cheapest) type. You might get E, J and T types from distributors (not from the Chinese for cheap though). The rest are specialty items that are usually available directly from the vendors.

  • @niswanthskumar1608
    @niswanthskumar1608 Před 9 dny

    Sir, first of all thanks a lot for the video. Iam making a similar temp Data acquisition system with arduino. I have to measure 2.5m underwater. Should i use a thermocouple or thermistor? Please reply.

    • @robertssmorgasbord
      @robertssmorgasbord  Před 5 dny

      OK, when to use a thermocouple or a thermistor basically comes down to the temperature range you want to measure. Since you're talking about 2.5m under water, I guess you're measuring "normal" water temperatures between 0°C and a few dozen °C. Thermocouples a great for measuring very high temperatures (hundreds °C), but that's not really necessary in your application. So I would go with a thermistor. Anyway, if it fits your application you should consider using a digital sensor like the DS18B20/DS18S20 ( czcams.com/video/XUm9RPWRBx8/video.htmlsi=rNz_LZVcwO_D3_HV ). Here I'm using one to measure the temperature of a water bath: czcams.com/video/EP1Lc-g3uY0/video.htmlsi=2YE7tQAADdcGYFHu .

  • @jotapati6329
    @jotapati6329 Před rokem

    The Arduino code for your study is for the two MAX6675 modules.?

    • @robertssmorgasbord
      @robertssmorgasbord  Před rokem +1

      Yes, the Arduino sketch is for two MAX6675. You can easily modify it by changing const byte max6675_num to another number, e.g. 1 if you only have one MAX6675.

  • @SidneyCritic
    @SidneyCritic Před 5 lety

    Is there a way to run multiple non-isolated thermo-couples, ie; 4 TCs, with one in each cyl's exh of a 4 cyl.

    • @robertssmorgasbord
      @robertssmorgasbord  Před 5 lety +1

      If I understand your question right: Yes. Add two more MAX6675 modules (without digital isolators of course) on two more chip select lines to the circuit. Modify the code (rough outline): Instead of one delay of 220ms in the loop() function, add a delay in the for-loop (1 to 4) of 55ms (220ms/4). Hope that helps.

    • @piyushsharma5205
      @piyushsharma5205 Před 4 lety

      @@robertssmorgasbord Does it apply similarly for 8 thermocouples?
      I mean , 220/8 ?

    • @robertssmorgasbord
      @robertssmorgasbord  Před 4 lety

      @@piyushsharma5205 Yes, it does. Generally speaking: You can either have one delay(220) statement at the start (or end) of the loop() function, or you can have a delay(220 / [number of sensors]) within the for() loop. In the first case you read all sensors in quick succession and then wait, in the second you read a sensor, wait a little, read the next sensor etc.

  • @matthewlynch5879
    @matthewlynch5879 Před 3 lety

    Is it tru to say the short issue is only where a short exists between two or more sensors. For example, where thermocouples are probe type (floating in air or into food item let’s say in baking) but not screw in or attached with eyelet or set on conductive surface..... we will not experience that short problem affecting measurement.

    • @robertssmorgasbord
      @robertssmorgasbord  Před 3 lety

      Yes, that's true. As long as your thermocouples are not connected to some conductors that have different electrical potentials you are fine. So having them float in the air or sticking them into a bread in the oven is absolutely fine.

  • @koplandavid
    @koplandavid Před 4 lety

    Have you thought about calibrating it ? Mine when put into an ice bath shows 4 deg C.

    • @robertssmorgasbord
      @robertssmorgasbord  Před 4 lety +1

      Nope, haven't tried or thought about that ... but thanks for the suggestion! I'll probably try that when/if I'm coming back to thermocouples ...

    • @tonyfremont
      @tonyfremont Před 3 lety

      You could get a reading of boiling water and then use the map() function, assuming that the thermocouple is linear.

  • @Presso99
    @Presso99 Před 3 lety

    screw type of thermocouple sensor as shown in this video has a very poor response time. I prefer the wire tip type, but wire tip type will get contaminated which gives you an error after it was used for sometime or contaminated with some materials or chemicals.

    • @robertssmorgasbord
      @robertssmorgasbord  Před 3 lety

      You're absolutely right. These screw type thermocouples are slow, much slower than the wire tip thermocouples. However, I didn't know that the wire tip thermocouples can develop an error when they are contaminated. So thanks for the info!

  • @bigshafe
    @bigshafe Před 5 lety

    Can you make the code available to try? Thanks for the videos, very informative and thorough.

    • @robertssmorgasbord
      @robertssmorgasbord  Před 5 lety +1

      I'll try ;-) Though it could take a few of days until I come around to do that.

    • @robertssmorgasbord
      @robertssmorgasbord  Před 5 lety +1

      I've made the code available on Google Drive: drive.google.com/open?id=1Jr1x3gAqk6qdJrtftl6BtrlDJwdOymKi
      Note that this code already includes the extensions from "Galvanic Isolation of SPI Devices (e.g. Arduino, MAX6675 and SI8631)" czcams.com/video/6rEJh4yPekg/video.html

  • @Feofan_ivanich
    @Feofan_ivanich Před rokem

    скажите а на ESP32 ваш код будет работать сразу или надо его переделывать ?
    tell me , will your code work on ESP32 right away or do you need to redo it ?

    • @robertssmorgasbord
      @robertssmorgasbord  Před rokem

      I never programmed an ESP32, so I can't say for sure. But I guess you'll have to make some changes to the code.

  • @conradsinsua7415
    @conradsinsua7415 Před 4 lety

    love the video and got it working but have difficulty under standing the averaging maths :(

    • @robertssmorgasbord
      @robertssmorgasbord  Před 4 lety +1

      Thanks! And I'm glad you got it working! There is a Wikipedia about all that moving average stuff: en.wikipedia.org/wiki/Moving_average#Modified_moving_average Maybe that helps.

  • @Dany1557
    @Dany1557 Před 4 lety

    Hi Robert....do you know how I can modify your code to read the tempreature in Farenheit ??..thanks

    • @robertssmorgasbord
      @robertssmorgasbord  Před 4 lety

      Simply use the .readFahrenheit() method instead of .readCelsius() ;-)

    • @Dany1557
      @Dany1557 Před 4 lety

      Thanks Robert...but your code has not that "redCelsius()" line. You get the value with the sentence "value=max6675Read(max6675_cs_pins[i])"...how would you do it.??..thanks a lot..

    • @robertssmorgasbord
      @robertssmorgasbord  Před 4 lety +2

      @@Dany1557 Ah, sorry, thought you referred to the original MAX6675 library and not to my modified version starting at 29:19 ...
      In my function
      "float max6675Read( int max6675_cs_pin )"
      replace
      "return (data >> 3) / 4"
      by
      "return (data >> 3) / 4 * 1.8 + 32"
      and everything will be in °F.
      Hope that helps

    • @Dany1557
      @Dany1557 Před 4 lety

      @@robertssmorgasbord ..excellent!!..thanks a lot.!!!

    • @robertssmorgasbord
      @robertssmorgasbord  Před 4 lety

      @@Dany1557 You're welcome ;-)

  • @robertssmorgasbord
    @robertssmorgasbord  Před 5 lety

    There is a video out now explaining how to galvanically isolate the MAX6675 (see 23:26 in this video) : "Galvanic Isolation of SPI Devices (e.g. Arduino, MAX6675 and SI8631)" czcams.com/video/6rEJh4yPekg/video.html

  • @pehrnilsson2369
    @pehrnilsson2369 Před rokem

    how do i convert this code to 1 sensor and mqtt . please will someone help me with that?

    • @robertssmorgasbord
      @robertssmorgasbord  Před rokem

      Sorry, can't help you with MQTT, never did anything with MQTT. As for using the code with only one MAX6675 (no MQTT though): Just set max6675_num to 1 and initialize all arrays for just one max6675. Or use the first version of the code for just a single MAX6675.

  • @squidyPet
    @squidyPet Před 2 lety

    The common mistake is a metal cover of thermocouple shold be grounding. It must be done for both max2765 and max31855. There will be lots of incorrect datas without it.

    • @robertssmorgasbord
      @robertssmorgasbord  Před 2 lety

      Grounding the (from the thermocouple isolated) metal housing/cover of a sensor is of course always a good idea. BTW what is the MAX2765? Surely a typo.

  • @jeelpatel4511
    @jeelpatel4511 Před rokem

    How connect this with Voltcraft HPS 13030 and I need to give voltage of 8v to 10v from this Voltcraft machine to control the temperature!!! Can you help me with this?

    • @robertssmorgasbord
      @robertssmorgasbord  Před rokem

      I don't quite understand the question. What temperature do you want to control? Are you using the Voltcraft power supply to power some heating element and you want to control the temperature of that heating element?

    • @jeelpatel4511
      @jeelpatel4511 Před rokem

      @@robertssmorgasbord yes exactly you are correct, how can I do that?

    • @robertssmorgasbord
      @robertssmorgasbord  Před rokem

      @@jeelpatel4511 Well, that's a larger project ...
      If you go down the digital route, you would measure the temperature using a thermocouple and and for example a MAX6675. Then you would have a MCU (e.g. Arduino) with some software. And that would drive a two channel DAC to generate the control voltages for your Voltcraft. I do have two videos about a suitable DAC:
      czcams.com/video/bj57xuQS7L8/video.html
      czcams.com/video/BrZYVWQ-p3U/video.html
      I hope that helps.

  • @engr.omitdebnath
    @engr.omitdebnath Před rokem

    Hello, I hope you are well and safe now. Please make a video to control and monitor the temperature from Thermocouple with STM32 Microcontroller, Max6675 module, and keil uvision software, and also share the programming code of Keil Uvision software. It will be very helpful for me and other researchers.

    • @robertssmorgasbord
      @robertssmorgasbord  Před rokem +1

      Hello, hope you're well and safe too. Unfortunately I never worked before with STM32 MCUs or the µVision IDE. So I'm probably the wrong person to ask. Sorry!

  • @samintarajarujunan5995

    Im connecting 8 thermocouples to my Arduino Uno and need to log the data to an SD card. The SD card cannot be initialised if the SO and SCK pins are connected. please help I can share my coding if u want.

    • @robertssmorgasbord
      @robertssmorgasbord  Před rokem

      Sorry, I never worked with a SD card connected to an Arduino. To be honest I never used a SD card in any project to this date. So I unfortunately can't be of any help. Have you tried one of the Arduino's software SPI libraries to simply connect the SD card to other pins? ( github.com/MajenkoLibraries/SoftSPI , wiki.seeedstudio.com/Software-SPI/ )

    • @samintarajarujunan5995
      @samintarajarujunan5995 Před rokem

      Ya i am using spi library. Can i use the non modified codng for 8 thermocouples ? I tried using that code but it wasnt giving me correct tempreture values.

    • @robertssmorgasbord
      @robertssmorgasbord  Před rokem

      @@samintarajarujunan5995 I don't quite understand ... I was suggesting to use the hardware SPI (SPI.h, SPI object) for the MX6675s and the software SPI (SoftSPI.h) for the SDCARD.

    • @hornos27hotmailcom
      @hornos27hotmailcom Před rokem

      Cordial saludo, en este video te enseñaran a guardar datos en una memoria externa tipo SD, espero sea de su utilidad, y nos lo puede comentar en este foro, saludos.
      czcams.com/video/0rKL5UWUAzk/video.html&ab_channel=ElprofeGarc%C3%ADa

    • @robertssmorgasbord
      @robertssmorgasbord  Před rokem

      @@hornos27hotmailcom Lo siento, pero mi español se basa únicamente en Google Translate. Así que realmente no puedo seguir ese video.

  • @tantularnurtono2555
    @tantularnurtono2555 Před 3 měsíci

    Why my results always 0 C? I have checked all the connections and code. Please help me. Thank you.

    • @PortableTaco
      @PortableTaco Před 3 měsíci

      your speed...add a delay 200ms

    • @tantularnurtono2555
      @tantularnurtono2555 Před 3 měsíci

      @@PortableTaco thank you for your kind attention. I have added delay(1000).. however, it is still 0 C result.

    • @robertssmorgasbord
      @robertssmorgasbord  Před 3 měsíci

      Well, I love to help you, but it's basically impossible / pure guesswork, without seeing your setup / code. Sorry!

    • @robertssmorgasbord
      @robertssmorgasbord  Před 3 měsíci

      @@PortableTaco Thanks for chiming in!

    • @robertssmorgasbord
      @robertssmorgasbord  Před 3 měsíci

      @@tantularnurtono2555 Have you checked your wiring? Do you have another MAX6675 module? Maybe yours is defect.

  • @danbam9018
    @danbam9018 Před rokem

    How can I connect 14 thermocouple each with a max6675 to a multiplexer CD74HC4067 ??? pls help

    • @robertssmorgasbord
      @robertssmorgasbord  Před rokem +1

      Short answer: Sorry, you can't.
      Long answer: A thermocouple produces maby a few dozens Microvolts (not millivolts) per Kelvin (including negative voltages at negative °C). It is hopeless to try to multiplex such signals with something as simple as an CD74HC4067 (it can't handle negative input voltages and the noise level is a few Millivolts (a few thousand Microvolts).
      The way you usually would go about it would be to use 14 MAX6675 (one for each thermocouple) and then multiplex them on the SPI bus.

    • @danbam9018
      @danbam9018 Před rokem

      @@robertssmorgasbord thanks for answering, and how can I do that? do I need another multiplexer? and which one?

    • @robertssmorgasbord
      @robertssmorgasbord  Před rokem

      @@danbam9018 If you have 14 free IO pins on your MCU you don't need any additional chip. Just use the IO pins to drive the SPI CS pins. If you have only 5 IO pins free, use a CD74HC154 4- to 16-Line Decoder/Demultiplexer. The Y0 to Y15 outputs go to the CS pins of the MAXs. The MCU selects the MAX using the A0 to A3 pin and sends the CS signal into the E1/E2 pins.

    • @danbam9018
      @danbam9018 Před rokem

      @@robertssmorgasbord and How can I do the code to make it works? where can I find some examples? thanks

    • @danbam9018
      @danbam9018 Před rokem

      @@robertssmorgasbord so i need to put E1/E2 in a SPI ? or those two goes to gnd?

  • @vvoranartsomnam5507
    @vvoranartsomnam5507 Před 3 lety

    How to use thermocouple more bouble

    • @robertssmorgasbord
      @robertssmorgasbord  Před 3 lety

      Ah, "more bouble"?

    • @vvoranartsomnam5507
      @vvoranartsomnam5507 Před 3 lety

      @@robertssmorgasbord sorry i mean more 2 or 3 thermocouple

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

      @@vvoranartsomnam5507 Ah, OK, you want to prevent the shorting issue when using multiple thermocouples? There's a video where I explain how to galvanically isolate the MAX6675 to prevent that issue: "Galvanic Isolation of SPI Devices (e.g. Arduino, MAX6675 and SI8631)" czcams.com/video/6rEJh4yPekg/video.html .

    • @vvoranartsomnam5507
      @vvoranartsomnam5507 Před 3 lety

      @@robertssmorgasbord Thankyou so much, i can do it

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

      @@vvoranartsomnam5507 You're welcome :-)

  • @robinkks7340
    @robinkks7340 Před 3 lety

    fais du fortnite please

    • @robertssmorgasbord
      @robertssmorgasbord  Před 3 lety

      Désolé, mais je joue uniquement aux jeux de tir à la première personne.

  • @orhanyucel1800
    @orhanyucel1800 Před 3 lety

    error is occurred @th line SPI.begintransaction(mX6675_SPİ);
    I have defined SPI library in the code
    Why did it occur the failure
    Could you please help me
    Iam very pleased the video thanks a lot

    • @robertssmorgasbord
      @robertssmorgasbord  Před 3 lety

      Well, what error exactly (I'm assuming it's a compilation error) is occurring at "SPI.begintransaction(mX6675_SPİ)"? And can you upload somewhere the rest of your code? It's basically impossible to tell what's going wrong without the whole code.

    • @orhanyucel1800
      @orhanyucel1800 Před 3 lety

      @@robertssmorgasbord
      #include
      //#include "max6675.h"
      //int i;
      //double value;
      //const int spi_miso_pin = 12; // spi master in slave out pin
      //const int spi_sck_pin = 13; // spi serial clock pin
      const byte max6675_num = 2; // Serial Clock am PIN 10
      const int max6675_cs_pins[max6675_num] ={10,9}; //max6675 chip select pins
      SPISettings max6675_spi(1000000, MSBFIRST, SPI_MODE1); // 1 Mhz SPI clock


      //MAX6675 max6675s[max6675_num] =
      //{
      // MAX6675 ( spi_sck_pin, max6675_cs_pins[0], spi_miso_pin ),
      // MAX6675 ( spi_sck_pin, max6675_cs_pins[1], spi_miso_pin )
      //};
      void setup()

      {
      int i;

      for (i = 0; i< max6675_num ; i++)
      {
      pinMode(max6675_cs_pins[i], OUTPUT);
      digitalWrite(max6675_cs_pins[i],HIGH);

      }

      SPI.begin();

      Serial.begin(9600); // Begin der Seriellen Kommunikation mit 9600 Baud


      }

      void loop() {
      const float mov_avg_alpha = 0.1;
      static float mov_avgs[max6675_num] = {-100 , -100};
      float value;
      float max6675Read(int max6675_cs_pin);
      int i;
      delay(220);
      for (i = 0; i < max6675_num; i++)
      {
      value = max6675Read (max6675_cs_pins[i]);

      if (mov_avgs[i] == -100) mov_avgs[i] = value;
      mov_avgs[i] = mov_avg_alpha * value + (1 - mov_avg_alpha) *
      mov_avgs[i];
      Serial.print(round(mov_avgs[i]));
      Serial.print("\t");
      }

      Serial.println();
      }
      unsigned int data;

      SPI.beginTransaction(max6675_spi);
      digitalWrite(max6675_cs_pin, LOW);
      data = SPI.Transfer16(0);

      digitalWrite(max6675_cs_pin, HIGH);

      SPI.endTransaction();


      if (data & 0*0004)
      {
      return NAN;
      }
      else
      {
      return (data >> 3) / 4;
      }
      }
      The code did not work because of the line which is "SPI.endTransaction(); " could you please help me? thank you very much. have a nice day. :)

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

      @@orhanyucel1800 You've made a typo at one point, forgot a function declaration and added a totally nonsensical line. This version of your code complies without errors:
      #include
      //#include "max6675.h"
      //int i;
      //double value;
      //const int spi_miso_pin = 12; // spi master in slave out pin
      //const int spi_sck_pin = 13; // spi serial clock pin
      const byte max6675_num = 2; // Serial Clock am PIN 10
      const int max6675_cs_pins[max6675_num] ={10,9}; //max6675 chip select pins
      SPISettings max6675_spi(1000000, MSBFIRST, SPI_MODE1); // 1 Mhz SPI clock


      //MAX6675 max6675s[max6675_num] =
      //{
      // MAX6675 ( spi_sck_pin, max6675_cs_pins[0], spi_miso_pin ),
      // MAX6675 ( spi_sck_pin, max6675_cs_pins[1], spi_miso_pin )
      //};
      void setup()

      {
      int i;

      for (i = 0; i< max6675_num ; i++)
      {
      pinMode(max6675_cs_pins[i], OUTPUT);
      digitalWrite(max6675_cs_pins[i],HIGH);

      }

      SPI.begin();

      Serial.begin(9600); // Begin der Seriellen Kommunikation mit 9600 Baud


      }

      void loop()
      {
      const float mov_avg_alpha = 0.1;
      static float mov_avgs[max6675_num] = {-100 , -100};
      float value;
      // float max6675Read(int max6675_cs_pin); !!!!!!!!!!!!!! THIS DOESN'T MAKE ANY SENSE !!!!!!!!!!!!!!!!!!!!!
      int i;
      delay(220);
      for (i = 0; i < max6675_num; i++)
      {
      value = max6675Read (max6675_cs_pins[i]);

      if (mov_avgs[i] == -100) mov_avgs[i] = value;

      mov_avgs[i] = mov_avg_alpha * value + (1 - mov_avg_alpha) *
      mov_avgs[i];
      Serial.print(round(mov_avgs[i]));
      Serial.print("\t");
      }

      Serial.println();
      }
      float max6675Read(int max6675_cs_pin) // !!!!!!!!!! YOU FORGOT THESE TWO LINES !!!!!!!!!!!!!!!!!!!!!!!
      { // !!!!!!!!!! YOU FORGOT THESE TWO LINES !!!!!!!!!!!!!!!!!!!!!!!
      unsigned int data;

      SPI.beginTransaction(max6675_spi);
      digitalWrite(max6675_cs_pin, LOW);
      data = SPI.transfer16(0); // !!!!!!!!!!! IT'S SPI.transfer16 NOT SPI.Transfer16 !!!!!!!!!!!!!!!

      digitalWrite(max6675_cs_pin, HIGH);

      SPI.endTransaction();

      if (data & 0*0004)
      {
      return NAN;
      }
      else
      {
      return (data >> 3) / 4;
      }
      }