Arduino questions

Hello,

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

 

thanx

I havent used an Arduino but
I havent used an Arduino but it is possible that using that many servos takes too much power away from it and causes it to brown out or reset due to lack of power. If you need to control that many servos put them on a different power source. Just remember to tie the grounds together or it won’t work.

Check out the MegaServo lib

Check out the MegaServo lib from arduino.cc: http://www.arduino.cc/playground/Code/MegaServo

I never used it but it can control up to 12 servos. If you don’t want to do that, maybe invest in a serial servo driver like the Lynxmotion SSC-32: http://www.lynxmotion.com/Product.aspx?productID=395&CategoryID=52 which can control up to 32 sevos by having the arduino send serial commands with pins 0 & 1.

About the Arduino resetting, you need a separate power supply for your motors and servos.

Are you running everything

Are you running everything from a single power supply? It could be that the servos are causing the battery voltage to drop too low.

Also are you using analogWrite functions for PWM motor control, or just straight up on/off? If not the MegaServo library is better because it takes care of the refreshing automatically where as the one you linked requires you to refresh manually every 50ms. However it uses the 16 bit timer which is also used by analogWrite.

Thomas beat me to it! Curse

Thomas beat me to it!

Curse you Thomaaaasssss…ss…

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

first test

hi, i’ve just tested the mega servolib.

#include <MegaServo.h>
MegaServo Servo1;

void setup() {


Servo1.attach(3, 800, 2200);
Servo1.write(90);
delay(300);

}

void loop() {

Servo1.write(90);
delay(500);

Servo1.write(0);
delay(500);

}

 

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.

 

I’m sorry, but I’m still

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.:smiley:

**You didnt answer the**<br>You didnt answer the question from earlier. Are you running everything from a single 9v battery?

Servos should really run

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.

connection

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

The 9 volt battery is only

The 9 volt battery is only capable of a small amount of current. The Arduino only requires a small amount, so it can run on the 9 volt for a while just fine by itself. Servos require a lot more current, as they are physically moving something more than electrons. And servos are only rated to run off 4.8 volts to 6 volts, higher voltages can destroy them. It sounds like your shield has the servos powered from the regulated 5 volts of the Arduino, not directly to the 9 volt. If you posted the circuit, it might help. If you want to run off one battery, try running 4 AA batteries, as it will last longer than the 9 volt.

Yes, it is possible to run the Arduino on the USBV< and I have run 2 small servos with it too on USB. USB can deliver up to 500 mA at 5 volts. But servos really require a strong battery pack to supply them.

 

Yes

Yes. the servos are powered from the regulated 5volts of the arduino. and its working. but since i controlled the servos with the megaservo lib, the motors only work in one way(forward). strange…

Can 4AA supply the arduino?? i thought it need minimum 9V.

ah. and. is it possible to code the arduino, that it only drives the motors when its connected to the batterie and not to usb. The robot drives away when uploading code.

depending on your setup, if

depending on your setup, if you’re using a voltage reg like a 7805 you’ll need more than 4 aa cells as it won’t output the 5v you should be running at. though you could run a zener diode(5.1v)or a regular diode 4001 as well to cut the voltage down.

From my personal expirience with 9v batteries, I’ve run several procs off of one doing various tasks just to prove that they could run a lot more than some people seem to think. I’ll have to find that posting…it’s on here somewhere.

 

EDIT: oh yeah, I have the image :smiley:

multiproc.jpg

My Duelmilanove runs fine on

My Duelmilanove runs fine on 4 AA rechargables, a 4.8 volt source. It might be better to boost up to a 5 AA pack for 6 volts, to get closer to the low drop out voltage of the regulator mine has on board.

I do not know which Arduino you are running, with which regulator.

Based on what you’re saying,

Based on what you’re saying, everything in on one power supply. Your servos and motors should be on a seperate power supply than the Arduino. Meaning, you shouldn’t plug motors or servos into the regulated 5 volts of the Arduino. This is just common practice that I adhear to, I guess, based on what voodoo says, you don’t have to, but it’s what I’ve learned.

Maybe you know that already, I can’t tell. Like others said, a schematic or picture would be nice.

this is the shield i created

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
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

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
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.