At last, I finally received the correct size 18650 batteries. I could have started testing with an external power source, but decided to wait for the batteries. The way the power is hooked up you can't get enough voltage from the Arduino Uno USB port to power the motors.
Here's a picture of my battery problem - I initially purchased the longer batteries which did not fit in the battery holder. But, they do work great in a flashlight that I got with the shorter batteries .
The first test is simply to verify that power and control of the motors are working.
Test sequence
- Run forward 1 sec
- Run backward 1 sec
- Run left 1 sec
- Run right 1 sec
- Circle left 1 sec
- Circle right 1 sec
AlphaBot_Run_Test.ino
/*************************************** Waveshare AlphaBot Car Run Test CN: www.waveshare.net/wiki/AlphaBot EN: www.waveshare.com/wiki/AlphaBot ****************************************/ #include "AlphaBot.h" AlphaBot Car1 = AlphaBot(); void setup() { Car1.SetSpeed(250); //Speed:0 - 255 } void loop() { delay(10000); Car1.Forward(1000); //Car run forward for 1s Car1.Brake(); delay(1000); Car1.Backward(1000); //Car run backward for 1s Car1.Brake(); delay(1000); Car1.Left(1000); //Car turn left for 1s Car1.Brake(); delay(1000); Car1.Right(1000); //Car turn right for 1s Car1.Brake(); delay(1000); Car1.LeftCircle(1000); //Car left circle for 1s Car1.Brake(); delay(1000); Car1.RightCircle(1000); //Car right circle for 1s Car1.Brake(); // delay(10000); // delay(1000); // Car1.MotorRun(250,250); //Car run forward for 1s; left motor speed:250,right motor speed:250 // delay(1000); // Car1.Brake(); // delay(1000); // Car1.MotorRun(-250,-250); //Car run backward for 1s; left motor speed:250,right motor speed:250 // delay(1000); // Car1.Brake(); // delay(1000); // Car1.MotorRun(0,250); //Car left circle for 1s; left motor speed:0,right motor speed:250 // delay(1000); // Car1.Brake(); // delay(1000); // Car1.MotorRun(250,0); //Car turn right for 1s; left motor speed:250,right motor speed:0 // delay(1000); // Car1.Brake(); }
It appears that I'll need to adjust (calibrate) the motor speeds to run straight, but a good sign of life. The IR obstacle sensors don't appear to be working. Fairly simple circuits - guess that's my challenge for the weekend. I'll also look at the AlphaBot library to see what I might need to change if I use a different processor board for control.
Top Comments