Using Servo Motors with Arduino
Learn to use Servo Motors with an Arduino. Directly, and with a PCA9685 I2C Servo Driver.
Accompanying article with code: https://dbot.ws/servo
Today we’ll be making things move with Servo Motors!
Analog servo motors are inexpensive little powerhouses that can be perfect when you're designing something that needs to move. They pack a lot of torque for their size and their shaft position can be pretty accurately controlled.
We will start out by taking a look at how analog servo motors work and what kind of signal we’ll need to control them. We will also learn how to read the specs so that we can choose the best servo motor for our application.
There are two types of servo motors we will look at - conventional servos that rotate 180 or 270 degrees and continuous rotation servo motors.
Then it's time for the experiments. We will use a couple of the example sketches written for the Arduino Servo library to show just how easy it is to control a servo motor with an Arduino.
We will also examine a method of controlling LOTS of servo motors, the PCA9685 16-channel PWM controller board. As its name would imply this board lets you control 16 devices like servo motors and it interfaces to your Arduino or Raspberry Pi using the versatile I2C bus.
And if 16 servos still isn’t enough you can cascade up to 62 of these boards to drive an unimaginable 992 servo motors with just one Arduino!
I’ll settle for a more reasonable 4 servo motors, the 4 servo motors in the MeArm that I built in an earlier video. I’ll show you how to build a controller for the MeArm using an Arduino Uno and a PCA9685 board.
Here is the Table of Contents for this video:
00:00 - Introduction
02:14 - Servo Motor Basics
07:26 - Understanding Servo Specifications
09:25 - Servo Tester Demo
14:09 - Arduino Sweep Sketch
18:56 - Arduino Knob Sketch
25:12 - The PCA9685
30:05 - MeArm Controller
As always you'll find a detailed article on the DroneBot Workshop Website at https://dbot.ws/servo. It includes the sketches we cover in the video in an easy to download ZIP file as well as detailed explanations and links to other useful resources.
"Never trust a computer you can’t throw out a window." — Steve Wozniak
Need some help with connecting 2 servo motors to my Arduino Uno board. I can get one motor to work just fine, but not sure how to do 2. I'm a beginner with electronics.
When I started using Arduino, I ignored the requirement to connect the servos to the PWM outputs.
Having never had a particular problem, I no longer cared about it.
Today in my last video you can see that I am connecting 12 servos, from output 2 to output 13 on my quadruped which has 12 DOF.
How is it possible ? I do not know.
You can see the video here, 'https://youtu.be/QjqMBPAT7Uw', the Github link of the code is in description.