Go Down

Topic: Not enough power driving wheels of 2wd arduino robot!!! (Read 2575 times) previous topic - next topic

I'm new to electronics and arduino and I have successfully built the 2wd robot with the pan/tilt sensor. The problem I have is that there is not enough power to drive the wheels. I have a 4 cell battery pack and even tried boosting it with a extra 9v battery but it doesn't make any difference. When I switch it on the sensor moves and the wheels move slightly but after that nothing but a noise from the motors.



Any help would be appreciated, here is the code I've uploaded incase there's something I can do there to help.........

#include <AccelStepper.h>

// Magic03
// This code is designed for the Dagu Magician Chassis
// Using a Pan & Tilt asseply with an HC-SR04 Ultrasonic Sensor
//
// The motors are controlled using the Adafruit Motor shield library
// which must be downloaded and installed first
// copyright Adafruit Industries LLC, 2009
// this code is public domain, enjoy!

#include <AFMotor.h>
#include <Servo.h>

AF_DCMotor mLeft(3);
AF_DCMotor mRight(4);

int panPin = 9;  // this is Servo 2 on the motor shield
int tiltPin = 10; // This is Servo 1 on the motor shield
Servo panServo, tiltServo;

int pingPin = A0; // Analog pin 0 used for the Ping Pin (Trig)
int inPin = A1; // Analog pin 1 used for the Echo Pin (Echo)
unsigned long duration, inches;
int indec, cmdec;
int inchconv = 147; // ratio between puls width and inches
int cmconv = 59; // ratio between pulse width and cm
String s1, s2, s3;
int panCentre = 110;

void setup()
{
  Serial.begin(115200);
  pinMode(pingPin, OUTPUT);
  pinMode(inPin, INPUT);
  panServo.attach(panPin, 1000, 2000);
  tiltServo.attach(tiltPin, 1000, 2000);
  pointCentre();
  tiltServo.write(90);
}

void loop()
{
  int cm, lcm, rcm;
  forward(200);
  delay(100);
  cm = getDistance();
  if(cm < 30)
  {
    halt();
    pointLeft();
    lcm = getDistance();
    pointRight();
    rcm = getDistance();
    pointCentre();
    reverse(255);
    delay(400);
    halt();
    if (rcm < lcm)
      spinRight(255);
    else
      spinLeft(255);
    delay(200);
    halt();
  }
}

void pointLeft()
{
  panServo.write(panCentre - 60);
  delay(150); // wait for servo to get there
}

void pointRight()
{
  panServo.write(panCentre + 60);
  delay(300); // wait for servo to get there
}

void pointCentre()
{
  panServo.write(panCentre);
  delay(150); // wait for servo to get there
}

int getDistance()
{
  int rval;
  digitalWrite(pingPin, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(pingPin, LOW);
  duration = pulseIn(inPin, HIGH, 38000L);  // Set timeout to 38mS
  rval = microsecondsToCentimeters(duration);
  Serial.println(rval);
  return rval;
}

void forward (int spd)
{
  mLeft.run(FORWARD);
  mRight.run(FORWARD);
  mLeft.setSpeed(spd); 
  mRight.setSpeed(spd); 
}

void reverse(int spd)
{
  mLeft.run(BACKWARD);
  mRight.run(BACKWARD);
  mLeft.setSpeed(spd); 
  mRight.setSpeed(spd); 
}

void spinLeft(int spd)
{
  mLeft.run(FORWARD);
  mRight.run(BACKWARD);
  mLeft.setSpeed(spd); 
  mRight.setSpeed(spd); 
}

void spinRight(int spd)
{
  mLeft.run(BACKWARD);
  mRight.run(FORWARD);
  mLeft.setSpeed(spd); 
  mRight.setSpeed(spd); 
}

void halt()
{
  mLeft.run(RELEASE);
  mRight.run(RELEASE);
  delay(10);
}

long microsecondsToCentimeters(long microseconds)
{
  return microseconds / cmconv;
}

PaulS

Your thread title suggests a lack of power, but you don't tell us near enough about the power source. Instead, you incorrectly post a bunch of code that has nothing to do with the problem.

Would you care to try again?

PeterH

You're suggesting that the batteries aren't capable of driving the servo and motors, and it's quite possible that's right.
How much voltage and current do your motors need?
What sort of batteries are you using? How much charge do they have in them?
What is the battery voltage when the motors are switched on?
I only provide help via the forum - please do not contact me for private consultancy.

Ok, so I'll repeat. I'm new to ALL of this. here is the kit I built.....

http://www.ebay.co.uk/itm/160880393469?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649

I followed all the correct instructions, I use a 9v battery to power the Arduino and 4x1.5v battery pack for the motors.

as far as the current getting to the motors< I don't have a clue??? Sorry.

If any of this is of help and you can advise me, thank you.

PaulS

From your link:
Quote
A 3-cell AA battery box is included, however this makes the motors very underpowered so we recommend using a 4-cell box for alkaline batteries, or 5-cell for rechargeables

So, using 4 cells results in the motors only being underpowered, as opposed to very underpowered.

Are your batteries fully charged? Reputable manufacturer, not some crap from China, made 12 years ago and sitting around waiting for a sucker (I meant buyer) to come along?

That 9V battery needs to be put back in the smoke detector, too. Use the 4AAs to power the Arduino and get a real battery to power the robot.

PeterH


If any of this is of help and you can advise me, thank you.


Well, you could answer any of the questions I asked.

How much voltage and current do your motors need?
What sort of batteries are you using? How much charge do they have in them?
What is the battery voltage when the motors are switched on?
I only provide help via the forum - please do not contact me for private consultancy.

Sorry, Peter, I do not know how much voltage and current the motors actually need. I got the kit with absolutely no instructions, or info on the motors. I built the kit using the pictures from the link I posted and followed all the instructions regarding installing the motor shield and uploading the code. I don't have a meter to test the battery voltage when the motors are switched on. I just assumed that the recommended 4 cell battery pack would suffice. I have a 10 cell pack I could try out but I wasn't sure if that would be too much voltage for the shield or Arduino.

For the record, Paul, All my batteries are brand new, Duracell, and not from my smoke alarm. I said I was new to Arduino and electronics, that does not make me and idiot. I appreciate any help I can get but I'd prefer that if you have no support to offer then you go patronise somebody else, cause I can't be arsed with that crap. I just want to build my robot.

The 9v battery powers the Arduino no problem, why would I need to change that?
What about using a 10 cell pack for the motors?


terryking228

I THINK those are "nominal 4.5V" motors that come with that chassis, at least the ones I have are... They were VERY slow with 4.8V and a bipolar L293 type driver, MUCH better with 7.2V battery

See:
The DAGU Support Site (Thanks to Russell Cameron): https://sites.google.com/site/daguproducts/
The Motor specs:  https://sites.google.com/site/daguproducts/home/motor-and-servo-specifications
The motor I THINK you have: https://docs.google.com/file/d/0B__O096vyVYqNDBiMjJiNTgtZGIzMy00YTAyLWIyMWUtOGRkYmE0YWE5ZThj/edit?hl=en_US

Check your wiring totally over (I usually remove it all and start over at this frustrating point)..

Also, test run the motors directly from the battery. Run OK??

Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info

PaulS

Quote
The 9v battery powers the Arduino no problem, why would I need to change that?

Because the 9V battery has the worst power to cost ratio of ANY battery. But, hey, with your attitude, stick with it. I really don't care.

PeterH


Also, test run the motors directly from the battery. Run OK??


Going from 4 cells to 10 cells is a big step and runs a significant risk of blowing something up. But terryking228's suggestion is right on the money and in hindsight should have been the first thing to try.
I only provide help via the forum - please do not contact me for private consultancy.

dannable

You really should get yourself a multimeter so you can measure voltage and current draw. You don't need to get an expensive one, just one that gives you an idea of what is going on.
Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

oric_dan

Quote
I got the kit with absolutely no instructions, or info on the motors. I built the kit using the pictures from the link I posted and followed all the instructions regarding installing the motor shield and uploading the code. I don't have a meter to test the battery voltage when the motors are switched on.


OP:
It took me 30-seconds to do a search on "Dagu Magician" and find the original
manufacturer site with info on the motors, etc. 0.8Amp. You should have done
this before even buying the bot. 6-9V from AA cells should power the thing
perfectly well for several hours.

Secondly, you can't even exist in the electronics world without owning a DMM
[digital multimeter]. In the US, at least, you can buy these for as low as $4.00
from Harbor Freight. Even the cheap ones are worth their weight in tantalum.



TeslaIaint

Here are a couple links to some basic tutorials to get you started in electronics and arduino coding.
http://www.jeremyblum.com/2011/01/02/arduino-tutorial-series-it-begins/  ---videos

http://www.ladyada.net/learn/arduino/

If you learn some fundamentals, your experience with arduino will be much more rewarding in the long run.


terryking228

Yes, you should use all this as a learning experience and dig into more details of Arduino and Electronics...
Quote
Here are a couple links to some basic tutorials


Also available is lots of How-To on the ArduinoInfo WIKI here - http://arduinoinfo.info
Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info

Go Up