Today we’re revisiting the topics of motors again. We’ve covered the basics of various types of motors in series previously, such as a 2 wheeled robot using stepper motors and RC car using DC and servo motors. This time we’ll cover the basic use of a servo motor, which we haven’t done before and design an easy DIY servo-controlled light switch so you can wirelessly turn on/off the light whenever wherever you want!
Note: the auto light switch we are about to make only works for a buttoned light switch system.
Section 1:
Section 2:
Figure 1. Servo motor
A servo motor is a type of motor that works by rotating a shaft connected to the engine throttle. Due to its ability of accurate rotation angle and speed control, servo motors are used in various applications, such as automated manufacturing, robotics and personal IoT projects.
A servomotor is a rotary actuator or linear actuator that allows for precise control of angular or linear position, velocity and acceleration. It consists of a suitable motor coupled to a sensor for position feedback. […] A servomotor is a closed-loop servomechanism that uses position feedback to control its motion and final position.
Servo motor has an encoder to detect rotation angle and using coded signals, an output shaft can be positioned to a specific angle. We can examine the differences between different types of motors:
It’s important you choose the right motor(s) according to their specific applications.
Figure 2. Various types of motors. Left to right, brushless motor, stepper motor, servo motor, and DC motor.
So, which servo motor should you purchase? Consider the following specificities when buying a servo motor:
2.1 Calculation of Torque
The most important thing you should understand, when using servo motors, is the amount of torque you need. The torque of a servo motor is indicated in units of kgf·cm or kg. As a method of calculating the torque, in the case of kgf · cm, it means that it can lift an object of N [kg] at a radius of 1 [cm]. For instance, if you want to lift a 5 kg product, and if the handle attached to the axis of the servo motor is 2 cm, a torque of 5 kgf × 2 cm = 10 kgf·cm or more is required.
Figure 3. Method of calculating torque
When moving a servo motor with Arduino, as with other motors, it is almost impossible to draw voltage or current from Arduino. In this case, you can take the external power supply and transmit angle control signals only from Arduino to control the servo motor.
For example, Arduino UNO R3, which is frequently used in this series, has I/O pins (digital/analog pins) that draw approximately 20mA from each individual pin (with possibility of damage if 40 mA+). Even though the operating voltage of the servo motor is 5V, since the power supply from the digital/analog pin is insufficient in electric current, the servo motor and Arduino can be damaged. So be careful when you supply power from I/O pins!
The absolute maximum rated current value (the current value which can not be drawn anymore) is 200 mA on the 5V or 3.3V pin, so it’s possible to use a small servo motor.
As an example, in the case of a servo motor with an operating voltage of 9 V, it’s necessary to supply power to the servo motor separately from Arduino as shown in the circuit diagram below.
Figure 4. Arduino and servo motor (separate power supply)
Also, when the servo motor’s operating voltage is small (i.e. 5V) and you want to share the power supply with Arduino, you can pull the current from 5V with the circuit below.
Figure 5. Arduino and servo motor (shared power supply)