Blog

Arduino-Based Universal AC Motor Speed Controller - Hackster.io

Add the following snippet to your HTML:

Closed loop universal motor control system using PID algorithm. Motor Starter

Arduino-Based Universal AC Motor Speed Controller - Hackster.io

Read up about this project on

Closed loop universal motor control system using PID algorithm.

WARNING!!! At first, I'll write a quotation:

STOP!!! This circuit is attached to a 110-220 voltage. Do not build this if you are not confident about what you are doing. Unplug it before coming even close to the PCB. The cooling plate of the Triac is attached to the mains. Do not touch it while in operation. Put it in a proper enclosure/container.

WAIT!!! Let me just add a stronger warning here: This circuit is safe if it is built and implemented only by people who know what they are doing. If you have no clue or if you are doubting about what you do, chances are you are going to be DEAD!!! DO NOT TOUCH WHEN IT IS CONNECTED TO THE GRID!!!

Now let me introduce my project. It's an Arduino-controlled motor speed regulator which uses phase cut dimming method and PID algorithm.

There is the video where you can watch the controller at work:

Motor stuck protection at work:

After watching this video (in Russian language):

I decided to build a similar lathe. And successfully repeated this project. With some changes of course. Only one thing left - the motor. At first I used the asynchronous one phase motor with running capacitor. Main disadvantages of this kind of motor:

As you could notice the guy from video used the motor which was salvaged from old washing machine. The same motor I had in my workshop. Only one thing left - the motor speed controller. Without it the motor will spin at it's maximum 15000-19000 RPM. It's too much for wood lathe. To control the motor peed we could use a SCR voltage regulator, but at low RPM the motor will be weak with no torque. Fortunately this kind of motors has tacho sensors and we can do a closed loop system to have a stable RPM even at load and control the torque.

There is well known chip TDA1085 which is specially designed to control motors with speed sensors speed. But I didn't had this chip and to see the RPM I had to make a tachometer. At Chinese stories I found a cheap AC motor speed controller with RPM stabilization feature. I bought one and tested. Everything is fine except few things:

After surfing the internet I found several speed controller projects and decided to make my own controller using found ideas.

There is a list of resources I used:

I won't give a theory how AC phase cut works because there is nothing new. I provided some links with dimming and motor control theory above (the first and the second link). NXP and Microchip has lot of useful information about controlling motors.

The schematic diagram drawn as separate blocks:

All components are soldered on protoboard. For more controllers I'll trace a PCB. Some pics:

I used a BTA41 triac because I had this in my stock. It's possible to use a 10-16 Amperes triac. I.e. BTA16.

Full listing of used components you could find in txt file in the zip archive.

I had the plastic enclosure in my workshop which met my requirements. So I used it for this project. The box dimensions: H 150mm (~5.9"), W 70mm (~2.76"), L 110mm (~4.33"),

I tried a lot of motor control and phase cut synchronization algorithms but most of them had own disadvantages. Motor control wasn't stable. Sometimes it jumped during start, sometimes during run. Sometimes motor ran till its maximum RPM for unknown reason. Finally I decided to use and understand a PID control method.

The code uses 2 external interrupts. One for zero crossing, one for tacho sensor. A timer for triac pulses delay control. A PID algorithm for output control in relation of setpoint and input. For soft motor start I made a RAMP acceleration algorithm. During start PID parameters has lower values and returns to normal values during motor run. This prevents against hard motor starting (jumping).

LCD refresh interval is 2 seconds. It's enough to observe real RPM change. Making this faster can affect the system stability. It's because the LCD library uses delay functions.

I used a lot of global variables to simplify a system tuning by your needs and different motors. Later I'll include test and tuning sketches into the archive.

All used libraries can be found in the zip archive.

I'm happy how my DIY controller works. Now I need to mount the motor on lathe and test in real environment.

I want to thank colleagues from Arduino groups on Facebook for help. And thank my wife for patience :D

Comments an questions are welcome.

Sorry for my English. ;-)

I added one new parameter to my code. It's pulley ratio. In my case it's 2.96. It's difference between smaller pulley on the motor and a bigger on the spindle. Pulleys I used were salvaged from dumped vehicles. Use a sketch without ratio parameter or set it to 1 if no pulleys will be used.

I mounted the motor on my lathe and tested it a little. I'm happy. Everything works like expected. It's enough torque even at low speeds.

Soon I will make a cover for motor, holder for control box and etc.

Arduino-Based Universal AC Motor Speed Controller - Hackster.io

Pure Sine Wave Inverter Module Hackster.io, an Avnet Community © 2024