simulate this circuit – Schematic created using CircuitLab

I'm using a Raspberry Pi with a SainSmart solid-state relay. If I connect the relay to an AC motor (a box fan in this case) and run the following Perl script with different timing values, the motor speed does change accordingly.

use Time::HiRes qw(usleep);

for(;;) { 
  system("gpio write 24 0");
  usleep(50000); # 50ms
  system("gpio write 24 1");

The question is, is this safe and efficient? If not, is there a way to make it so with additional inexpensive hardware?

EDIT: On further observation, this might not be a good idea after all. I attached a meter to the AC supply and the fan actually draws more power on a 95% duty cycle than it does at full speed, even though the fan turns noticeably slower. Presumably that extra power is just heating up the motor.

  • 1
    \$\begingroup\$ What does your circuit to the fan look like? Use the circuit tool. \$\endgroup\$ – laptop2d Aug 4 '16 at 18:23
  • \$\begingroup\$ @laptop2d It took a while for me to understand what you meant by "circuit tool", first I thought you meant something that runs on the Raspberry Pi. :) If anyone else is unusually slow today, he means that you can embed a nice circuit diagram in the question with the embedded schematics editor. \$\endgroup\$ – pipe Aug 4 '16 at 19:06
  • \$\begingroup\$ It is surprising that it used more power with reduced speed. Are you sure that your wattmeter was designed to measure accurately with a distorted waveform? \$\endgroup\$ – Charles Cowie Aug 5 '16 at 2:06
  • \$\begingroup\$ CAN YOU? Yes... is it a good idea... NO... see answers. \$\endgroup\$ – Trevor_G Mar 26 '17 at 15:54

Can I make a one-speed AC motor variable-speed by modulating the power input?

You can not modulate power. You may be able to control the voltage. The motor and the load working together will determine what current will be drawn and how much power will be taken from the source.

If you control the voltage to a box fan, it is likely that the speed can be controlled over a limited but useful range. This will work with a permanent-split-capacitor or a shaded pole type of induction motor driving a fan or centrifugal pump. It will not work with other types of induction motors or other types of loads. Even under the above conditions, there is a possibility that the motor will overheat eventually.

The device used to control the voltage needs to have appropriate voltage and current ratings. You must be able to trigger the voltage turn-on in mud cycle to get a waveform like this:

enter image description here

The question is, is this safe and efficient?

Safety depends the design and implementation. Part of that would be determining if the specific motor and load work properly and that the motor does not overheat. To be completely safe, the motor probably needs a thermal fuse imbedded in the winding my the manufacturer.

This will probably not reduce the efficiency very much as compared with constant-speed operation. Reducing the fan speed will reduce air flow and require less energy than full-speed operation even if the motor is slightly less efficient.

  • \$\begingroup\$ Thanks! If there is no manufacturer-installed thermal fuse, do you think it would be possible (at my own risk) to install one like this on the motor winding? \$\endgroup\$ – Nack Aug 5 '16 at 0:59
  • \$\begingroup\$ It would be possible, but it would be pretty difficult to know what temperature rating to choose and where to place it. \$\endgroup\$ – Charles Cowie Aug 5 '16 at 1:58

Pulse width modulation works well with small DC motors and voltages, but I don't believe it will work well on AC. I can see that relay and motor Will be under a lot of stress due to high current draw.


You may want to look into how variable frequency drives work. For three-phase motors, you generally control the speed by modulating the frequency of the AC voltage. This is generally accomplished by rectifying the AC line to DC, then putting a variable-frequency inverter on the DC to convert it back to AC. I've never seen it done, but the same principle should apply to single-phase motors. (I think modulating the voltage is more likely to reduce the torque more than the speed, though they'll be related to some degree.)

A VFD inverter usually runs a high frequency PWM signal, 2-6 kHz carrier being typical to generate a ~60 Hz fundamental. But if you don't care about detailed control (or the lifetime of your motor) you may be able to use a relatively simple square wave or modified square wave inverter. Most solid-state relays I've seen have switching times measured in milliseconds, so trying to shape any AC waveform with them will be problematic. Power transistors (IGBTs or FETs) are probably the way to go.

Of course, designing even a single-phase square-wave inverter to drive a motor is non-trivial! And from my experience, off-the-shelf inverters are vastly cheaper than anything you could ever hope to build for any significant power level. Makes me wonder if you could take an off-the-shelf inverter and modify its references in some way to give a variable frequency...

  • \$\begingroup\$ Like danyk666's tiny SHADED-POLE MOTOR OF DEATH: youtu.be/5HeG_CAOsG0 \$\endgroup\$ – wbeaty Dec 3 '16 at 23:59

AC induction motors Do Not Work That Way.

Here's what's happening inside an induction motor. It's a cylinder, with 3 field windings around the edge. It uses either 3-phase power, or single-phase with an extra "start" winding to get it spinning in the right direction.

The three windings make a magnetic field which rotates around the cylinder at line frequency, so 60 cycles/second (3600 RPM) or 50 cycles (3000 RPM).

It's like there's an imaginary spinning magnet with 2 poles: north and south.

Yes, you could use 6 windings and have the imaginary spinning magnet have 4 poles. That would rotate half the speed.

The rotor (spinning part) is nothing but a hollow cylinder that catches the rotating magnetic wave and is dragged along by it. It resembles a hamster wheel and is actually called a squirrel cage. There are no permanent magnets in it, this all happens via eddy-current induction, hence the name of the motor.

By nature, this has a small amount of "slip". So a motor whose field spins at 3600 rpm is rated for 3450 RPM. The slip varies slightly by load (if you've ever worked in a wood-shop, you know the sound of a motor "loading up") but that is the one speed it goes, assuming the input frequency is 60 Hz.

The entire motor is carefully tuned to be efficient (avoid making internal heat which would have to be actively cooled) when fed a sine-wave.


Now you know the score, you can see where altering the 60Hz waveform will do absolutely nothing to change the speed of the motor, but break the sinewave it needs to be efficient (coolable). Also, you were getting a lot of inductive back-EMF at your switch, which I'm amazed didn't fry it.

And now you know how to control the speed of the motor: feed it a sinewave at a different frequency. Yeah, that's harder. And not really thinkable until silicon power switching got pretty good. Which is what a Variable Frequency Drive is: the "magic bullet" to solve this problem. While you're doing VFD, you might as well also do proper 3-phase, to increase efficiency, allow reversibility and avoid the hokey "start winding" found on single phase motors. By the way, an interesting work on this is Don Lancaster's "Magic Sinewaves".

  • \$\begingroup\$ There is a lot in this answer that is not correct. Millions of box fans, pedestal fans, table fans and ceiling fans have a three-speed switch that controls the speed by reducing the torque that the motor can produce thus allowing the load to reduce the motor speed by operating at a higher slip. That is not very efficient, but it reduces energy consumption because the fan requires less energy at the lower speed. A "light dimmer" applied to a fan does essentially the same thing. \$\endgroup\$ – Charles Cowie Aug 5 '16 at 16:55
  • \$\begingroup\$ But those motors are designed from the ground up to facilitate speed change using a specific method. You can't retrofit any method onto any motor. If you must, VFD is the best way. And "light dimmers" should not be used on fans, per NEC. \$\endgroup\$ – Harper Aug 5 '16 at 18:05
  • \$\begingroup\$ I agree that it is not a good idea to retrofit any HOMEMADE method including a homemade VFD. Retrofitting a homemade VFD to a single-phase motor is not necessarily any better than retrofitting a homemade primary voltage control method. The very few factory-made VFDs that I have seen for 1-Ph motors are described as suitable only for PSC and shaded pole motors and only for fan and centrifugal pump loads. What NEC paragraph are you referring to? \$\endgroup\$ – Charles Cowie Aug 5 '16 at 19:52
  • \$\begingroup\$ VFDs are regularly adapted to motors not made for VFD. Though I agree single phase is a mistake, you don't want your VFD fighting the start winding tuned for 50/60Hz. Anyway the hard part is doing VFD at all, once there, 3-phase is easy so do it. The NEC paragraph is in the 100 section where the device must be listed for the intended use. You can't use a lamp dimmer on a fan unless it is listed for motor control. Lamp dimmer manufacturers emphatically refuse to do so, to the point of using extra warning language saying "not for motors, really." \$\endgroup\$ – Harper Aug 5 '16 at 20:05
  • \$\begingroup\$ It appears that there may be primary voltage type ceiling fan speed controllers on the market. They seem to be designed for mounting in a wall box, so they would certainly need to be listed. I am pretty sure that NEC doesn't cover plug and cord connected equipment, but there is a pretty good effort to prevent non-listed equipment from being sold or bought. From that point of view, no homemade project should be plugged in and a lot of battery-operated projects are questionable. At minimum everyone should be encouraged not to leave anything like that unattended. \$\endgroup\$ – Charles Cowie Aug 5 '16 at 20:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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