duty cycle modulates the SSR AC power cycle. One pin
outputs the plus (+) and a second pin is the minus (-) PID
output. PWM resolution for this microcontroller is eight
bits (0-255 values) for each pin.
Because PWM output ranges 0-255, this also
constrains the PID output function to this range (actually -
255 to +255 for dual ± outputs). Therefore, PID constants
Kp, Ki, Kd must be chosen carefully to never exceed these
limits during operation. Using constrained K constant
values may limit PID performance in terms of max
temperature excursion and settling time.
Nevertheless, with proper K constant selection, full
range (0-1024°C) temperature sensor operation should be
possible for a wide variety of
Consider the special case of a
heat-only application; say, perhaps
a small SMT solder oven. In reality,
there is no cooling function, so if
the PID output < 0, the thermal
system will not respond. Only the
(cooling) effects of the ambient
thermal environment may restore
To match this heat-only
environment, set PID_MIN = 0 in
the software sketch and choose a
suitable set of K constants that limit
A simple rule of thumb[ 3] for the maximum sample
period is to take the ramp time and divide by 10. In this
example, it took roughly two seconds to heat from 20 to
120 degrees. So, the maximum sample period is 2 sec/10
= 0.2 seconds. Indeed, the blue dots show good PID
control at this sampling period: 0.2 sec.
For most practical applications, under-sampling should
not be a problem. Using this PWM strategy, the device is
capable of a 0.267 sec sample period minimum; suitable
for a three second ramp time.
SSR and PWM Problem
Solid-state relays are capable of switching on/off
heavy AC loads. Common low cost SSRs are rated
for up to 480 VAC at 40A. Yikes! Several SSR types
exist, but all AC power SSRs use a TRIAC thyristor
Here, the power is not actually switched until
the load current falls below a specified holding
current (typically < 100 mA). The zero-crossing
effect is characteristic of all AC output SSRs
regardless of switching type.
Because this implementation relies on rapid
PWM switching, it is best applied to resistive loads
with a large power factor (greater than 0.7). The
zero-crossing effect is shown in Figure 6.
For 60 Hz AC power, the maximum delay is 1/2
cycle or 8. 33 ms. Considering that our PWM duty
cycle ranges from 0-255, a single bit of resolution at
FIGURE 6. SSR zero-crossing AC power switching.
FIGURE 7. PWM switching frequency and resolution.
34 November 2017