Read MAX6675 with ESP8266

Place code snippets and demo code here
User avatar
Electroguard
Posts: 1079
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 364 times
Been thanked: 387 times

Re: Read MAX6675 with ESP8266

Post by Electroguard »

You youngens, eh... I raise our average age to 71.

Not all Annex users are eligible for the 'old farts' club though, cos some are still working... and Francesco still has dark hair !
But what we all have in common is an enthusiasm for Annex, seducing our brains into healthy creativity, exploring beyond our boundaries into new areas of interest. Thank you CiccioCB for adding something worthwhile into our lives.
Robin.
@t vW
Posts: 12
Joined: Tue Feb 23, 2021 8:00 pm
Location: Hoorn (Netherlands)
Has thanked: 89 times
Been thanked: 3 times

Re: Read MAX6675 with ESP8266

Post by @t vW »

Well said Robin, I agree for a full 100%, and thank Francesco very much !
At van Wijk.
Helmut_number_one
Posts: 149
Joined: Fri Dec 09, 2022 10:03 am
Has thanked: 93 times
Been thanked: 17 times

Re: Read MAX6675 with ESP8266

Post by Helmut_number_one »

I tried a ESP32 C3 Mini with this Max IC, but it didn't run.
Her my code:

Code: [Local Link Removed for Guests]

'SDA = Pin8
'SCL = 9
'SCK = 4

'/program/spi_max6675_2.bas
spi.setup 1000000,0,1    'bit/sec, data_mode(0-1-2-3), lsb_first(0)-msb_first(1)
pin.mode 10, output ' CS-->GPIO16
timer0 2000,mytimer
wait

mytimer:
i=i+1
pin(10) = 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(10) = 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
Can a user help?
User avatar
cicciocb
Site Admin
Posts: 2626
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 549 times
Been thanked: 1861 times
Contact:

Re: Read MAX6675 with ESP8266

Post by cicciocb »

If you look in the help file here : [Local Link Removed for Guests]
it is stated that the CS signal is handled automatically by Annex (because the ESP32 are multitask / multicore)

Try this code, it should work... otherwise there is another solution ....... :D

Code: [Local Link Removed for Guests]

'SDA = Pin8
'SCL = 9
'SCK = 4

'/program/spi_max6675_2.bas
spi.setup 1000000,0,1    'bit/sec, data_mode(0-1-2-3), lsb_first(0)-msb_first(1)
'pin.mode 10, output ' CS-->GPIO16
SPI.CSPIN 10 'set the CS automatically on pin 10
timer0 2000,mytimer
wait

mytimer:
i=i+1
'pin(10) = 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(10) = 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

Helmut_number_one
Posts: 149
Joined: Fri Dec 09, 2022 10:03 am
Has thanked: 93 times
Been thanked: 17 times

Re: Read MAX6675 with ESP8266

Post by Helmut_number_one »

Thank you,
i see, the sensor needs 5 volts with the C3, with 3.3 volts there are misfires.
Helmut_number_one
Posts: 149
Joined: Fri Dec 09, 2022 10:03 am
Has thanked: 93 times
Been thanked: 17 times

Re: Read MAX6675 with ESP8266

Post by Helmut_number_one »

Hm,
It's always 24 degrees, I've already tried 2 new Max, PT1000 K and an ESP 32 S3.
Always 24 degrees. Does anyone have a tip?

sometimes 16 degrees, if i work on the screw, i became 612° , random degrees...
Edit:
If I connect + and - I get 24 degrees..... China sensor defective? all ?
Helmut_number_one
Posts: 149
Joined: Fri Dec 09, 2022 10:03 am
Has thanked: 93 times
Been thanked: 17 times

Re: Read MAX6675 with ESP8266

Post by Helmut_number_one »

No, with arduinio it is ok......
Sensor nicht defekt.png
The code cannot fit the ESP32. With Arduino I have data that is still correct.
You do not have the required permissions to view the files attached to this post.
bugs
Posts: 164
Joined: Mon Feb 08, 2021 10:10 pm
Location: Scotland
Has thanked: 73 times
Been thanked: 65 times

Re: Read MAX6675 with ESP8266

Post by bugs »

Hi,
I was confused by line 7 of the program:-
7 pin.mode 10, output ' CS-->GPIO16

You are connected to pin 10 not 16?
Helmut_number_one
Posts: 149
Joined: Fri Dec 09, 2022 10:03 am
Has thanked: 93 times
Been thanked: 17 times

Re: Read MAX6675 with ESP8266

Post by Helmut_number_one »

Yes Pin 10, i use the code from Franzessco, and setup also in Arduino:
You do not have the required permissions to view the files attached to this post.
Post Reply