Hi there,
I´m working on my first arduino project. It´s a bluetooth controlled toy car. The car isn´t a toy, I´ve bought the parts and ensembled them. I´m using arduino Mega 2560, and an Adafruit Motor shield.
The problem is that after a lot of reading, watching tutorials, and asking here in the forum, I´ve managed to get a working car. Just that: When I connect the car to the (motorshield ensembled) arduino, and the arduino to the computer using the usb port, I get wheels moving. But as it needs some extra power, I´ve attached to them the three AA batteries that came with the car that I´ve ensembled.
My problem is that when I use the batteries, the car won´t move. The arduino and motor shield leds will light up, but the wheels won´t move at all.
Why could that be?
Any help will be very much appreciated!
I´m attaching an image with the schematics, and the code that I´m using.
THANKS!!
Rosamunda
#include <AFMotor.h>
AF_DCMotor motor1(1);
AF_DCMotor motor2(2);
int SwichState=0; //estado inicial del swich
void setup() {
pinMode(31,INPUT); //tomamos data del botón
pinMode(51,OUTPUT); //preparamos la luz para encenderla al activar el motor
}
void loop() {
SwichState=digitalRead(31);
if(SwichState== HIGH){
motor1.setSpeed(1000);
motor1.run(FORWARD);
motor2.setSpeed(1000);
motor2.run(FORWARD);
digitalWrite(51,HIGH);
}else {
digitalWrite(51,LOW);
motor1.setSpeed(0);
motor1.run(RELEASE);
motor2.setSpeed(0);
motor2.run(RELEASE);
}
}
I suggest you either get a decent mosfet based motor controller with a low voltage drop (unlike the one you have at the moment), or try powering it from four 1.2V NiMH AA cells to increase both the voltage and the current capacity.
Thanks for your replies!!!
I think I´ll have to buy a decent mosfat after all
But what intrigues me here is that if I eliminate the arduino from the picture, and connect both DC motors directely and only to those 3 AA batteries, the car runs perfectly well, I mean with enough power to get it moving.
Because the Adafruit motor shield is based the L293D, on an old bipolar motor control chip that has a high voltage drop (typically 2.6V @ 1A load). A mosfet-based controller like this Motor Driver 2.5A MC33926 - ROB-11080 - SparkFun Electronics or this Pololu - TB6612FNG Dual Motor Driver Carrier will work much better for driving low-voltage motors. Note that the minimum supply voltage for these motor drivers is 5V and 4.5V respectively.
Thanks for your reply!
(I´ll have to go and have one of these. I´m on holiday now, out of my country, and I´ve bought these stuff to get acquainted with the arduino while on it).