Read MAX6675 with ESP8266
- cicciocb
- Site Admin
- Posts: 1979
- Joined: Mon Feb 03, 2020 1:15 pm
- Location: Toulouse
- Has thanked: 425 times
- Been thanked: 1320 times
- Contact:
Re: Read MAX6675 with ESP8266
HI mezjoc,
please let us know if this code was successful for you.
cicciocb
please let us know if this code was successful for you.
cicciocb
-
- Posts: 24
- Joined: Tue Mar 09, 2021 4:26 pm
- Location: Fót / Hungary
- Has thanked: 16 times
- Been thanked: 8 times
Re: Read MAX6675 with ESP8266
Dear cicciocb!
The program works perfectly. I just do not understand how? I tested up to about 400 ° C. I couldn't measure the accuracy. Thank you very much for your help: mezjoc
The program works perfectly. I just do not understand how? I tested up to about 400 ° C. I couldn't measure the accuracy. Thank you very much for your help: mezjoc
Code: [Local Link Removed for Guests]
'/program/spi_max6675_2.bas
spi.setup 1000000,0,1 'bit/sec, data_mode(0-1-2-3), lsb_first(0)-msb_first(1)
'MAX6675/SO-->GPIO12/D6
'MAX6675/CS-->GPIO16/D0
'MAX6675/SCK-->GPIO14/D5
'POWER-->+3V3-GND
pin.mode 16, output ' CS-->GPIO16
timer0 2000,mytimer
wait
mytimer:
i=i+1
pin(16) = 0 'CS=LOW
v0 = spi.byte(0) '0000 0000 0011=3D
v1 = v0 << 8 '0011 0000 0000=768D
v2 = v1 or spi.byte(0) '0011 0000 0011=771D ???
pin(16) = 1 'CS=HIGH
if (v2 and &h4) then '
wlog "no thermocouple attached!"
else
v3 = v2 >> 3
wlog i;".",v0,v1,v2,v3,"Temperature "; v3 * 0.25 ; "°C"
end if
return
-
- Posts: 24
- Joined: Tue Mar 09, 2021 4:26 pm
- Location: Fót / Hungary
- Has thanked: 16 times
- Been thanked: 8 times
Re: Read MAX6675 with ESP8266
Dear cicciocb!
Here are the wlog values (at room temperature). I'm trying to decipher: mezjoc
Here are the wlog values (at room temperature). I'm trying to decipher: mezjoc
Code: [Local Link Removed for Guests]
1. 3 768 784 98 Temperature 24.5°C
2. 3 768 776 97 Temperature 24.25°C
3. 3 768 768 96 Temperature 24°C
4. 3 768 792 99 Temperature 24.75°C
5. 2 512 760 95 Temperature 23.75°C
6. 3 768 776 97 Temperature 24.25°C
7. 3 768 768 96 Temperature 24°C
8. 3 768 776 97 Temperature 24.25°C
9. 3 768 784 98 Temperature 24.5°C
10. 3 768 776 97 Temperature 24.25°C
11. 3 768 776 97 Temperature 24.25°C
12. 3 768 768 96 Temperature 24°C
13. 3 768 792 99 Temperature 24.75°C
14. 3 768 792 99 Temperature 24.75°C
15. 2 512 760 95 Temperature 23.75°C
16. 3 768 776 97 Temperature 24.25°C
17. 3 768 776 97 Temperature 24.25°C
18. 2 512 760 95 Temperature 23.75°C
19. 3 768 768 96 Temperature 24°C
20. 3 768 776 97 Temperature 24.25°C
21. 3 768 784 98 Temperature 24.5°C
22. 3 768 784 98 Temperature 24.5°C
23. 3 768 768 96 Temperature 24°C
24. 3 768 776 97 Temperature 24.25°C
25. 3 768 768 96 Temperature 24°C
26. 3 768 784 98 Temperature 24.5°C
27. 3 768 776 97 Temperature 24.25°C
28. 3 768 776 97 Temperature 24.25°C
29. 3 768 768 96 Temperature 24°C
30. 3 768 776 97 Temperature 24.25°C
- cicciocb
- Site Admin
- Posts: 1979
- Joined: Mon Feb 03, 2020 1:15 pm
- Location: Toulouse
- Has thanked: 425 times
- Been thanked: 1320 times
- Contact:
Re: Read MAX6675 with ESP8266
What do you need to decipher ?
If you look at the datasheet https://datasheets.maximintegrated.com/ ... AX6675.pdf
In particular at the page containing the output format You can see that the output contains 16 bits (2 bytes) and that the whole must be shifted right of 3 bits to obtain the 12 bits reading.
this code
simply read the 2 bytes shifting the first one of 8 bits to the left to compose a 16 bits number.
As the resolution is 0.25°C, the value is simply multiplied by 0.25
If you look at the datasheet https://datasheets.maximintegrated.com/ ... AX6675.pdf
In particular at the page containing the output format You can see that the output contains 16 bits (2 bytes) and that the whole must be shifted right of 3 bits to obtain the 12 bits reading.
this code
Code: [Local Link Removed for Guests]
v0 = spi.byte(0)
v1 = v0 << 8
v2 = v1 or spi.byte(0)
As the resolution is 0.25°C, the value is simply multiplied by 0.25
You do not have the required permissions to view the files attached to this post.
-
- Posts: 24
- Joined: Tue Mar 09, 2021 4:26 pm
- Location: Fót / Hungary
- Has thanked: 16 times
- Been thanked: 8 times
Re: Read MAX6675 with ESP8266
Dear CiccioCB!
I don't want to waste your time.
The value of spi.byte (0) is the same for both inputs (line 14, line 16). Value = 3D = 0000 0011B. Why does the value of v2 change? (768D ... 784D)?
Other!
Line 20 is never active.
Regards: mezjoc
I don't want to waste your time.
The value of spi.byte (0) is the same for both inputs (line 14, line 16). Value = 3D = 0000 0011B. Why does the value of v2 change? (768D ... 784D)?
Other!
Line 20 is never active.
Regards: mezjoc
-
- Posts: 142
- Joined: Mon Feb 08, 2021 10:10 pm
- Location: Scotland
- Has thanked: 47 times
- Been thanked: 50 times
Re: Read MAX6675 with ESP8266
Hi mezjoc,
Excuse me butting in but maybe this can help.
There are 16 bits sent by the device.
Line 16 reads the second 8 bits
v2 = v1 or spi.byte(0)
so spibyte(0) is a different value to v0
Excuse me butting in but maybe this can help.
There are 16 bits sent by the device.
Line 16 reads the second 8 bits
v2 = v1 or spi.byte(0)
so spibyte(0) is a different value to v0
-
- Posts: 24
- Joined: Tue Mar 09, 2021 4:26 pm
- Location: Fót / Hungary
- Has thanked: 16 times
- Been thanked: 8 times
Re: Read MAX6675 with ESP8266
Which is accurate?
Heat blower vs ESP8266?
Heat blower vs ESP8266?
You do not have the required permissions to view the files attached to this post.
- Electroguard
- Posts: 852
- Joined: Mon Feb 08, 2021 6:22 pm
- Has thanked: 273 times
- Been thanked: 321 times
Re: Read MAX6675 with ESP8266
Ha... 552.25
Be interesting to to see how 2 thermocouples might compare at the same time.
Be interesting to to see how 2 thermocouples might compare at the same time.
- cicciocb
- Site Admin
- Posts: 1979
- Joined: Mon Feb 03, 2020 1:15 pm
- Location: Toulouse
- Has thanked: 425 times
- Been thanked: 1320 times
- Contact:
Re: Read MAX6675 with ESP8266
The datasheet says that the accuracy is 8LSB (that is 8*0.25 = 2°C)
You do not have the required permissions to view the files attached to this post.
-
- Posts: 24
- Joined: Tue Mar 09, 2021 4:26 pm
- Location: Fót / Hungary
- Has thanked: 16 times
- Been thanked: 8 times
Re: Read MAX6675 with ESP8266
I AM 70 YEARS OLD. I am very glad to be a member of the forum.
Mezei József (mezjoc) / Hungary.
Mezei József (mezjoc) / Hungary.