Energy reduction?


New code works well, but the motor moves slowly.


New power source plug in, code working = Nothing

Ok, time to order this one:


Hello, my first bot is having some issues with the energy management, I think.


Now, I've attached the servo to the pin 5 and grounded to the top GND of the arduino board ( next to pin 13). The motor is connected to the motor controller v3. and I have a blinking LED. The problem is that the servo takes all the energy( 9v battery) and the motor moves very slowly.

I will definitely appreciate any help.Cheers.

Maybe I am slow on the uptake here, but,

I don’t understand what you have arduino pins 8, 9, 10, 11, and 12 connected to. And, your servo sweep routine looks a bit wacky. You first tell it to go from 0 to 119 and then tell it to sweep from 80 to 0. You might be better off to have a pair of constants, one for MINSERVOPOS and one for MAXSERVOPOS.

Your problem is that a 9V

Your problem is that a 9V battery has not a lot of current capacity. Try AA batteries or another source and you will see a difference.

pin 8, 9 = motor 1pin 10, 11

pin 8, 9 = motor 1

pin 10, 11 = motor 2 ( not used)

pin 12 = LED

The servo code is just the example from the arduino library, but your suggestion seems right. Thanks.

I’ll post the updated

I’ll post the updated results with the new power source. Thanks.

My suggestion

would be to get rid of or at least comment out anything to do with pin10 and pin11. You aren’t using it so it doesn’t need to be included. Second, of the h-bridges I know about one typically sends a HIGH and a LOW for one direction and a LOW and a HIGH for the reverse of that direction. From the program you showed, you send HIGH on both pins in the backward and forward routines. Your motor should not move at all, ever. In fact, it should be locked in place, reasonably.

If I get rid of pin 10 and

If I get rid of pin 10 and 11 for some reason the motor shield stops working. LOW in the ‘backwards part’ makes no difference.

Pin 10 and 11 must be

Pin 10 and 11 must be connected to the motor drivers enable pins then, Just pull these pins high for continued operation.

Since my last suggestion didn’t work

How about you tell us what shield you have?

Hello, ok according to the

Hello, ok according to the internet it should be the motor shield v3( manufacterer A link:

And this is mine:


Alright, most helpful.

There is even code on that site. :slight_smile:

In the code provided at that site there is no mention of pins 8 or 9, only 10, 11, 12, and 13. Based on the code the site provides, 12 and 13 control the direction of the connected motor and 10 and 11 require a pwm signal to control the speed of that direction.

If I read the code on the site correctly, you should have been able to lift it from beginning to end and get your bot to move forward and backward. Rather than paste the code I will just paste the link

For Example:
To get a motor to move full speed in one direction you would need to put a high on pin 12 and then for full speed a high on pin 10, add a delay of a second or two and your creation should move either forward or backward depending on how the motor is wired. If you wanted to slow the motor down, you would instead use analogWrite on pin 10 with a value between 0/LOW and 255/HIGH.

Many thanks. I’m new to

Many thanks. I’m new to robotics programming despite that I’m a C programmer. Testing now!

The code works, but still

The code works, but still needs more power. The servo takes all the energy.

So what does 'new code works

So what does ‘new code works well, but the motor moves slowly’ really mean?

How slow is slow? Does it run any faster with the servo disconnected? Are you still using that 9V battery to power everything?

Runs faster with the servo

Runs faster with the servo disconnected. 9V battery still, but I’m waiting for a pack holder for the new batteries. Something that I want to mention is that with the usb cord plug in, the motor moves slowly as well. Cheers.

Both the power from a USB

Both the power from a USB and from a 9V have limited current to supply. In fact, all voltage sources have limited current to supply. The trick is to be sure the power source you use can supply at least as much current as your circuit will instantaneously draw.

Motors and servos draw quite a bit of current, especially when they first start up. So it seems extremely likely that with your motor and servo running, you are trying to draw more current from your 9V and from USB than it is designed to give. BTW, this can damage your USB port, which you probably don’t want to do.

I really think this is the source of your problem. When you get your battery holder in, try and see. Let us know how it works out.