Control servo motors with potentiometers and Arduino
Hi there. This is my first instructable, so I hope you will be patient with me if I make any mistakes setting it up.It is written for beginners like myself, so the more advanced among you can skip a lot of this and just get to wiring it up.
The goal I set myself was to be able to control the robot shown in this web site:
I needed to be able to control 3 different servo motors by altering the position of 3 potentiometers. There are lots of people out there doing things like this, but I couldn’t find an exact match for everything I needed, so I decided to post up this instructable to bring everything I learned together in one place so that anyone else who wanted to do something like this could get it up and running quickly. This instructable is really a summary of other peoples excellent work and effort.
Before I list out the individual steps involved in this, I want to give a quick explanation of how everything works.
The potentiometers send an analog signal to the Arduino. The sketch on the Arduino (more on this later) then converts the analog input from the potentiometer into a digital output and sends this output to the servo motor which then moves left or right by the appropriate amount.
The potentiometers are powered from the Arduino’s 5v line, while the servos get their power from the battery pack.
Important note: It is VERY important to ground the Arduino into the battery pack/servos to avoid nasty things from happening, but I will talk about this in more detail as we go along.
Step 1: Preparing Your Components
You need three 10k potentiometers with legs that can fit into a breadboard.
I found them here:
Next are the servo motors. I used the smallest ones as the load they would move would be very small and they were cheap.
Next you need a 4 AA battery pack:
A breadboard to connect everything up:
An Arduino Uno R3 (at least this is what I used):
A usb cable to connect the Arduino to a pc and power it:
The Arduino IDE software to upload the program that will control the servos:
Some male/male jumper cables and some jumper wire to make the connections
Breakaway header pins which will be used to connect your motors to the breadboard. I like these ones because you don’t have to adjust the plastic divider to get them to fit in a breadboard.
Step 2: Prepare Your Breadboard
A lot of bread boards are split into 2 sections along the power rails at the top and bottom(which caused me a bit of head scratching when I first started using them.) By using 4 small pieces of wire you can bridge across the gap to make sure your power goes all the way across the breadboard. I finally bought one which was connected all the way across but just in case you have this problem, this is how you solve it.
JLCPCB – Prototype 10 PCBs for $2 (For Any Color)
China’s Largest PCB Prototype Enterprise, 600,000+ Customers & 10,000+ Online Orders Daily
How to Get PCB Cash Coupon from JLCPCB: https://bit.ly/2GMCH9w
This Post / Project can also be found using search terms:
- arduino use potentiometers to find data in matrix
- how to control 4 servo motor with 4 potentiometter