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.
- 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
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.print(pot); // print the trim pot position (0 - 1023)
lcd.print(" "); // overwrite any left over digits
int motorSpeed = (512 - pot) / 2;
lcd.print(motorSpeed); // print the resulting motor speed (-255 - 255)
motors.setSpeeds(motorSpeed, motorSpeed); // set speeds of motors 1 and 2
// all LEDs off
// turn green LED on when motors are spinning forward
if (motorSpeed > 0)
// turn red LED on when motors are spinning in reverse
if (motorSpeed < 0)
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.