Let's Make Robots!

Arduino questions


i'm from germany and i'm trying to build my first Robot with the arduino Platform.

I've desided to build my own shild for the arduino.

It should be able to drive two motors and to connect 4 -5 servos to the arduino.

The first problems with the L293D Motordriver are solved and I've done that it works and avoids objects.

Today my servos arrived and i tested my shield with the servos.

and then the first problem:

the servo only work on Pin9 and 10. so i looked for the reason and recognized that in the servo lib of arduino its only possible to connect servos on 9 and 10. so i looked for another lib.. i found some=) but its not as easy as the standardlib.. http://www.arduino.cc/playground/ComponentLib/Servo

ok. and when I familiarized myself with the code the servo worked. but how long. now the arduino resets. probably because the servos need more recources.

My questin now is, if somebody now more concret why the µC resets and how its possible to connect 4 servos.

Pin 5,6,9,10 are reserved for the motors 



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I'm sorry, but I'm still confused..

 It sounds like you're trying to use just the Arduino to power the L293D, which just isn't going to cut it.. sounds like you're drawing too much, causing the hard reset.. (was stated previously) 

You need to connect the L293D to a bigger power supply, along with the Enable pins. Connecting the ground of the Arduino and L293D together (lol)


Pictures would be amazing. If you're running the Arduino and the L293D on the same battery, with different connections, you MAY be drawing too much power when turning on the motors, causing the power to dip too low, ending up with your uber reset! Alot of possibilities, a diagram at least of how you have it hooked up could be useful.:D


this is the shield i created for running the motors and servos. the 9V are also connected to the arduino. and JP3 is connected to arduino GND and +5V. but it should be a seperate power supply, right?


I mentioned it. i've connected the motors on 5,6,9,10

when driving backward 9 and 10 have to be high. but when attaching a servo (for example on pin 3 or 4 with megalib) this is not possible and the motors don't drive backward :'(

i tried everything. but when I attach the servo there is the problem. also when i detach the servo before driving backward it doesnt work. sh**.

Yes it should have a 2nd supply especially if you are intending to wire up the rest of those servo connectors. Add your extra battery pack to JP3. Leave JP3 ground also connected to the Arduino GND but don`t connect Arduino + to JP3 +.

ok.. i will adapt this in my next shield.


do somebody know... why my motors (pin 9 and 10) don't work with attached servo on megaservo-lib?

:'(   it's not workin'. Once I write  Servo1.attach(4, 800, 2200); arduino only drive forward?? does anyone know an answer?

The problem is, that PWM on pin9,10 and the megaservo lib uses the same timer (timer1). You can use other pins, for example pin 3, 11 uses timer2, pin 5, 6 uses timer 0.

Thanks a lot!!! I suspected something similar, but didn't know the thing with the timers.

Tank you again.

I really recommend the MegaServo libary, a very good solution for more servos or servos on non PWM pins.

hi, i've just tested the mega servolib.

#include <MegaServo.h>
MegaServo Servo1;

void setup() {

  Servo1.attach(3, 800, 2200);


void loop() {




its easyer to use.

but the same problem. restarts when motors drive (first time) and the restarts while turning the switch.

i think its the batterie's low voltage(9V). now its about 8V. perhaps the arduino now shut down.

i will recharge the akku and write again.



thanks for the lib.


Servos should really run from 4.8 to 6 volts, not 9 volts. The little 9 volt batteries can barely supply enough current to run the Arduino, the servos need something bigger but less voltage, like 4 AA rechargable batteries.

You could use 2 packs but connect the 2 grounds (negatives) together.

you usually have to connect two batteries to drive a bot with arduinoplatform? i tryed with one.

9V-Block (+) to arduino and pin8 of L293D

and (-) to Ground.

the servos are directly connected to the arduino.

now. the robot restarted also when i disconnected the servo.. it worked before.. so it must be the low bat..

can somebody tell me why it should not working as i connected it.

i don't want to connect two seperate batteries. not only because of the space.


ah.. and is it possible to tell the arduino not to drive when plugged in with usb? would be fine.


Tanks for your answers. I love LMR