4

How can I control an AC ceiling fan speed using Arduino Uno R3? I cannot understand the key behind controlling AC voltage using Arduino (though I know how to on/off ac appliances using arduino and relays).

2

Controlling the speed of an AC motor is not an easy undertaking, and messing around with mains voltages if you're not experienced and know what you're doing can be fatal.

Now that's the disclaimer out of the way, on to your question.

Unlike DC, you cannot use PWM to control the average power of AC. That is, after all, what PWM does - the on-off ratio creates a percentage of the power - but it can only be done if the incoming power is of a steady state.

For AC there are two ways of reducing the output power - either reduce the voltage, which can be done with resistors (look inside a multi-speed fan and you'll see resistors to change the speed); or chop up the AC waveform, which is a little like PWM but more specialized.

If you only want specific speeds then you could pre-define them using resistors and switch different resistor combinations in and out using relays. It's crude, but simple, and also probably the safest option for the beginner.

If you want proper variable speed, though, then you're going to have to chop up the waveform. The theory is quite simple: Start where the waveform crosses 0V in either direction, with the output on, and turn it off again at some percentage of the way through the cycle.

Like PWM it's the on-off percentage that defines the output power (and thus the speed), but timing is critical - you must start the PWM sequence at 0V and it must last exactly one cycle.

enter image description here

A number of simple circuits work in the opposite way - they remain off until the input waveform reaches a certain point, then switch on, until they reach the zero-crossing point. While simple, these circuits aren't good. The reason being that the sudden rise from 0V to the "trigger" voltage when the output becomes live can cause large spikes and noise in the circuit, which can cause lights to blow etc. It's the same effect as why bulbs most often blow when you turn them on, not when they have been running for a while - it's that very rapid rise from 0V to a high voltage which causes them to be over-stressed and blow.

So any circuit you choose should really be a proper one which turns on at 0V and turns off after a period, not turn on at a voltage and turn off at 0V.

  • This should be a comment to @Majenko 's answer, but since I'm newb on this side, it goes as answer: Isn't the speed of the fan more dependent on the AC frequency than on the effective voltage? Would this really work, and in what range of speeds? – Gleb Mar 2 '16 at 13:53
  • 2
    The multispeed AC motors used in ceiling fans do not use resistors to change the speed, they use different taps on the motor as an autotransformer to scale the voltage used in the motor. electronics.stackexchange.com/questions/86459/… – Dave X Mar 2 '16 at 14:24
  • If torque-dependent slip is built into the motor, as is true in the multi-speed fan motors, then the amount of slip and speed, relative to the no-load synchonous speed, is dependent on the load and voltage applied. Reducing the energy input by chopping out part of the waveform also increases the slip. – Dave X Mar 2 '16 at 14:30
  • @Gleb I did convert it but create a few nice answers and you'll get yourself commenting privileges. – Avamander Mar 2 '16 at 15:04
  • I've read this answer multiple times over the last week, and it's still confusing. Is this for single-speed or multi-speed fans? Is there even a difference? Could you provide code samples for Arduino that would assist in understanding the cut-offs on the sine wave? Is this how wall fan-dimmer switches work? – Sawtaytoes Aug 23 '17 at 6:28

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.