Arduino resetting when running 2WD platform, why?

I have this 2WD Platform: http://www.robotshop.com/dfrobot-2wd-mobile-platform-for-arduino-4.html
It comes with 2 DC Motors: http://www.robotshop.com/dfrobot-6v-180-rpm-micro-dc-geared-motor-with-back-shaft.html

I am powering the 2 DC Motors with five regular AA Batteries.
I am powering the Arduino with one 9 Volt Battery.

The Arduino sends data to the H-Bridge from Analog-In ports (8,9,10,11).
The H-Bridge is powered by the five regular AA Batteries and connected to the motors.
The grounds from the 5 AAs, Arduino, and H-Bridge are all connected.

Intermittently, the Arduino will reset if the Arduino is telling the motors to spin.

Why is this happening?

Is it because 5 AA batteries is not the correct amount of voltage for the DC motors? Do I need capacitors?

Thanks.

What H-bridge are you using? A schematic would be helpful also.

Intermittently, the Arduino will reset if the Arduino is telling the motors to spin.

The oldest problem in the book. You need supply decoupling:-
http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html
and a common ground between the two supplies.
http://www.thebox.myzen.co.uk/Tutorial/Power_Supplies.html

I've added in two K5M 104 capacitors (.1uF, nonpolar).
They are placed between the H-bridge and the motors.

I checked again, and all of the grounds are connected.

Unfortunately the Arduino still is resetting.

Is that where the capacitors should be placed?
Am I using the correct capacitors?

Thanks.

I'd say the resetting of the arduino is due to somehow your motors are dropping the voltage supply to the arduino rather than elecrtical noise that caps are normally used for. Measure the voltage on the arduino 5v pin and the 9v battery while the motors are starting to see if there is a voltage drop.

I believe there is a voltage drop. How do I go about solving this problem?

Ok let make a trouble shooting
1_ Disconnect the both motors cables and use there a resistance with one LED, check one by one and see
if the problem is there.
2-If the problem is persist check another H bridge board (connect your resistance with one LED to the arduino directly)
in this way you will know who reset your arduino)

·why did you not post the full diagrams ?

Since you're already running the motors from their own supply I'd look at these things:

  1. Noise from the motors. Try adding .1 uF caps across the motor terminals (right AT the terminals).

  2. Verify that your bridge can provide enough current to the motors. (Please indicate the bridge you are using so folks don't have to guess whether that's the culprit.)

  3. You should have a shared 5V line between the Arduino and the bridge (that provides logic power to the bridge), and a shared ground. Ground from your 5 AAs should connect to the bridge, not to the Arduino. Some bridges will parasitically draw current from the motor power for their logic supply if the V+ logic line is left unconnected. That can cause weird behavior.

  4. Use a fresh 9-volt battery for the Arduino. When these things deplete they can put out some volts, but very little current.

A full diagram of the connection you're actually using would be helpful.

-- Gordon

Hi

I have purchased the same 2WD arduino chassis. I am facing a problem which i was hoping you guys could help me with.

I am using 6.5V 2700mAh rechargeable batteries. The datasheet for the motors says that at 3V the maximum speed is 90rpm. I use a linear regulator to step down my battery voltage from 6.5V to 3V. When i apply the 3V to the motor from the regulator output the motor spins well.

From the same battery pack i am powering the microcontroller. Another regulator steps down the voltage to 5V.

I am using an L239E motor driver which is capable of supplying 1A to the motor. When i connect up my entire circuit, the motor does not spin at the rated speed. It spins very slowly.

I believe the motors are not getting enough of current.

What do you think could be the problem?

Best Regards,
Yuveer

MonroeD, without a schematic we can only guess at what is wrong.

yuveer:
Hi

I have purchased the same 2WD arduino chassis. I am facing a problem which i was hoping you guys could help me with.

I am using 6.5V 2700mAh rechargeable batteries. The datasheet for the motors says that at 3V the maximum speed is 90rpm. I use a linear regulator to step down my battery voltage from 6.5V to 3V. When i apply the 3V to the motor from the regulator output the motor spins well.

From the same battery pack i am powering the microcontroller. Another regulator steps down the voltage to 5V.

I am using an L239E motor driver which is capable of supplying 1A to the motor. When i connect up my entire circuit, the motor does not spin at the rated speed. It spins very slowly.

I believe the motors are not getting enough of current.

What do you think could be the problem?

Best Regards,
Yuveer

  1. I can't find a datasheet for L239E motor driver. Can you provide a link? or did you mean L239D?

  2. The specification of the motor says that the locked rotor current is 1.5A at 3v. The L239D has an absolute maximum peak current of 1.2A. So you risk burning out the L239D if the motor stalls.

  3. The L239D data sheet says it drops typically 2.7v at 0.6A (source output saturation voltage + sink output saturation voltage). So you need to supply it with about 3 + 2.7 = 5.7v to get 3v at the motor.

dc42:

yuveer:
Hi

I have purchased the same 2WD arduino chassis. I am facing a problem which i was hoping you guys could help me with.

I am using 6.5V 2700mAh rechargeable batteries. The datasheet for the motors says that at 3V the maximum speed is 90rpm. I use a linear regulator to step down my battery voltage from 6.5V to 3V. When i apply the 3V to the motor from the regulator output the motor spins well.

From the same battery pack i am powering the microcontroller. Another regulator steps down the voltage to 5V.

I am using an L239E motor driver which is capable of supplying 1A to the motor. When i connect up my entire circuit, the motor does not spin at the rated speed. It spins very slowly.

I believe the motors are not getting enough of current.

What do you think could be the problem?

Best Regards,
Yuveer

  1. I can't find a datasheet for L239E motor driver. Can you provide a link? or did you mean L239D?

  2. The specification of the motor says that the locked rotor current is 1.5A at 3v. The L239D has an absolute maximum peak current of 1.2A. So you risk burning out the L239D if the motor stalls.

  3. The L239D data sheet says it drops typically 2.7v at 0.6A (source output saturation voltage + sink output saturation voltage). So you need to supply it with about 3 + 2.7 = 5.7v to get 3v at the motor.

It's not "L239"; the motor driver is an "L293".

Something you could try (I've heard it works) is to piggyback a second L293 on the first (if they are DIP ICs) - soldering the legs together.

Better would be to use an L298 h-bridge (which can supply up to 2A per channel - or 4A in bridged-mode to a single motor, if needed). If you do decide to use an L298 - make sure to add a heatsink if one isn't included with the driver board (ie, if you are homebrewing an L298 driver)...

cr0sh, thanks for that. If it's a L293E then it drops typically 2.6v at 1A. So yuveer needs to supply it with about 5.6v to get 3v at the motor.

Hi dc42, thanks for your prompt reply. It appears that the sink output saturation voltage was the problem. I am using the L293E motor driver and not the L298, but anyway, I simply increased the voltage to 4.2V (the L293E datasheet says that it drops typically 1.2V) and i manage to get 3V at the output of my motors. The speed looks good and i am satisfied.

Now i have a few questions with regard to this particular set of motors and chassis:

  1. If i am measuring a DC voltage of 3V at the motor terminals can i assume it is running at 90rpm as the datasheet explains? Also, at this voltage am i supposed to read a current of 60mA (no load current at 3v as per datasheet). I need to robot to travel slowly such that it will not spill a cup of coffee, thus i wanted to use PWM to drop the speed to about 30rpm.

  2. My goal is to make the robot travel as "straight" as possible. Like in a straight line, without line following software and hardware. It merely needs to go straight, but for like 12 meters. Now it appears that 90% of enthusiasts on the net seem to suggest using wheel encoders together with a PID controller. I have purchased a set of wheel encoders designed for this particular chassis. I found a good tutorial and some code on how to implement a PID controller: http://letsmakerobots.com/node/865#comment-72386 . My question is whether this is the most suitable method?

  3. Once i get the robot to go "straight" i would like it to turn 90 degrees (it can stop, turn on the spot, then go on). I know that the robot uses differential drive so its a matter of spinning the wheels in opposite directions. But i am having trouble estimating how much to turn the wheels. This one is a bit tricky. Any ideas?

Best Regards,
Yuveer

yuveer:

  1. If i am measuring a DC voltage of 3V at the motor terminals can i assume it is running at 90rpm as the datasheet explains?

If the motor is under no load and the bearings are good then the rpm should be close to the 90rpm specified. Speed will drop under load.

yuveer:
2) My goal is to make the robot travel as "straight" as possible. Like in a straight line, without line following software and hardware. It merely needs to go straight, but for like 12 meters. Now it appears that 90% of enthusiasts on the net seem to suggest using wheel encoders together with a PID controller. I have purchased a set of wheel encoders designed for this particular chassis. I found a good tutorial and some code on how to implement a PID controller: http://letsmakerobots.com/node/865#comment-72386 . My question is whether this is the most suitable method?

I don't have any direct experience of this, but you will certainly need wheel encoders to make the motors run at precisely the same speed, and PID controllers (= Proportional Integral Differential) are fairly standard for servos. Also, PID controllers will enable you to maintain 30rpm with variable load (e.g. slope). So I would say yes.

There is another solution based on measuring the back EMF of the motor while compensating for its resistance, but it will only give you the speed, and is difficult to use with PWM. Wheel encoders will give you the number of rotations as well, which enable you to measure distance travelled more accurately (assuming the wheels don't slip).

yuveer:
3) Once i get the robot to go "straight" i would like it to turn 90 degrees (it can stop, turn on the spot, then go on). I know that the robot uses differential drive so its a matter of spinning the wheels in opposite directions. But i am having trouble estimating how much to turn the wheels. This one is a bit tricky. Any ideas?

That's down to simple geometry, if you can assume that the wheels don't slip. The radius of turn will be half the distance D between the wheels, so to turn 90 degrees each wheel must move distance pi * D / 4. If the radius of the tyres is R then each wheel needs to rotate N turns, where N = D / (8 * R).

Hi

I am using the yellow geared motors which come with the 2WD arduino chassis.

I am having a problem with my motor control. I am using an L293E motor driver with 4 flyback diodes, and a 100nf capacitor accross the motor input. The flyback diodes are to prevent the high inductance voltage spike and the capacitor blocks out high frequency noise.

I wrote a simple program where i press a push button, and the motor runs for 5 seconds then stops. The motor works beautifully when i set the enable pin to HIGH, but when i apply PWM on this pin, the motor gives this weird "whistling" noise and it does not spin at all.

I am using a single power supply of rechargeable batteries with 2700mah capacity (6.5V). This is more than sufficient i believe. I have two LM317 regulators connected to the battery. One is used to produce 5V for the microcontroller, and the other 4.2V for the motor. (The motor driver drops 1.2V so the motors see 4.2 - 1.2 = 3V).

Any idea what the whistling noise is and how i can eliminate it and get the motor to spin?

I'd be interested to know how any of you guys are controlling the speed of these motors?

Best Regards,
Yuveer

yuveer:
Hi

I am using the yellow geared motors which come with the 2WD arduino chassis.

I am having a problem with my motor control. I am using an L293E motor driver with 4 flyback diodes, and a 100nf capacitor accross the motor input. The flyback diodes are to prevent the high inductance voltage spike and the capacitor blocks out high frequency noise.

I wrote a simple program where i press a push button, and the motor runs for 5 seconds then stops. The motor works beautifully when i set the enable pin to HIGH, but when i apply PWM on this pin, the motor gives this weird "whistling" noise and it does not spin at all.

I am using a single power supply of rechargeable batteries with 2700mah capacity (6.5V). This is more than sufficient i believe. I have two LM317 regulators connected to the battery. One is used to produce 5V for the microcontroller, and the other 4.2V for the motor. (The motor driver drops 1.2V so the motors see 4.2 - 1.2 = 3V).

Any idea what the whistling noise is and how i can eliminate it and get the motor to spin?

I'd be interested to know how any of you guys are controlling the speed of these motors?

Best Regards,
Yuveer

According to the datasheet, at 1A current the motor driver drops 2.6v typical, 3.6v maximum (you need to add the source and sink output saturation voltages together). So 4.2v is a little low.

You should have a large capacitor (say 1000uF) between the L293E VS pin and ground (the ground connection of the capacitor should be close to where the 2 current sense pins and the flyback diodes are connected).

The whistling sound is probably PWM. You may need to increase the PWM frequency to reduce or get rid of it. if you increase the PWM output to near the maximum (255), I would expect the motor to turn anyway.

Ok so i have increased the voltage on Vs to 5.5V. I dont have the correct resistor values to get exactly 6V.I have added the 1000uF capacitor on Vs to ground.
I have changed the duty cycle to 255 and you are correct, the whistling goes away and the motor spins quite well. Then i tried reducing the duty cycle to about 190 (75% of max rated rpm), and then the whistling started again.

You see i am designing a robot which can carry a cup of coffee. So i need it to move slowly to avoid spillage. This is the reason i chose to run the motor at 3V (90rpm), and i thought i would play around the the PWM duty cycle and select a decent speed. I learnt that some DC motors dont like PWM and do not work under PWMs less than 40%. I'm not too sure about these motors though.

I have decoupling capacitors everywhere. Could it be the regulator?
Is there anything else i could maybe try?

Wow....ok i just figured this out right now...
It works with the duty cycle of 190, but its very twitchy. The whistle comes, and the motor doesnt move, but if i give the motor a slight push with my hand then it works.
I wonder why...hmmm.

It sounds like the motor torque is only just enough to move the robot at PWM 255. I suggest a higher gear ratio or smaller wheels, which should both increase torque and reduce speed. Alternatively, add a sensor to measure the motor or wheel speed, then you can program it to give the motor a shove at pwm 255 to start it off and reduce the pwm once it is moving.

Ok so now i am weird problem.

If i connect either motor to the A,B,Enable1 inputs of the motor driver, the motor spins (even with PWM).
But when i try the motor on C,DEnable2, the microcontroller resets (even if no motor is connected to A and B)

It seems like the right hand side of my chip is faulty.
I have a 1000uf cap from Vs going to ground. and i have four 100nf capacitors connected to the motor outputs with 1n4001 diodes. Maybe i need shottky diodes since they're faster? I dont know. Any ideas?