Now that the existing control PCB has been removed from Tobbie I can replace it an Arduino. I have decided to use an Arduino Nano, mainly because it is small and I have one. It might even be possible to fit it all inside the available head cavity in Tobbie. So far all I have done is to use a low cost dual H bridge driver PCB (DRV8833) which is widely available and just use one channel to drive the motor for walking. This initial programme just turns the motor on for one second and then turns it off again. The main loop of this programme is shown below:
allstop();
// Being used to test motors in Tobbie
while (1)
{
forwards();
} /* while */
The functions used are simple ones:
void allstop(void)
{
digitalWrite(leftforward, stop);
digitalWrite(rightforward, stop);
digitalWrite(leftbackward, stop);
digitalWrite(rightbackward, stop);
delay(100);
} /* allstop */
void forwards(void)
{
digitalWrite(leftforward, go);
digitalWrite(leftbackward, stop);
delay(1000);
allstop();
delay(1000);
} /* forwards */
Being H-bridge drivers there are two signals used to control each motor, which control the direction of current flow to obtain forwards and backwards and also on or off. Pulse width modulation can be used to control the speed of the DC motor although I have not yet implemented that.
I used a plug-in protoboard to hold the Nano and DRV8833 PCBs and wired it up with jumpers. The result is as shown in the video below.
Next step is to control both motors for forwards and backwards and then implement some form of remote control or self-intelligent control. I wonder if I could use an Artificial Neural Network to do that. I would have to add some sensors first though.
Dubbie