Good day
I am working on a project in which I want to achieve variable motor speed control (through PWM) with the Baby O.
I am using two micro metal gear motors: pololu.com/product/992 and my Baby O is powered by a 9V battery.
When I make the necessary connections (Battery - Vin/GND and Motors - M1A,M1B and M2A,M2B) and upload the code to run the motors nothing happens; the motors however make a faint buzzing sound but the shaft does not move. It is also worth noting that when I connect the motors, the green LED losses its brightness/intensity and dims a little, when I remove the motor connections it returns to its normal brighter light.
I have been going through the forum and what I picked up is that the motor driver must produce a continuous current greater than the stall current of the motors and I believe that this condition is met as the stall current to my motors is only 0.36 A and the continuous current offered through the motor channels is approximately 1A.
[code]#include <OrangutanLEDs.h>
#include <OrangutanAnalog.h>
#include <OrangutanMotors.h>
#include <OrangutanLCD.h>
/*
- OrangutanMotorExample2 for the 3pi robot, Orangutan LV-168,
- and Orangutan SV-xx8.
- This example uses the OrangutanMotors and OrangutanLCD libraries to drive
- motors in response to the position of user trimmer potentiometer
- and to display the potentiometer position and desired motor speed
- on the LCD. It uses the OrangutanAnalog library to measure the
- trimpot position, and it uses the OrangutanLEDs library to provide
- limited feedback with the red and green user LEDs.
- Pololu - 5.e. OrangutanMotors - Motor Control Library
- https://www.pololu.com
-
https://forum.pololu.com
*/
OrangutanLCD lcd;
OrangutanMotors motors;
OrangutanAnalog analog;
OrangutanLEDs leds;
void setup() // run once, when the sketch starts
{
}
void loop() // run over and over again
{
// note that the following line could also be accomplished with:
// int pot = analogRead(7);
int pot = analog.readTrimpot(); // determine the trimpot position
// avoid clearing the LCD to reduce flicker
lcd.gotoXY(0, 0);
lcd.print(“pot=”);
lcd.print(pot); // print the trim pot position (0 - 1023)
lcd.print(" "); // overwrite any left over digits
int motorSpeed = (512 - pot) / 2;
lcd.gotoXY(0, 1);
lcd.print(“spd=”);
lcd.print(motorSpeed); // print the resulting motor speed (-255 - 255)
lcd.print(" ");
motors.setSpeeds(motorSpeed, motorSpeed); // set speeds of motors 1 and 2
// all LEDs off
leds.red(LOW);
leds.green(LOW);
// turn green LED on when motors are spinning forward
if (motorSpeed > 0)
leds.green(HIGH);
// turn red LED on when motors are spinning in reverse
if (motorSpeed < 0)
leds.red(HIGH);
delay(100);
}[/code]
The above is just a template code that I am using to run the motors, I intend on modifying it for PWM control but before that I need to get the motors working which is where I really need the help.
I am not sure what I may be missing here but I would greatly appreciate your help and advise.
Regards
Masa