I have made a toy car, with arduino UNO + Bluetooth + Motor shield installed on it. There are two DC Motors, at the front of the car and at the back. The front motor controlls the turn of the front wheels. Motor at the back moves the car.
Commands, such as turn right, left or go straight are sent from android through Bluetooth. Arduino accepts it and executes the command.
At first everything works fine. The car moves fast, and performs turns fast. But after some time the car suddenly decrease in speed, almost stops, and I hear a sound from the back motor. It seems like it doesn't have enough power to move the car, and if I pick up the car at that moment, the motor starts moving fast as before, but if I put the car back to the floor it doesn't move with the needed speed again.
Let me explain you the command execution algorithm, After receiving the turn Left or Right command Check if I am already performing the same turn, if not, then 1. Set the back motor speed to 0 2. RUN the front motor at the needed direction (backward or forward meaning left or right) 3. Set the speed of the back motor to maximum (255)
After receiving the GO Straight command:
Check if I am already going straight, if not, then 1. Set the back motor speed to 0 2. RUN the front motor at the opposite of the current turn direction 3. Delay for some time, enought to turn the wheels straight 4. RELEASE the front motor. 5. Set the speed of the back motor to some value, less than maximum (255).
Are there any defects in this algorithm? And what can be the cause of the problem?
I want also to mention that the car was working properly before, but with not enough speed when making turn, so I decided to add two more batteries. After that I am facing this problems. Previously I was using 6 AA. Now I am using 8 of them.