Experimenting with servo motors
If your project involves something that moves like a robot or some kind of vehicle then there is a good chance that you will be wanting to use servo motors in some way to control it. If you are using Arduino then you will find that there is a handy library that you can use called 'Servo' which makes it all very easy.
But what if you aren't using an Arduino or for some reason you need to drive the servo some other way? If that's the case you will need to understand how servos work and what is required to drive them.
I'm going to tell you what you need to know about servomotors. I will show you how to connect one up, how to write a very simple Arduino sketch to experiment with and what exactly goes on inside a servomotor. I finish up with a set of traces from the Sound Card Oscilloscope taken from my experimental breadboard and I show you how to overcome one very common problem that you might come up against.
Arduino Uno and MG90S servo motor
Servo motors. What are they, how they work and how to control them? Servo motors are typically used for either positioning things in space or controlling speed. I'm going to deal primarily with positioning servos here but 'continuous servos' which are basically speed controllers are very similar. One sets a position while the other sets a speed.
Servo motors are used to drive and steer robots, model cars, boats and aircraft. They can be used as indicators or even to keep your solar panel pointed towards the sun.
Arduino Connections to SG90S Servo Motor
The experimental test circuit that I used is shown above. The servo needs only 3 connections. A ground or 0v, a 5v power supply and a control signal. I've also added a 4700µF Capacitor electrolytic capacitor across the power lines. More about this later.
The MG90S Miniature servo motor
MG90S Small & Compact Servo Motor
To demonstrate how a servo motor works I'm going to use an MG90S servo motor. This servo is probably one of the smallest you will find but it is still a capable device despite it's diminutive size. I purchased a pair of these motors for a personal project which I have yet to build.
The MG90S comes complete with lever type attachments so you won't have to worry about finding an accessory pack if you buy one. It's also an inexpensive device at around $5 in the US and £4 in the UK so it's an ideal motor to experiment with.
Positioning servo motors have a range of movement typically limited to 180°. The MG90S that I experimented with was slightly less than that. You will need to make sure that you know where the end stops are on your servo and take care not to drive the shaft past those points in case it causes damage to the servo. You can determine the stroke by experiment however and they can usually take a little abuse.
On the next page I show you the Arduino sketch that I used in my tests.