MAX6675 and STM32F103C6T6A - Page 1
Forum section: electronics / beginners

author: Apollo1234
author_rank: Contributor
timestamp: May 15, 2024, 01:18:47 pm
content: 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_0, 1);HAL_GPIO_WritePin(GPIOB, GPIO_PIN_12, 1);lcd_discover();lcd_init();HAL_GPIO_WritePin(GPIOA, GPIO_PIN_3, 1);/* USER CODE END 2 *//* Infinite loop *//* USER CODE BEGIN WHILE */while (1){/* USER CODE END WHILE *//* USER CODE BEGIN 3 */lcd_clear();HAL_GPIO_WritePin(GPIOA, GPIO_PIN_3, 0);HAL_Delay(10);HAL_SPI_Receive(&hspi1, buffer, 2, 1000);HAL_GPIO_WritePin(GPIOA, GPIO_PIN_3, 1);raw = (buffer <<| buffer;raw >>= 3;raw2 = (float)raw * 0.25;sprintf(str, "%.1f", raw2);lcd_send_str(str);HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_0);HAL_Delay(350);}

author: aliarifat794
author_rank: Regular Contributor
timestamp: May 15, 2024, 05:45:48 pm
content: I suggest you simulate your circuit with the code. You can use proteus or any other convenient simulation software.

author: jwet
author_rank: Frequent Contributor
timestamp: May 19, 2024, 04:28:17 pm
content: 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...

author: Apollo1234
author_rank: Contributor
timestamp: May 22, 2024, 03:06:40 am
content: After some time wasted trying to find the source of the problem with my multimeter, I finally got it. 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. 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!

author: Apollo1234
author_rank: Contributor
timestamp: May 23, 2024, 01:20:27 am
content: 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... 😄