Using MCU to control wattage to heating element

I currently have an ESP8266/ESP32 that is connected to a 40A SSR. that SSR switches a 120v load that goes to a heating element.

I have a requirement to be able to control how much power goes to that element. Currently I have a loop in the software that will run every 500ms. if the power is 50%, it will be on 250ms and off 250ms. if the power is 25%, on 125ms, off 375ms. this causes a bit of a surge that I dont like. I have looked at SCRs and Triacs to clip the sine wave, but those take variable resistors or potentometers to control. I would like to control on a GPIO pin of an MCU, specifically the ESP32. I can either replace the SSR with something more fitting, or add a circuit to my prototype that will control that SSR.

any ideas?

Do you need all 40A?

If not:

PWM Control

But it sounds like you should be looking into a PID controller.

i have 2x 5500w elements. so 2x 25A is fine I think. I am essentially making a PID controller (along with other stuff) Im even using the PID library, but that is for a different use case.

I have 2 use cases:

  1. heat water to XXX and hold.
  2. heat water @ XX% load, until boil.

looking at that link now

What about switching on every 10 minutes and vary the length of the power pulse for regulating? Using almost 5 kW it ought a rather large "load" You are heating up.

Currently I have a loop in the software that will run every 500ms. if the power is 50%, it will be on 250ms and off 250ms. if the power is 25%, on 125ms, off 375ms. this causes a bit of a surge that I dont like.

That's basically the standard way of doing it, although usually with a longer time period... It works fine because heat can't change instantly.

If you have a thermostat or closed-loop system (with temperature monitoring), the power/heat comes-on when you're below the target temperature, then goes-off when you reach the target (with some "swing" or hysteresis) so it doesn't try to turn on-and-off several times per second.

I have looked at SCRs and Triacs to clip the sine wave, but those take variable resistors or potentometers to control.

No, you CAN make a dimmer with a microcontroller. You need a "zero crossing" detector, and gen a time-delay following the zero-crossing. Of course, the zero-crossing detector has to be electrically electrically isolated from the AC (usually optically isolated) and the TRIAC output also has to be optically isolated. (You'd use a TRIAC for AC because an SCR doesn't work on AC.) You can also use a solid-state relay, but it has to be the non-zero crossing type so you can turn it on in the middle of the AC cycle.

But again, it's very rare to use a "dimmer" in a heating (or cooling) application.

this causes a bit of a surge that I dont like.

What do you mean by "surge"? Do you have a zero crossing or random fire SSR?

DVDdoug:
ou can also use a solid-state relay, but it has to be the non-zero crossing type so you can turn it on in the middle of the AC cycle.

But again, it's very rare to use a "dimmer" in a heating (or cooling) application.

This is what I think will work. the question is, at a high level, how do you get the MCU to control that relay correctly. From what I understand, this is one:

http://www.crydom.com/en/products/catalog/series-1-240-ac-panel-mount.pdf (D2425-10) the -10 means its instant turn on instead of zero crossing

cattledog:
What do you mean by "surge"? Do you have a zero crossing or random fire SSR?

zero crossing right now, i think changing it would be easiest.

Surging is hard to explain on my end. if you listen, you can hear the element turn on and sizzle (so to speak) and turn off, i was wanting more control to keep tighter temps in place, or control the foam in a rolling boil.

I currently have an ESP8266/ESP32 that is connected to a 40A SSR. that SSR switches a 120v load that goes to a heating element.

D2425-10 That part number is for a 25A device. The -10 is instant turn on

i have 2x 5500w elements. so 2x 25A is fine I think.

No. 5500/120 = 45.8A per element. This is unusual for a water heater. Are you certain about what you have?

the question is, at a high level, how do you get the MCU to control that relay correctly

As stated, you will turn it on for a time and off for a time. 500ms is a very short period for such a massive heating operation. 5 seconds or longer sounds more appropriate.

Surging is hard to explain on my end. if you listen, you can hear the element turn on and sizzle (so to speak) and turn off, i was wanting more control to keep tighter temps in place, or control the foam in a rolling boil.

how long does it take to hear the sizzle?

I think he has water heater elements rated at 5500W @240V At 240V its 22.9A but to get the full 5500W at 120V he would need 45A each.

You should seriously look into the relay example in PID library. You can change the setpoint to a setrate by having a window time a measuring the change in temp during that window.

I am not an electrical engineer I am a chemist and have at least 8 pieces of test equipment in my lab running on arduino with the PID library with a precision of heat rate within 0.1 Celsius/min. I have tried the approach you are attempting it doesn't work as well. There is latency in the transfer of heat from the element to large volumes of water the lower the difference the slower the transfer rate.

The most consistent results have come from the PID relay window time on with a circulation device.

MForlong:
I think he has water heater elements rated at 5500W @240V At 240V its 22.9A but to get the full 5500W at 120V he would need 45A each.

It doesn't work like that. A 5500W/240V element would produce only 1375W of heat when connected to 120V.

The PID library may help - it does have an option for slow PWM which is meant for use with relays - like this kind of applications.

Is it a 3 phase 120 volt radiator being used? 2x5,5 kW...… That is enough pwr to heat up a large house.
What is the project except from consuming lots of electricity? Data doesn't make sence.

Possibly an instant on water heater.
Ours is connected to three phase 240V and produces some 21 kW of heat.

I follow this thread since it started and it is still not clear if you want to control the consumed power or the target temperature. Title of the thread and zero-crossing/phase-cutting indicate control of consumed power, PID indicates control of temperature. So which one?

To control the temperature you need to control the power consumed.
PID with temperature as setpoint, phase cutting delay or (more sensibly for heaters) slow pwm controlling the power as output.

wvmarle:
To control the temperature you need to control the power consumed.
PID with temperature as setpoint, phase cutting delay or (more sensibly for heaters) slow pwm controlling the power as output.

but if is different if you have a target consumption or target temperature.

In my main Arduino project I regulate a heater to consume exactly the excess power generated by a photovoltaic system. for that I use phase-cutting.

to regulate the target temperature a simple on/off based on target temperature with hysteresis is a basic way. We had here a thread with a requirement to hold the exact temperature (minimize the hysteresis interval). I think then was PID used to do that. But I doubt it is needed in this case.