Hi guys (and girls),
The Background
I have a small robotic company and I sell kits to students and newbie hobbyists. The kits consist off a small mobile robot bundled with a couple of sensors, two micrometal DC motors, an acrylic structure plus some other parts, most comes from Pololu. Everything is controlled by a regular Arduino and an Adafruit Motor Shield (v1) powered with 4xAA NiMH batteries.
This kit is very popular, but we are not satisfied with the overall performance, mainly because the restrictions imposed by motor driver shield we are using. It is a very good product but we don’t like:
- Having 4 DC motor connections when we only really need 2;
- Loosing almost all digital Pins to control the H-Bridge;
- Bad performance when controlling 3V micrometal gearmotors;
- Consumes too much “real estate” space in the chassi structure;
Our first attempt to improve the kit overall performance was to increase the input voltage going to 6xAAA batteries (7.2V~9V) and changing the 3V motor to 6V versions. Unfortunatelly (don’t know why) it didn’t improve well.
So we decide to take a more ambitious step and design “our own” shield. The idea is to take an Arduino Nano V3, a DRV8835 motor driver and create an “undershield” to make all necessary connections consuming the smallest space as possible.
The guidelines we have are:
- Share the same power source to control the Arduino Nano v3 and drive the motors; [EXTREMELLY DESIRABLE]
- Connect the control pins between the Arduino Nano v3 and the motor driver;
- Breakout all digital and analog pins with 5v and Gnd connections;
- Keep a small board size;
- Work realiably
What we have developed
I’m not an Electronic Engineer, my background is computer science, but the goal seems simple to achieve.
I opened eagle, designed a schematic, created some components and routed the circuit. Before sending the design to OSHPark, I took a protoboard to test it out.
It didn’t work.
When I connected only one motor it seems to work fine, but when I connected the second one the Arduino keeps resetting. When the code runs, the motor give me some “HUM” and then the Arduino resets. After some research I figured it out: The DC motors were introducing noise in the circuit and I needed some decoupling capacitors.
So I did it:
- Placed .1uF ceramic caps between the motors terminals;
- Placed a 200uF electrolytic cap between the VIN and Ground, close to the Arduino connection;
- Twisted the motor cables and the power source cable (6xAAA back-to-back battery holder);
It got better, but no success.
The Arduino could start the motor and keep them running, but every time I change the motor direction it resets.
The current (not in amps) problem
After further research, I discovered that changing the Electolytic cap to 470uF and placing it between the 5V and Gnd (instead of VIN) of the Arduino, solved the problems. I was happy. But then I made some stress tests. Created a code to change both motor directions at the same time at intervals of 200ms. After a few seconds the Arduino resets. It also resets pretty fast if I stall any of the motors.
I know that having two separate power supplies (with common ground) is probably the easiest answer, but as a design goal I want to have a single power supply for the whole system. That’s the way the Adafruit Motor Shield (schematic) always worked, I also used the DFRobot Romeo board (schematic) the same way. But they are based on the L298 and L293 H-Bridges, I’m not sure that’s the difference.
I’m seeking help here to find out a way (change the schematic) to solve this issue.
Stress code:
int D1 = 4;
int V1 = 5;
int D2 = 7;
int V2 = 6;
void setup() {
pinMode(D1, OUTPUT);
pinMode(D2, OUTPUT);
pinMode(V1, OUTPUT);
pinMode(V2, OUTPUT);
}
void loop() {
digitalWrite(D1, HIGH);
analogWrite(V1, 255);
digitalWrite(D2, LOW);
analogWrite(V2, 255);
delay(200);
digitalWrite(D1, LOW);
analogWrite(V1, 255);
digitalWrite(D2, HIGH);
analogWrite(V2, 255);
delay(200);
}
any input is really welcome.
Thank you all !!