Author Topic: MAX6675 and STM32F103C6T6A  (Read 526 times)

0 Members and 1 Guest are viewing this topic.

Offline Apollo1234Topic starter

  • Newbie
  • Posts: 7
  • Country: pt
MAX6675 and STM32F103C6T6A
« on: May 15, 2024, 01:18:47 pm »
Hi there,

I'm currently attempting to build a soldering station that includes both a soldering iron and a heat gun. I began the project by designing a PCB and assembling it. After completing the assembly, I tested the majority of the functions successfully. However, I'm encountering an issue with reading the temperature from a MAX6675 using my MCU. When the MAX6675 is disconnected, I'm reading a value of 1023.75, but when I connect my soldering iron handle, the MAX chip reads 0ÂșC. Is this a common error associated with cheaper, potentially faulty components? i've tested reading the temperature with my multimeter and it reads well. i've checked all connections and proper setup. my max baudrate is of around 1.3MHz.. any ideas?

  HAL_GPIO_WritePin(GPIOB, GPIO_PIN_12, 1);


  HAL_GPIO_WritePin(GPIOA, GPIO_PIN_3, 1);
  /* USER CODE END 2 */

  /* Infinite loop */
  while (1)

    /* USER CODE BEGIN 3 */
  HAL_GPIO_WritePin(GPIOA, GPIO_PIN_3, 0);
  HAL_SPI_Receive(&hspi1, buffer, 2, 1000);
  HAL_GPIO_WritePin(GPIOA, GPIO_PIN_3, 1);
  raw = (buffer[0] << 8) | buffer[1];
  raw >>= 3;

  raw2 = (float)raw * 0.25;

  sprintf(str, "%.1f", raw2);


Offline aliarifat794

  • Regular Contributor
  • *
  • Posts: 128
  • Country: bd
Re: MAX6675 and STM32F103C6T6A
« Reply #1 on: May 15, 2024, 05:45:48 pm »
I suggest you simulate your circuit with the code. You can use proteus or any other convenient simulation software.

Online jwet

  • Frequent Contributor
  • **
  • Posts: 490
  • Country: us
Re: MAX6675 and STM32F103C6T6A
« Reply #2 on: May 19, 2024, 04:28:17 pm »
You're trying to get the whole system working end to end.  Try to break things down a bit.  Try looking at the RAW values you get back from the 6675.  Try putting a raw thermocouple (not part of iron) into the 6675  input without the Iron and look at output.  It appears that the thermocouple is grounded- the iron might have its tip grounded, etc. and get in the way.  Do some checking with an ohmeter with power off and make sure that these things are isolated.  If you have a scope, you coule watch the SPI traffic between the uP and the 6675.  Make sure you get the right pattern- chip select low, SPI clocks and data, chip select high, etc.  This is why 2+ channel scopes are so nice...
« Last Edit: May 19, 2024, 10:44:10 pm by jwet »

Offline Apollo1234Topic starter

  • Newbie
  • Posts: 7
  • Country: pt
Re: MAX6675 and STM32F103C6T6A
« Reply #3 on: May 22, 2024, 03:06:40 am »
After some time wasted trying to find the source of the problem with my multimeter, I finally got it  |O. The first problem was that my 5V source was a Chinese one and had a huge amount of ripple; it ranged from 5.3V to 2.1V  :-DD. I can't say with full certainty that it has a minimum load due to the fact that I couldn't find the model and the seller didn't reply on time. Lastly, I added a delay before setting up the SPI CS pin to allow all the hardware to initialize (mainly the LCD), and it solved my problem. The bottom line is, buy an oscilloscope; they help you solve a lot of problems :-D. Thanks for all the replies. I will soon be posting a picture and a detailed description of the soldering station in case some of you want to build a similar one. See you all soon! :popcorn:

Offline Apollo1234Topic starter

  • Newbie
  • Posts: 7
  • Country: pt
Re: MAX6675 and STM32F103C6T6A
« Reply #4 on: May 23, 2024, 01:20:27 am »
After a closer inspection, another problem was found. This time, the temperature readings were correct when the board was connected to the PC and in debug mode, but the moment I disconnected it and restarted the soldering station, the readings became 0 again. I spent the whole day trying to understand the problem, changing parameters, frequencies, and assembling it on a breadboard. The problem was simple, and it was totally my fault. This station has two temperature sensors, one for the iron and another for the heat gun, both using the MAX6675 for the readings. I chose the STM32F103C6T6A as the heart of the project because it is very popular, cheap, and widely available, but the downside is that it has limited peripherals. I was using a single SPI (only available) for both sensors and completely forgot to initialize the CS (Chip Select) of the second sensor. When I tried to receive data, both sensors were trying to communicate simultaneously, causing the system to crash... 😄

Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo