2 Servos Controlled by a Joystick
by Evanlgks in Circuits > Arduino
153 Views, 5 Favorites, 0 Comments
2 Servos Controlled by a Joystick
This circuit is designed so that depending on how a joystick is moved, a servo will move in a similar direction. For example, if the joystick is pushed left or right, one of the servos will move when triggered, and if the same joystick is moved up and down, then the other servo will trigger.
Contributors:
Evan T
Evan B
Jaden B
Cruz V
Elijah S
Kevin L
Supplies
Bill of Materials
================
Code
We put this code into the Arduino IDE 2.3.2
and the notes tell what each line of code does.
Connecting Positive, Negative and the Capacitors
Positive and Negative
- To connect negative you first need to find the ground pin (marked gnd and in white on the Arduino) and connect the ground pin to the negative lead on your breadboard (marked - )
- To connect positive you need to find the pin marked 5V (next to the gnd pin on the Arduino) and then connect the 5V pin to the positive lead on your breadboard (marked +)
The Capacitors
One important thing to understand about polarized capacitors is that they have a positive and negative, because of this it does matter how you attach the capacitors. The positive is on the long leg and the negative pin is on the short leg of the capacitor
The function of the capacitor in this circuit is to stabilize the current and keep it constant instead of in pulses.
Where you put the capacitor doesn't really matter but i still would recommend separating them on different sides of the breadboard for ease of putting it together
Wiring the Servos
The servos have 3 places to connect wires. The Control pin, Positive, and Negative. The control pin on the servo is orange, the positive is red, and the negative is black.
- To connect the servos to the Arduino find the Control Pin, then connect the control pin to either pin ~9 or pin ~10
- the Positive of the servos to the positive on one of the Capacitors and do the same for the Negative.
Wiring the Joystick
The joystick works by using 2 potentiometers attached to a single control stick, those potentiometers are what we are using to control the servo
- To connect the joystick you need to first look at the pinout of your specific joystick. You want to find the pins GND, +5v r VCC, VRX/Vert, and VRY/HORZ. First connect the 5V pin to the positive of the second capacitor and the GND pin to the Negative of the same Capacitor.
- Connect the Vert to pin A0 and HORZ to pin A1
Your Done
if you followed the steps correctly you should have a working circuit, if not do trouble shooting idk