Fantastic video, this appoach of writing a library from the scratch, explain it and going into detils is a very generous gift to beginers. Thank you Lewis.
Just a note to help others out, I had to reverse the clock polarity and put in a couple delays to get this code to work (i.e. digitalWrite(CLK, LOW); _delay_ms(1) **or delay(1)if you're using Arduino instead of regular AVR** value+=digitalRead(DBIT); digitalWrite(CLK, HIGH); ms_delay(1); ) Obviously, the code works as is for some modules (it's demonstrated on the video), but you might want to try these changes if you're having some trouble. Thanks for the vid, Lewis. It was helpful.
Lewis, trying to use your program on a Mega 2560 with just displaying 0.00 for the temperature - not sure what I am doing wrong. I am new at this type of programing and not sure what Matt Lambert is taking about? To see if that will fix it
Hi sir, I'm trying to use max6675 on a battery operated a wireless network and I'm trying to decrease power consumption to a minimum. Is there a way to reduce the 200ms delay? also, can the max6675 chip run on 3.3V? thank you! great vid!
Lewis Loflin Thanks, I did since my previous post. It's very clear: 170-220ms conversion time. The newer max31855 has a reduced conversion time of 70-100ms. I'm gonna go with off the shelf solar power banks.
While I'm sure it would return a reading I doubt it would be correct. Try it out and read a known temperature as measured by another source. Use a correction factor, a number often multiplied or divided to compensate for the difference. That can be derived by experimentation.
@@Presso99 I don't know that device. I doubt it reads 4 sensors all at once, but one after the other very fast. The MAX6675 is a digital sensor that puts out a particular serial code. The other device might use a 4-channel high-resolution AD, but it still reads one at a time. Use that same Arduino code for 2 sensors but use different digital pins. Start the conversion on both; after the delay, read each sensor.
This is causing a VERY slow loop in the arduino, I tried attaching a timer interrupt to make it read only on certain read counts, then it basically won't read it at all. It's driving me nuts. I'm trying to control a jet engine with this thing and the MAX6675 is slowing down the whole work!
I was a able to shorten to 185 MS and still obtain readings, I then had it read as an interrupt ever 20 loops instead of slowing every loop down 185 MS
Hi Lewis, awesome video, but when I tried the same code with arduino uno, it's printing only zeroes, connections and codes I crosschecked many times but still it's printing only zeroes. Can you please help.
Hello Nazal. It's really basic code and has worked for a number of people. I ran mine on an Arduino Nano. Did you use the code exactly as on the webpage?
No I changed the pins to 13-CLk, 12-SO and 10-CS and rest I kept the same. Is it possible that something's wrong with the sensor? It's a new one which I just bought.
+Juan Pinheiro , check out designer2k2's video "MultiDisplay, Typ K Thermocouple Reading and Scope Mode" he has 8 readouts i believe with a regular adruino
After testing for a few days, I've found the accuracy at room temperature to be off by a few degrees. Perhaps I need some calibration. The noise you speak of is probably presenting as the fluctuations I see between reads. Sometimes as much as 1.5°F.
Thanks again for the info. My application for use is to take readings from my Big Green Egg BBQ smoker. I want to plot temps throughout the cooking time. So far so good. I used a python script to push the readings to a Google Sheets spreadsheet to give me a real time graph available via the internet. It's just a hobby and I'm having fun.
I beg to differ. At the very beginning of the function value is initially = 0. For this particular line of code digitalRead(DBIT) sees if the input pin is LOW or HIGH; ie it returns 0 or 1. That 0 or 1 is then shifted left by i bits. i ranges from 14 down to 0 in your code. Say i = 3 and DBIT is 1 then 1 shifted left 3 times becomes 8. That 8 is then added to the variable value. If DBIT = 0 then 0 shifted any number of bits remains 0, so value +=0 equals value. What you describe would be coded as value = (value + digitalRead(DBIT))
The temperature has 0.25degC precision and is encoded as a 16 bit 'integer' by multiplying the temperature by 4. Lewis converts the temperature to a float (Ctemp) by dividing by 4.0, as a simple integer would lose the 0.25, 0.50 and 0.75 precision.
Fantastic video, this appoach of writing a library from the scratch, explain it and going into detils is a very generous gift to beginers. Thank you Lewis.
Just a note to help others out, I had to reverse the clock polarity and put in a couple delays to get this code to work (i.e. digitalWrite(CLK, LOW); _delay_ms(1) **or delay(1)if you're using Arduino instead of regular AVR** value+=digitalRead(DBIT); digitalWrite(CLK, HIGH); ms_delay(1); ) Obviously, the code works as is for some modules (it's demonstrated on the video), but you might want to try these changes if you're having some trouble. Thanks for the vid, Lewis. It was helpful.
Thanks Matt.
Thanks so much Lewis, been battlng with libraries for two days. Followed your code and it worked first time.
Where is the code?
Paul Navarrez
Paul, on his webste.
Peter
This code also works for the ESP8266 12E. Only change required is do the CLK on pin 12 not 9.
Hi,Programing does my head in but you explained this very well,Cheers Dave.
thank you for sharing your knowledge with us. this helped quite a bit.
thank you for your code ,it give me understand with SPI communication and max6675.
good, very complete explanation! no library also, make me understand a lot.
Excellent video + code + details
hi lewis, thanks for the video you explain really good, it helped me a lot!, do you know if i can use a 2.2 uf capacitor instead?
Power supply cap? should work.
Lewis,
trying to use your program on a Mega 2560 with just displaying 0.00 for the temperature - not sure what I am doing wrong. I am new at this type of programing and not sure what Matt Lambert is taking about? To see if that will fix it
This was done on an Arduino nano you have to have the correct pin connections. I don't use the Mega 2650. Try changing the time delay.
Thank you for sharing!!!
Hi sir, I'm trying to use max6675 on a battery operated a wireless network and I'm trying to decrease power consumption to a minimum. Is there a way to reduce the 200ms delay? also, can the max6675 chip run on 3.3V? thank you! great vid!
There is a conversion time and 200mSec. is already cutting it close. 3.3 volts I don't know check the spec sheet. Sorry.
Lewis Loflin Thanks, I did since my previous post. It's very clear: 170-220ms conversion time. The newer max31855 has a reduced conversion time of 70-100ms. I'm gonna go with off the shelf solar power banks.
SPI should be able to allow more than one sensor, (compare temperatures, etc), but how to know which sensor is which?
Thanks :)
What would I have to do if I change the thermocouple? Let's say for example it measures 0-500c?
While I'm sure it would return a reading I doubt it would be correct. Try it out and read a known temperature as measured by another source. Use a correction factor, a number often multiplied or divided to compensate for the difference. That can be derived by experimentation.
Hi, can we connect 2 thermocouple with Arduino and read the data simultaneously?
No. You can read one after the other. There is a time delay for conversion so if the conversion on both starts together read one and then the other.
@@LewisLoflin Thanks. Phidget 1048 has the capability to simultaneously perform 2 readouts. There is a reason why they sell more expensive.
@@Presso99 I don't know that device. I doubt it reads 4 sensors all at once, but one after the other very fast. The MAX6675 is a digital sensor that puts out a particular serial code. The other device might use a 4-channel high-resolution AD, but it still reads one at a time. Use that same Arduino code for 2 sensors but use different digital pins. Start the conversion on both; after the delay, read each sensor.
This is causing a VERY slow loop in the arduino, I tried attaching a timer interrupt to make it read only on certain read counts, then it basically won't read it at all. It's driving me nuts. I'm trying to control a jet engine with this thing and the MAX6675 is slowing down the whole work!
The MAX6675 is a slow device and there is no way around it. It has I think a 500mS conversion time.
I was a able to shorten to 185 MS and still obtain readings, I then had it read as an interrupt ever 20 loops instead of slowing every loop down 185 MS
Great work. Noted.
Hi Lewis, awesome video, but when I tried the same code with arduino uno, it's printing only zeroes, connections and codes I crosschecked many times but still it's printing only zeroes. Can you please help.
Hello Nazal. It's really basic code and has worked for a number of people. I ran mine on an Arduino Nano. Did you use the code exactly as on the webpage?
No I changed the pins to 13-CLk, 12-SO and 10-CS and rest I kept the same. Is it possible that something's wrong with the sensor? It's a new one which I just bought.
Good!! Is possible to read four sensors in the same arduino?
Sure as long as you have enough data/clock pins.
Juan Pinheiro you can share de SO and SCK pins but use one CS pin for each module
+Juan Pinheiro , check out designer2k2's video "MultiDisplay, Typ K Thermocouple Reading and Scope Mode" he has 8 readouts i believe with a regular adruino
What is the purpose of the capacitor? I ran your code without it and it seemed to work.
+Brent Reusing It's a noise bypass capacitor I think. Some of these parts such as a LM7805 won't work without it. The spec sheet said use it.
After testing for a few days, I've found the accuracy at room temperature to be off by a few degrees. Perhaps I need some calibration.
The noise you speak of is probably presenting as the fluctuations I see between reads. Sometimes as much as 1.5°F.
+Brent Reusing It's going to be off a little bit. This is not a high dollar item. Thanks.
Thanks again for the info. My application for use is to take readings from my Big Green Egg BBQ smoker. I want to plot temps throughout the cooking time. So far so good. I used a python script to push the readings to a Google Sheets spreadsheet to give me a real time graph available via the internet. It's just a hobby and I'm having fun.
Hi Brent! I want to do the same but I don't know anything about python. Can you share some instructions and code? thanks!
Thankyou!!
is there any way to transfer this to matlab code?
Never used metlab. Sorry.
How can enterfacing max6675 with pic 16f876
If programmed in PIC C it isn't that different from Arduino.
thank you so much
value += digitalRead(DBIT)
This is part of a serial to parallel routine. Read a pin, add that value HIGH or LOW (1 or ), then shift left one bit. Do it X times in a loop.
I beg to differ. At the very beginning of the function value is initially = 0. For this particular line of code digitalRead(DBIT) sees if the input pin is LOW or HIGH; ie it returns 0 or 1. That 0 or 1 is then shifted left by i bits. i ranges from 14 down to 0 in your code. Say i = 3 and DBIT is 1 then 1 shifted left 3 times becomes 8. That 8 is then added to the variable value. If DBIT = 0 then 0 shifted any number of bits remains 0, so value +=0 equals value. What you describe would be coded as value = (value + digitalRead(DBIT))
test Video ?
+SergeyD It should work now.
EEVBlog explains some things:
ua-cam.com/video/AYblSfpKRUk/v-deo.html
in formula Ctump = v * 0:25 (0:25 come from that)
The temperature has 0.25degC precision and is encoded as a 16 bit 'integer' by multiplying the temperature by 4. Lewis converts the temperature to a float (Ctemp) by dividing by 4.0, as a simple integer would lose the 0.25, 0.50 and 0.75 precision.