HELP!! with DC motor & Arduino NANO - What am I doing wrong ?

Hello there,

First, Thank you for taking the time to look at my problem.

Basically, I'm new to arduino and electronic stuff. I'm still learning....

My first project is to build an Simple RC car with smaller elements as much as possible at the same time without too many complex stuff.

So, I chose arduino nano + A Simple DC Motor Driver to drive 2 DC motors ( forward/reverse and turn left/right )

This motor driver I bought is cheap. It contains L293D Motor Driver chip on board without any capacitors, resistors or regulators. ( check diagram )

And Instead of big clumsy 4x AA battery box, I chose to use 9V battery to save space.

My problem:

I connected everything and used a simple code first to test spin the motor from the driver with a delay of 3sec ( forward / reverse )

The pins I used are 10, 9 and 8 ( Please check the schem/diagram )

The motor doesn't work. I mean.. It doesn't spin at all.

When I tried to push start the motor ( clockwise ).. It starts to spin and then stops within 2-3 seconds and I hear a weird strange noise inside the motor.

The motor I'm using..probably a 1.5-3v DC Toy motor. Cause, I ripped an existing RC Chinese CAR to take this motor. It had ceramic capacitors on the motor and on the Chinese circuit it was using a PNP or NPN transistor I guess.


What Am I doing wrong here ? ( What you see on my diagram is what I have right now. )
Your help will be much useful for me to complete this project.

Thank you so much once again for taking the time to read.

Looking forward...

RK

By the way... this is the 9V battery I'm using.

Here is the Arduino code i'm using for the test spin...

int enA = 10;

int in1 = 9;

int in2 = 8;

void setup()
{

pinMode(enA, OUTPUT);

pinMode(in1, OUTPUT);

pinMode(in2, OUTPUT);

}
void motorOne()
{

digitalWrite(in1, HIGH);

digitalWrite(in2, LOW);

analogWrite(enA, 200);

delay(2000);

digitalWrite(in1, LOW);

digitalWrite(in2, HIGH);

delay(2000);

}

void loop()
{

motorOne();

delay(1000);

}

Try modifying your sketch to log to serial when it starts up, and when it tries to turn on the motor - then you'll know if it's resetting itself.

Is the battery voltage plummeting when you try to turn the motor on? 9v batteries like that are terrible - the current handling capability is just awful. It's not at all uncommon for people to post here with projects where as soon as they turn the motor on, it resets everything because the battery can't supply the load. The one you showed a picture of looks like a crappy brand too.

Also, re: your steering plan, don't do it like that. Just use 2 identical reversible motors; to turn, run only one motor, or run them in opposite directions. Making the steering mechanism, and the centering mechanism to go straight, is a much bigger deal than just controlling the sides separately.

DrAzzy:
Try modifying your sketch to log to serial when it starts up, and when it tries to turn on the motor - then you'll know if it's resetting itself.

Sorry, Im not sure how to do that. But it actually tries to spin the motor. Because it spins for 1-2 sec and then stops and doesn't spin again. I mean it's trying to spin but all I hear is a weird strange noise from the motor.

DrAzzy:
Is the battery voltage plummeting when you try to turn the motor on? 9v batteries like that are terrible - the current handling capability is just awful. It's not at all uncommon for people to post here with projects where as soon as they turn the motor on, it resets everything because the battery can't supply the load. The one you showed a picture of looks like a crappy brand too.

I tried 3 different batteries with 2 types. 9V from HW and Duracell and 4 x AA batteries Duracell.
Both of them are not working. Although I noticed, When the motor try to spin the light on nano board is dimming a bit like a low-voltage. I'm not sure...If this is what you mean by plummeting.

DrAzzy:
Also, re: your steering plan, don't do it like that. Just use 2 identical reversible motors; to turn, run only one motor, or run them in opposite directions. Making the steering mechanism, and the centering mechanism to go straight, is a much bigger deal than just controlling the sides separately.

I'm not using my own custom chassis. Instead, I ripped an existing RC car ( ferrari italia, to be specific ) and working on it. It has 2 motors ( forward/reverse and turn left/right ). I wanted to have the same functionality I had before but with arduino.

PS: Have you checked my diagram ? anything wrong in that ?

Hi,
Do you have a DMM to measure voltages in your project.
As said before, the 9V batteries will not be able to provide the current needed to even start those motors through the driver.
The when you try to start the motor, the battery voltage, because it cannot supply the current needed to start, will drop and cause the nano to reset.
You will probably need a supply for the nano and a supply for the motor.

Tom... :slight_smile:

TomGeorge:
Hi,
Do you have a DMM to measure voltages in your project.
As said before, the 9V batteries will not be able to provide the current needed to even start those motors through the driver.
The when you try to start the motor, the battery voltage, because it cannot supply the current needed to start, will drop and cause the nano to reset.
You will probably need a supply for the nano and a supply for the motor.

Tom... :slight_smile:

Hi Tom,

I do have a DMM to measure the dc motor. And based on your reply, It is good to use 2 9V batteries ? 1 for powering nano and 1 for powering motors ?

Please check my updated diagram below and let me know....

Imgur: The magic of the Internet

My other biggest concern is to keep the batteries space as much small as possible, Which is why I chose 1 x 9V to fit inside the stock RC car. I don't think I have space for 2 x 9V's

My other question is.. How come these chinese RC car powers up with simple PCB that contains transistors, capacitors and PNP/NPN's to power these motors.

Can we use the same with 1x 9V Battery or 4 x AA batteries with arudino nano ?

I've also attached the Chinese PCB here: Imgur: The magic of the Internet

Ok I tried... based on your suggestion. I powered the nano via USB and motor driver + motor via 1 x 9V battery.

Surprisingly it started to spin for first time as expected with normal speed. But when I kept the motor with wheels connected on the ground. it stopped and I hear the weird strange noise inside the motor.

I used the DMM to check the volt and it says 0.7 V on DC motor.

The serial print log says.. the motor runs as per the program code.

This is the diagram I've used... please check:

Hi,
Have you got the neg/gnd of the arduino connected to the neg/gnd of the motor battery, you need this connection to have control current flowing from the output pins.

That PCB, what is on the other side, and that is what came out of the RC car?
How big is the car?

Tom... :slight_smile:

I think I connected the ground correctly ? Check here: http://i.imgur.com/BCUAO8F.png

Yes, That Chinese PCB ( http://i.imgur.com/FCiSXFl.jpg ) is what I found inside the RC Car

The car is around 8 Inches

Here is the actual motor-driver I'm using. I got this for around 2 USD off ebay


**It is similar to the diagram I've shown here... ** http://i.imgur.com/BCUAO8F.png

Maybe because it drops voltage constantly which is why my motor is not working ?

Should I use a driver with transistors & capacitors like this one ?

Driver 1: http://i.ebayimg.com/00/s/MTI1NFgxMjU0/z/Ye8AAOSwqu9VJjZu/$_12.JPG

Driver 2: http://i.ebayimg.com/00/s/MTE2OFgxNTEy/z/E~IAAOSwk5FU0ISm/$_12.JPG

Driver 3: http://i.ebayimg.com/00/s/MzAwWDMwMA==/z/NisAAOSwYGFUsV~h/$_12.JPG

4 AA alkaline batteries won't be enough - you're only getting 6 volts from those (1.5V x 4).

Also - know that the L293 drops 1-2 volts from the battery to the motor (and this gets worse as the current drawn increases).

Do you know what the stall current of your motors are? If you don't know that yet - you're shooting in the dark. Get a multimeter and measure it. It is critical to know this (for all you know, the L293 can't supply the needed current to get the motors running).

Hi
Can you post a picture of your entire project please.
Also please attach your files, do not have them as links.
That PCB, what is on the other side, and that is what came out of the RC car?

Tom.... :slight_smile:

cr0sh:
4 AA alkaline batteries won't be enough - you're only getting 6 volts from those (1.5V x 4).

Also - know that the L293 drops 1-2 volts from the battery to the motor (and this gets worse as the current drawn increases).

Do you know what the stall current of your motors are? If you don't know that yet - you're shooting in the dark. Get a multimeter and measure it. It is critical to know this (for all you know, the L293 can't supply the needed current to get the motors running).

Thanks for your reply. If 4 AA batteries are not enough.. how the stock Chinese RC was able to power up those 2 motors ? ( would like to know this )

When the motors run directly from 9v battery they consume around 1.5 to 3v. I checked with DMM

Are you saying the L293 is waste for my project and I should look some something more stable ?

TomGeorge:
Hi
Can you post a picture of your entire project please.
Also please attach your files, do not have them as links.
That PCB, what is on the other side, and that is what came out of the RC car?

Tom.... :slight_smile:

Thanks for your reply, I did post my entire project breadboard layout.

Attached it again, please check.

TomGeorge:
That PCB, what is on the other side, and that is what came out of the RC car?

I'm not sure what you mean, sorry. But that is what I got from the stock RC car. It contains some transistors, NPN/PNP resistors and something else weird. No idea what that is.

Hi,
What else weird?
Your picture of the board you took out of the car, what is on the other side of it.
A picture of your project please.

Tom....... :slight_smile:
Just recovering from triple fritzing.....
Draw a diagram please with your components.

What else weird?

Nothing, I was mentioning about the components on that chinese PCB.

Sorry I didn't get you earlier when you said the "other side" lol
There you go, attached now. ( attached: ChinesePCB-back.jpg )

Regarding the diagram,
I've already attached my layout 3 versions. it is using the same components I have, except the driver module. I have something like this.. ( attached: driver.jpg )

3 versions all fail. Giving me same issue.

The New-schem2.png is what I have right now.

Hi,
Sorry , attached not ChinesePCB-back.jpg

Tom.... :slight_smile:

Ouch sorry...

Attached now.

Hi,
Thats is the top of the PCB.
A picture of the bottom, the side with the copper tracks on it please.

Tom... :slight_smile:

Hi,

Sorry I saw this post late and apologies if my comments are not relevant.

A) I think might get it to work by using different sets of power sources for the motor and the arduino

A set of 4 AA batteries for motor driver and another for the arduino

B) Do NOT use 9V batteries, their internal resistance is high and the amps they put out are like 300 mAh or so
which is even less than a 1.5 V AA battery