Drone Motors with Arduino

Hello,
I am using a ardunio nano connected to a custom shield that has 4 10A transistors on it connected to the PWM pins to control the motor speed. When I connect both the battery power supply and the 5V USB power to the nano, the motors respond and act perfectly. When I disconnect the USB power and just run it off the battery (which are two 3.7 volt lipo connected in series), the nano seems to reset immediately. The motors click and move about 5 degrees in rotation. Any help would be greatly appreciated, and I have attached the schematic diagram of the custom shield below for reference.

Shield.pdf (15.9 KB)

Do you have freewheel diodes across the motor coils?

Depending on the size of the motors additional capacitance may be needed on the power rail.

Do you have freewheel diodes across the motor coils?

Depending on the size of the motors additional capacitance may be needed on the power rail.

Yes. need diode and simple capacitor across with this motor.

Hi,
What transistors are you using and where are the base current limit resistors?

Are the two LiPo batteries also powering the motors?
What Ah rating are they?
Have you measured the battery voltage when you run with USB and without USB?

Also I see no bypass capacitors.

Can you tell us your electronics, programming, Arduino, hardware experience?

Thanks... Tom... :slight_smile:

Hi,
When you are using Vin as your supply it has to be at least 8V, so the nano controller regulator can work.

With high load of motors the battery voltage will change and it will not be high enough, the 5V regulator will drop out and cause the nano to keep resetting.

Tom... :slight_smile:

TomGeorge:
Hi,
When you are using Vin as your supply it has to be at least 8V, so the nano controller regulator can work.

I have no issues running down to about 6v with good lipo batteries and good decoupling.

The brownout voltage of the 328 is 4.3v on most 5v boards and there is not anywhere near 3v dropout.

mschindl:
Hello,
I am using a ardunio nano connected to a custom shield that has 4 10A transistors on it connected to the PWM pins to control the motor speed. When I connect both the battery power supply and the 5V USB power to the nano, the motors respond and act perfectly. When I disconnect the USB power and just run it off the battery (which are two 3.7 volt lipo connected in series), the nano seems to reset immediately. The motors click and move about 5 degrees in rotation. Any help would be greatly appreciated, and I have attached the schematic diagram of the custom shield below for reference.

You have no base resistors and expecting a single transistor stage to amplify the Arduino's
30mA output current to 10A (a gain of 300 whereas as a switch a transistor has a usable gain of 20 at most).

I'd recommend using logic-level MOSFETs instead of BJTs, makes the circuit simpler and better performing (only need one stage, higher frequency PWM can be used if you get the details right)

When I disconnect all but 1 motor, the arduino is able to power up the motor and itself just fine, even when connected to only a single 3.7V battery. When I try to connect more than 1 motor, the motors click on and then the arduino resets. Both the nano and the motors run on the same power supply. I have soldered a 220uF polarized capacitor directly on to the nano's Vin and GND pins. This unfortunately did not help the situation. I will be switching out the transistors for MOSFET's soon, will this help the situation at all? None of the motors have flashback diodes on them yet, if I were to add them, would I solder them directly to the power and ground wires of each motor?
Thanks for all the help.

So a little update of what I have tried so far...

*Added a 220uF capacitor to the Vin and GND pins on the arduino nano.
*Added a diode across the motors.
*Added a small ceramic 0.1uF Capacitor across the motors.

When I plug just 1 motor in, the motor and arduino will operate fine. I can push the motor up to full power with no glitches. When I plug in two motors, I can only push the motors to about half power using the remote control. Again, both the motors and arduino and being powered by the same battery, and the whole system is being controlled through another arduino via radio signals. Even with the changes I am still running into the same issue with no improvements, any recommendations would be incredibly helpful.

I have attached a schematic showing the modifications I have made to the original circuit.

Shield (moddified).pdf (17.1 KB)

Hi,

You need to add base resistors to your power transistors.

What is the voltage across the battery with the motor running and what is the voltage across the motor with it running?

Thanks.. Tom.. :slight_smile:

You are narrowing it down, all these things that have been mentioned are needed,

Diodes, caps, base resistors and a good power supply.

The physical layout and wiring choices matter too. Maybe post a pic of the setup?

Hi,
Can you post a picture of your drone motor please and a link to its spec/data sheet.

Also post a copy of your code.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks... Tom.. :slight_smile:

Hi,
Check the PWM pin allocation on a nano please?

Pins D3, D5, D6, D9, D10, D12

Tom..... :slight_smile:

I did some voltage measurements...

Battery: 7.7V
Battery with Motors on: 7.01V (Last measurements before motors cut out and arduino reset)
Voltage across motors: 3.57V (When only 1 motor is plugged in to prevent reset)

I tried to add base resistors before but it severely slowed down the motors power. I did use a 1K Ohm resistor though. Is there a recommended base resistor value to use? Also, will switching to logic level MOSFET's solve any issues? I have also attached a picture of the drone circuit below. A little messy, I know, but I can assure you everything is connected securely.

As for the drone motors themselves, they are brushed drone motors that I took out of a Syma x5c. I do not have the code on me, as my coder has it saved on his computer. It is just a basic PWM signal based on the remote control feedback. The code works perfectly fine when the nano is being powered through USB and the motors are running off the battery.

Hi,

Also, will switching to logic level MOSFET's solve any issues?

Yes, you will get less voltage drop across the switching MOSFETS.
Use a 470R series gate resistor, and a 10K from gate to source.

7.01 - 3.75 = 3.26V

You are at the moment loosing half your potential across the transistors.
What is the current drawn by the motors with propeller fitted?
Your shield will have to carry 4 times that current to the switching devices?

Without your code, I assumed you were using the nano analogWrite PWM statemant.
OPs pics.

Thanks.. Tom.. :slight_smile:

I'm pretty sure it's 3,5,6,9,10,11. Not 12.

Hi,
Hmm,yes, other sources give 11, but my diag gives 12.

Tom.. :slight_smile:

On the ATmega328 Arduinos:

timer0 controls 5, 6
timer1 controls 9, 10
timer2 controls 11, 3

Those are the only hardware timers, no other pins have hardware pwm.

So after much testing, I think I have isolated the main issue.

When the arduino is powered by a separate isolated power supply (like the USB port) everything works fine! The motors can reach full speed no problem. When both the arduino and motors are powered by the battery, and the motors start to spin to fast, the arduino resets. So the issue is with the power supply.

So my question is, what is the best way to stop all of this noise and give a nice voltage to the arduino?

What kind of lipo batteries are these? Some small 3.7v have low voltage cutoff circuits soldered onto the battery. Take a look and see if you can see a tiny little circuit board by where the battery leads come out. If you do the battery might not be able to deliver a high current. To be clear your are using 7.4v?

The answers we gave ARE to reduce electrical noise and hopefully stabilize the power rail. There will be a inductive spike when the transistors turn off , the diode handles this( should be a fast diode), There will be voltage fluctuation on the main battery lines, the big cap helps this(low esr). There will be noise from the brushes. A small 0.1 uF helps this across the motor terminals helps this. Finally the base resistors limit the current from the Arduino pin.

Your wiring has to be able to handle the current.
These few things are all really all that is needed to successfully run a motor. I have motor drivers that use up to 30 amps at 12v and they still just use the things mentioned here.

MOSFETs would be much better choice than bjt transistors.