Control Multiple Servo Motors Using Arduino

by hIOTron IoT in Circuits > Arduino

25 Views, 0 Favorites, 0 Comments

Control Multiple Servo Motors Using Arduino

Arduino servo motor.PNG

The project describes how to control one or two servo motors using Arduino.

Supplies

Hardware Components

Arduino Uno

servo motor

9V 1A Switching Wall Power Supply

Breadboard (generic)

About Project

servo motor.jpg

If we attach all the Servos to Arduino supply pins then do not work in a proper way due to the absence of sufficient current to drive all the motors.So we need to utilize a separate power supply for the motors, either it is from some adapters (5v 2A) or from 9v batteries.

Basically, a servo motor is an integration of DC motor, position control system, gears. Servo motors are accessible in various shapes and sizes. A servo motor will have generally 3 wires, one is for positive voltage second is for ground and the last one is for position setting.
For External Power supply we can utilize Adapters, RPS (Regulated Power Supply Instrument), or 9v batteries. Or else we can also utilize a laptop USB port to power the servo. For this, we just need to short the Arduino ground to external supply ground. Utilize the Arduino code, which is given below to program your Arduino.

Internet of Things Course Training will help you to know more about IoT Projects.

Run a Program

#include Servo servo1; Servo servo2; Servo servo3; Servo servo4; int i = 0; void setup() { servo1.attach(3); servo2.attach(5); servo3.attach(6); servo4.attach(9); } void loop() { for (i = 0; i < 180; i++) { servo1.write(i); servo2.write(i); servo3.write(i); servo4.write(i); delay(10); } for (i = 180; i > 0; i--) { servo1.write(i); servo2.write(i); servo3.write(i); servo4.write(i); delay(10); } }