Help creating my first 08M simple vehicle at school

Gaetano

New Member
Hello
I am new to PICAXE and I want to introduce it at my school. I only have the 8 Pin Pic Starter Module Kit to work with. Could any one help me with an idea of how to wire up two two separate motors to create a vehicle that moves forward or backwards, thank you for any suggestions.
Gaetano
 

Rickharris

Senior Member
You will need some kind of motor driver because the picaxe will not provide enough current for a motor. In general for forward and back movement people use an H bridge - with a small toy motor an L293 will be OK. 3 AA batteries will run 2 3 volt motor happily through this.

The details of how to connect this and sample programmes are in the interface manual (manual 3) which you will find in the help srea of the picaxe programme editor - or at the top of this page.

In essence the L293 is controlled by 4 outputs of the 08 - 0 - 1 - 2 and 4

If we assume you are using 2 motors (so called skid steering) where stopping one motor will make the other turn the robot. o/p 0 on o/p 1 off = motor clockwise o/p 0 off o/p 1 on = motor anti clockwise both o/p on or both o/p off = motor stop.

Using this you can make the car go back forward and turn and still have input 3 for a sensor (microswitch) to tell when you hit something.

The following would run such a set up over a pre set course.

If you need to sense touching something then

if pin3=1 then stop
backup
turnleft
stop
goto start


will check to see if the input has been activated, if so - stop, back up a little turn away and then continue forward.

Code:
'assumes left motor controlled by  output 0 and 1
'Right motor by output 2 and 4
 
start:
 
moveforward
stop
turnleft
stop
moveforward
stop
turnright
stop
backup
backup
backup
turnleft
 
goto start
 
 
 
 
moveforward:
high 0  'left motor fwd
high 2  ' right motor fwd
wait 10  ' sets distance moved
return
 
 
stopmoving:
low 0
low 2
low 1
low 4
return
 
 
turnleft:
high 2
wait 2  ' sets how far to turn
low 2 ' stop
return
 
 
turnright:
high 0
wait 2
low 0
return
 
backup:
high 1
high 4
wait 5 ' diistance backed up
low 1
low 4
return
 
Last edited:

Gaetano

New Member
Hi Rick

Thank you taking the time to read my post and reply. I am taking your advice and am purchasing the additional chip so I can effectively drive two separate motors. Thanks again
Regards'
Gaetano:):D
 
Top