Arduino 5 Minute Tutorials: Lesson 5 - Servo Motors

Hi Coleman. Many thanks for a great starters tutorial. I am a senior newcomer to this Arduino business, and am enjoying it immensely so far. Now then. If I may ask… I see in the program you allow 15ms for the servo to move one ‘click’ before the next instruction is given. I was wondering why this number exactly? Is this how long it takes an average servo to move up or down one value? Many thanks again. Nigel

@NigelB You mean the delay of ~20ms? The servo’s program is waiting for a timed “high” followed by a longer delay before this signal is re-sent. It’s just the way RC servos operate.

I have a question, I’m designing a prototype of an instrument and I am using a servo to spin a ratchet, the power consumption spikes up to 200mA for less than a second at every cycle.
Now, I am using a RedBoard to control the whole thing and it should be more or less the same as an Arduino Uno. I am using a Futaba S3003 servo and I am powering it directly from the board. I have read everywhere that I shouldn’t do that and that the board wouldn’t be able to power it, but when I tried it just for a laugh, it did work both from the 5V and the 3V pin. I have a reasonable torque out of the servo (likely not the 100% but it still gets the job done) and I’m thinking of keeping this solution to minimise wiring. I have measured the servo current draw at 9.5mA in idle and something around 200mA at the peak torque (in my application).
the question is: how come the servo is able to draw that much from the pin? isn’t the pin regulated?
also, the servo would cycle 12 times per day (2 cycles at 2h intervals), I had the servo operating non stop (with shorter cycles) for a few hours and I didn’t register any faults or overheating anywhere, so I would assume that the system would work in normal conditions. where am I wrong?

@Coleman Sir, my project is of a humanoid arm, more like demonstrating human-like finger movements. I’m using 5 servo motors for each finger. My question is, Is there any problem if I give common Vcc and common ground to the five servo motors, all of which I’m controlling through arduino?
Or would I need to separately give them supply?

@Ashish Mishra You should not use the Arduino’s IO pins to power these servos - you need to power them directly from a battery, but ensure they are all connected to the Arduino’s GND pin as well.

@Max On an Arduino Uno, the 5V output comes from the regulator: “This pin outputs a regulated 5V from the regulator on the board. The board can be supplied with power either from the DC power jack (7 - 12V), the USB connector (5V), or the VIN pin of the board (7-12V). Supplying voltage via the 5V or 3.3V pins bypasses the regulator, and can damage your board. We don’t advise it.” A digital IO pin however can only provide around 20mA of current. So long as you don’t have many other parts which draw current, and your power supply can provide the necessary current, you should be fine. A few cycles should not cause the servo to overheat.

i want to use servo motor mg996r. my project is when a sensor detect a water, the visor of helmet automatic will down (0 degree) and it stay that position until push on a button,the visor will up (90 degree), i also want to control servo in manual when push on button, the visor will down, then when i push off button the visor will up. i want in two condition manual and automatic. so how i create the coding to control that servo motor. can u help me?

@Atiey.M Unfortunately we are not in a position to teach you how to create custom code. We suggest a book which teaches you about programming in Arduino: https://www.robotshop.com/en/books.html

Hey I have a small query… I am trying to connect a motor controller (Talon SRX) with Arduino. Can you give me some inputs regarding the same.

@Krishna The Talon SRX seems to accept CAN, serial and digital PWM input. Arduino can directly communicate via serial or digital PWM. If you don’t have any other serial devices, try that first. If you have multiple controllers or the serial lines are used, treat it as a standard RC servo and connect the input to digital pin and use the servo library.

hey…i want move stepper moto when a desired rfid tag value given and stops when it find the value .how can i program

@manoj You need a stepper motor, stepper motor controller, microcontroller, RFID reader and RFID tag. Programming the setup is entirely custom.

need help in powering up my servomotors. im working on a project which has 2 microservos (SG90) and 2 normal servos (3.2kgcm torque and 6 kgcm torque). the two microservos are working perfectly with the supply from the Arduino UNO but the 2 high torque servos are not working. need urgent help!!!

@Nebu Note that you should not be powering the servos directly from the Aruino’s pins. Your power supply needs to be between 4.8V and 6V and able to supply enough current for all servos. Check the spec sheet for details.

Dear sir I want to run my servo motor for only 4 sec using Arduino uno and by using LDr as an switch for activation of circuit please please and please guide accordingly for it …please sir also send meh the code for this please sir

@sheikh Saqlain Unfortunately we cannot provide wiring / custom code. We suggest taking a look at digital connections and the servo library.

I am making a crane
I am.planning to use a metal clip (ones used to hang clothes) as the grabber
Is it possible to code?

Thanks for the lesson! I’m a total newbie so please forgive my ignorance. I have a servo motor(it says EM95 on the back) which I would like to use for an automation project. I need the motor to rotate a certain angle, lets say 15 degrees once every 30 seconds. I am looking for an Arduino controller which I can connect to my computer using USB and run the servo motor. Are these standard controllers which are capable of controlling any servo motor? The motor that I have has 6 wires going in, and I don’t know anything else about it.
Thanks in advance.

@shwetha Certainly, but you will need to adapt it to be connected to the servo.

@Raghav It sounds like an industrial servo (DC gear motor with encoder), you will need the appropriate motor controller (which can provide the current at the correct voltage), and connect the encoder (four of the wires) to the microcontroller.