Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am was wondering if an IC like the PCA9685(Datasheet) that generates PWM signals can be used in a PID controller for controlling a heated bed on a 3D printer.

My understanding of PWM is that it will be to fast for a normal relay but that it might work with a Solid State relay.

Even if it can bring down the number of times I have to check the Temperature it would be useful.

share|improve this question
up vote 1 down vote accepted

PWM can and is used for PWM controlling, especially in Switched Mode Power Converters where the switches are usually MOSFETs which makes conductive losses in the switches very low.

The function of PWM in the circuit is to convert the control signal from the PID (for example) into a switching signal. PWM is constant frequency variable duty-cycle. You have several choices other than PWM for converting the control signal to a switching signal e.g Constant On-Time (Variable switching frequency, fixed on-time), Constant Off-time etc..

You also have several control strategies other than PID, e.g. i) threshold :error pos/neg triggers a COT pulse; ii) Hysteretic : Switches ON below lower setpoint threshold and turns OFF above upper threshold etc..etc..

The type of IC you selected seems like overkill for the application. Switching converters are more suitable for your application I'd say, and can be bought in IC form, designed with op-amps/comparators (see below) or a Micro-controller with PWM capabilities + associated MOSFETs and MOSFET drivers.

enter image description here

share|improve this answer

The "numerical system" that your PID controller uses can be analogue or digital (or if you want a bit of both like PWM). Whatever method is used is up to you but it certainly won't allow you to take fewer samples.

PWM can be slow enough for a relay or at the other end of the scale too fast for a solid state relay - it is how you decide it to be - PWM speed is defined by you to suit the application and the driving method.

share|improve this answer
Ahhhhh.... maybe PID is over kill and oscillation via PWM could still work but at the cost of efficiency? – Bertus Kruger Jul 14 '14 at 8:47
"at the cost of efficiency?" - PWM is the most efficient way I know of controlling the power delivered to a load. – Andy aka Jul 14 '14 at 9:02
@BertusKruger - You seem to be confusing terms a bit. PWM is just a way of modulating power to a load. It is not a control-loop. You can have a PID system that has a PWM driver for the output stage, but the PWM stage itself does not provide any regulation, just a way of translating a control variable into a variable power output. The PID loop is responsible for calculating that control variable, but cannot drive the power output without a output stage. They're orthogonal techniques. – Connor Wolf Jul 14 '14 at 9:30

Your understanding is wrong. PWM (called time proportioning in the industry) is actually commonly used with mechanical relays. Naturally the period would be closer to a minute than the few seconds that is possible with a SSR or less than the milliseconds equivalent speed of a phase control.

How often you have to sample the temperature error is (almost) unrelated.

What matters with sample rate and output timing is the characteristics of the system you're trying to control and how far from optimal control you're willing to live with.

If the system does not change "too much" in temperature in 30 seconds you can use a 30 second PWM period. Your sample time and PWM output period (roughly speaking) act as dead times in the feedback control. Dead time can be nasty for good control but not a problem if it is much less than the slowest lag in the system. Some systems are happy with time proportioning control (your home thermostat works like that), some require faster period, some require phase control, and some require more like a servo DC output (even for temperature control). Horses for courses.

Even if the system responds relative quickly, it's possible to sample more slowly by detuning the system (making the controller the slowest lag in the system) but of course the output cycling itself must not cause excessive errors in the controlled variable.

share|improve this answer
+1 for bringing the time-constant of the target system into the equation. – John U Jul 14 '14 at 17:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.