Power supply problem for 2 wheel drive robot

Hi all,

I’m new to Arduino and electrical, and now are trying to make a 2 wheel robot controlled by bluetooth. These are the part that I use:

  • Arduino Leonardo Compatible by DFRobot : Link to wiki of the product
  • 2 DC motor, each in a gearbox connected to a wheel
  • L293D Motor Driver
  • HC-05 Bluetooth Module
  • 3 1K ohm resistor to make a voltage divider as suggested in this hc-05 tutorial : link

Everything related with the code goes well. The problem is everything related with the power supply. In general, I have 3 question:

  • Why is the dc motor goes very slow?
    I try to connect the motor directly to the battery and it goes quite fast, but when I connect the motor to the the L293D, it goes very slow that often I have to rotate the wheel with my hand first and only then the wheel can run by itself.
    Is it because the voltage is not sufficient? Or is it because of something wrong with the L293D? How much voltage do I need to run 2 dc motor using L293D?

  • Why is the code in the Arduino does not run when the arduino is started with only external power supply?
    The Arduino run well when it connected to the computer using micro USB cable. But When I powered it using external power supply (a battery), the LED on the Arduino turned on, but the code inside it is not executed. The only way I can get this to work is, connect the Arduino to the battery, and also connect it to the computer using a micro USB cable. The Arduino will start and execute the code. After that, I unplug the usb cable from the computer so that the Arduino will only get the power from the battery. After I unplug the USB cable, the Arduino will continue to operate.

  • What is the best scheme for power supply for this project?
    I think this might be related with question #2. The problem with this Arduino board I have is it do not have a Vin Pin. I asked the CS from the DFRobot, and they say the only way to power this board is to have a 5V±0.2V battery connected to the 5v pin of the Arduino. So what I’ve try in question #2 is:

  • Connect a smartphone power bank to the micro usb port of the board (the arduino board turned on, but doesn’t run the code)

  • Connect a power bank to the 5v port while also connect the board to the computer via usb cable (worked as explained in question #2)

  • Connect 4 AA batteries to the 5v port (I know this not follow what the DFRobot CS says, but I just curious to try it) while also connect the board to the computer via usb cable (worked as explained in question #2)

The paragraph above is about to power the Arduino. The other thing is to power the motor. What I had in mind, is to separate the power source for the Arduino and for everything in the breadboard. This work well, but still the motor is running very slow. These are the power supply option that I have:

  • A smartphone power bank (last checked giving a 5.03v)
  • A set of 4 AA batteries (last checked giving a ~5.74v)
  • A 9v battery (last checked giving a ~9.28v)

This is the breadboard layout that I use (bigger picture in the attachment or open the image below in the new tab):

I’m sorry if I asked to much with a long question. I hope you guys can help me :slight_smile:

Motors (of any sort) should not draw their power from an Arduino. You should have a separate power supply for your motors - perhaps 4xAA batteries or maybe even 6xAA. The motor power supply should have its GND connected to the Arduino GND.

I don't understand your questions about powering your Leonardo ? Why not connect (say) a pack of 6 AA cells to the barrel jack - a separate pack from the motor power supply.

...R

luqman_sungkar:

  • Connect 4 AA batteries to the 5v port (I know this not follow what the DFRobot CS says, but I just curious to try it) while also connect the board to the computer via usb cable (worked as explained in question #2)

That will be good way to get a new Arduino Leonardo Compatible board. The board only operate at 5V, you put higher then 5V will fry the board.

You need 5V voltage regulator for your Arduino Leonardo Compatible board, that board was design to work with Raspberry Pi, so it did not have barrel jack.

The image you link was misleading.

This is the board

As for the power supply to the DC motors, 12 V will be needed for each motor. You will have to provide a separate 5V DC power to run the Arduino Board.
You can couple two or more power sources to bring the input voltage to around 12V.

At 12V the motor will run in full speed and further the speed of rotation can be reduced with a suitable PWM code.

I did not understand the second part of the question properly.

inbrok:
I`ve the same problem

Do you have the same Arduino Leonardo Compatible board ?
what the same problem you have, one sentence will not able to help you solve your problem.

Hi, thank you for your answer and sorry for the late reply.

Robin2:
Motors (of any sort) should not draw their power from an Arduino. You should have a separate power supply for your motors - perhaps 4xAA batteries or maybe even 6xAA. The motor power supply should have its GND connected to the Arduino GND.

I don't understand your questions about powering your Leonardo ? Why not connect (say) a pack of 6 AA cells to the barrel jack - a separate pack from the motor power supply.

...R

sravan1993:
As for the power supply to the DC motors, 12 V will be needed for each motor. You will have to provide a separate 5V DC power to run the Arduino Board.
You can couple two or more power sources to bring the input voltage to around 12V.

At 12V the motor will run in full speed and further the speed of rotation can be reduced with a suitable PWM code.

I did not understand the second part of the question properly.

Wow, thank you very much, I didn't know that DC motors need that much of a power. I'll try to find another power source. But I'm curious, why with L923D, the motors goes slower compared with if the battery connected directly to the motor?

And for the second question, I can not get the board to run properly (turned on, but that's it. The board does not run the code that I upload into it) if I only using a battery/power bank to power the board from the start. The only way that I can get the board to run properly (turned on, and then execute the code inside it) is to connect the board to the computer while also give a power from the 5v pin (from power bank) at first, and after the board start to execute the code (the dc motor start rotating, the bluetooth can receive a command and process it), then I unplug the usb cable from the board, so it run only with power from the power bank and the board continue to run properly.
And as BillHo pointed out, my board does not have a barrel jack, so the only way to power the board is from 5v pin or from the micro usb port.

BillHo:
That will be good way to get a new Arduino Leonardo Compatible board. The board only operate at 5V, you put higher then 5V will fry the board.

You need 5V voltage regulator for your Arduino Leonardo Compatible board, that board was design to work with Raspberry Pi, so it did not have barrel jack.

The image you link was misleading.

This is the board

Haha, I found about that later, but fortunately, the board is not (yet) fried. I will not do that again after I know the consequences. But if connect a power more than 5v to the board through the micro usb port, will that be okay?

And I'm sorry because the actual image of my board is different with the image that I post. It is because fritzing didn't have the image of my board, and I think most of the pin I used in my board can be represented in the usual image of Arduino Leonardo. I also not aware that Arduino Leonardo have a barrel jack that my board didn't have. I should have posted the image of my board earlier.

Thank you all for your answer :slight_smile:

But I'm curious, why with L923D, the motors goes slower compared with if the battery connected directly to the motor?

With just the battery, the full voltage is available to generate current in the motor.
With the L293D, it acts like a switch with a diode or two in series, that diode having some voltage drop across it. The motor then sees less voltage, and less current flow.

Without L293D:
current = (battery voltage)/(motor resistance).

With L293D:
current = (battery voltage - diode drop)/(motor resistance).

Less current flow = slower motor.

That's why MOSFETs are used. Instead of having a relatively fixed voltage loss in the L293D,
there is a smaller voltage drop across the Rds of the MOSFET, perhaps as low as 0.005ohm (5mOhm).
Then for a 1 amp current flow, the voltage loss is .005V, and (battery - 0.005)V are available to the motor, vs (battery - (0.7V or higher)).
Data sheet shows 1.2 to 1.8V.

CrossRoads:
With just the battery, the full voltage is available to generate current in the motor.
With the L293D, it acts like a switch with a diode or two in series, that diode having some voltage drop across it. The motor then sees less voltage, and less current flow.

Without L293D:
current = (battery voltage)/(motor resistance).

With L293D:
current = (battery voltage - diode drop)/(motor resistance).

Less current flow = slower motor.

CrossRoads:
That's why MOSFETs are used. Instead of having a relatively fixed voltage loss in the L293D,
there is a smaller voltage drop across the Rds of the MOSFET, perhaps as low as 0.005ohm (5mOhm).
Then for a 1 amp current flow, the voltage loss is .005V, and (battery - 0.005)V are available to the motor, vs (battery - (0.7V or higher)).
Data sheet shows 1.2 to 1.8V.

Ah, so that's why. I think I need to learn more about L293D, mosfet, and another option for motor controller.
Thank you :slight_smile:

Hi, I’m a robotics teacher just starting out. My students have built a 2 wheel racer robot of the radio I uni platform. Upload to Bluetooth was successful, pairing remote also good but the robot won’t move????? Any suggestions to check?

Yes, several in fact.

Go read the sticky post at the top of this forum named How to use this forum - please read.
It has a lot of great information for new forum members.

Do not post a new question on to a 2 year old thread.
Go create a new post with a good descriptive title.

Post your code. Use the code tags.
Post a wiring diagram. Pencil, paper and a camera are good enough if you include good detail.