2024-12-11 09:29 PM
Hi, I am kinda new to this community.I am working with STM32L432KC micro controller and using it to control a PTC heater having power rating of 20Watts.The control is basically ON/OFF control with single pin activating the relay and switching the heaters ON.I am continously measuring the temperature of these heaters through k thermocouple and MAX6675IC.The problem is when below a certain threshold temperature heater is switched ON the the temperature immediately drops to zero. Any one having any insights on this Problem?
2024-12-12 12:38 AM
Hello @arham1026 and welcome to the community,
As per MAX6675 datasheet, this IC is using SPI. What actually did at this stage as debug? did you probe MISO pin?
When you say:
@arham1026 wrote:
The problem is when below a certain threshold temperature heater is switched ON the the temperature immediately drops to zero. Any one having any insights on this Problem?
What do you mean by the temperature drops to 0? how you did conclude that? in a value read in your software?
What tool are you using STM32CUbeIDE/STM32CubeMx? Cube HAL as STM32 drivers?
2024-12-12 01:38 AM
I am using STM32CubeMX software.The value i am reading is exact temperature which is 12bit value by left shifting it in the 16 bit data of SPI.So the value of temperature i am getting becomes zero when heater is switched ON
2024-12-12 01:43 AM
Have you used an oscilloscope or logic analyser to see what's actually happening on the SPI wires?
@arham1026 wrote:i am getting becomes zero when heater is switched ON
Have you checked the power supply? Maybe you're getting a "brown-out" when the heater turns on ... ?
Show your full schematic.
Some good, clear photos of your setup may also help.
2024-12-12 01:51 AM
@arham1026 wrote:
So the value of temperature i am getting becomes zero when heater is switched ON
I assume it's a HW issue. Mainly the power supply part and a drop on VDD line when the heater turns on.
You said you switch on the heater using a relay. What is the relay characteristics? especially the coil voltage and current activation? how are you connecting the relay to the STM32? directly on a GPIO pin or using a transistor or something else?
2024-12-12 08:46 PM - last edited on 2024-12-13 12:01 AM by Andrew Neil
I am controlling Relay which controls heater using the switching IC here is my overall circuit.The coil voltage is 12V
Image rotated.
2024-12-13 12:09 AM - edited 2024-12-13 12:27 AM
You've marked @SofLit's post as The Solution - so is the problem now resolved?
If yes, it would be helpful to describe what, exactly, was the problem, how you found it, and how you fixed it - for the benefit of future readers with similar problems who may find this.
If no, then we still need some more details:
Have you used an oscilloscope or logic analyser to see what's actually happening on the SPI wires between STM32 & MAX6675?
If you need to un-mark the solution, see:
PS:
As shown, your heater is permanently connected to your 12V supply, and your relay shorts-out that supply.
I presume you meant (something like) this:
yes?
2024-12-13 12:22 AM - edited 2024-12-13 03:55 AM
I think he mistakenly marked the solution. I've already unmarked it.
And indeed, exactly this:
@Andrew Neil wrote:
- You haven't shown how the STM32 & MAX6675 power supplies relate to the relay & heater power supply.
- 10A is a significant load to be switching - so have you checked the STM32 & MAX6675 power supplies for glitches and/or brown-out?
I'm pretty sure it's a power supply issue. 10A is a hudge load. If your power supply is not able to source a such current and especially to provide a sufficient inrush current , your power supply voltage will drop.
This will be confirmed if you disconnect the heater and keep the relay. If the relay switches ON normally, it's an issue of insufficient current and your system is unable to provide sufficient inrush current.
So probe the current on heater at switch ON phase and probe the voltage of the controller MCU/Relay.