Sub $20 Robot Chassis inc Picaxe28X1 & motors
I have been trying for a long time to create cheap accurate robots to use in a "Swarm" environment.
Most "workable robots" tend to hit the $100 mark ..... frankly this is way to much.
The best sub $20 solution i have found so far is presented here.
This version uses the Picaxe-28X1 (i have also a propeller mcu version which works just the same)
Maybe these types of cost effective setups will allow more people to dive into robotics/programming....
Its tracking very well with its 2 x 0.99p stepper motors ..... which i basically glued back2back
- the ULN2003 motor driver board is already attached to the motor.
What you see below is a "Soak" test of the robot drawing onto a "Glow Sheet" ...
....the robot ran easily for 1 hour (prove_ing that steppers are not as power hungry as continuous servos)
Here it is in action :-
[video=youtube_share;AWbuSU7ebhg]http://youtu.be/AWbuSU7ebhg[/video]
I am using 2x 3.7Volt 500mAhr helicopter style lipo batteries ..... and the current drain is very good.
The Picaxe 28X1 sits on a (really bare bone) picaxe board from rkeducation. (its the board "Hot Glued" to the back)
And now some Autonomous code
This uses the "Pause" command :-
Latest code 29th October 2012
Using "Pauseus" command enables tighter control over stepper coil energisation.
I have been trying for a long time to create cheap accurate robots to use in a "Swarm" environment.
Most "workable robots" tend to hit the $100 mark ..... frankly this is way to much.
The best sub $20 solution i have found so far is presented here.
This version uses the Picaxe-28X1 (i have also a propeller mcu version which works just the same)
Maybe these types of cost effective setups will allow more people to dive into robotics/programming....
Its tracking very well with its 2 x 0.99p stepper motors ..... which i basically glued back2back
- the ULN2003 motor driver board is already attached to the motor.
What you see below is a "Soak" test of the robot drawing onto a "Glow Sheet" ...
....the robot ran easily for 1 hour (prove_ing that steppers are not as power hungry as continuous servos)
Here it is in action :-
[video=youtube_share;AWbuSU7ebhg]http://youtu.be/AWbuSU7ebhg[/video]
I am using 2x 3.7Volt 500mAhr helicopter style lipo batteries ..... and the current drain is very good.
The Picaxe 28X1 sits on a (really bare bone) picaxe board from rkeducation. (its the board "Hot Glued" to the back)
Code:
;"G" for Gareth
; Stepper Driver code for testing
; 0.99p motors
; linear coding at moment just to get
; Tracks rolling ;-)
; Gareth - aka youtube "Chiprobot"
let dirsc =%00010000
let pinsc =%00010000
main:
high portc 1
let pinsc =%00010000 ; switch UV LED "On"
w2=600
Gosub North
let pinsc =%00000000 ; switch UV LED "Off"
w2=211
Gosub East
let pinsc =%00010000
w2=400
Gosub North
let pinsc =%00000000
w2=211
Gosub East
let pinsc =%00010000
w2=200
Gosub North
let pinsc =%00000000
w2=211
Gosub East
let pinsc =%00010000
w2=100
Gosub North
let pinsc =%00000000
w2=211
Gosub East
let pinsc =%00010000
w2=100
Gosub North
let pinsc =%00000000
w2=211
Gosub West
let pinsc =%00010000
w2=200
Gosub North
let pinsc =%00000000
w2=211
Gosub West
let pinsc =%00010000
w2=400
Gosub North
let pinsc =%00000000
w2=211
Gosub West
let pinsc =%00010000
w2=200
Gosub North
let pinsc =%00000000
w2=211
Gosub West
let pinsc =%00010000
w2=100
Gosub North
let pinsc =%00000000
w2=211
Gosub West
let pinsc =%00010000
w2=100
Gosub North
let pinsc =%00000000
w2=211
Gosub East
let pinsc =%00010000
w2=100
Gosub North
let pinsc =%00000000
w2=211
Gosub East
let pinsc =%00010000
w2=300
Gosub North
let pinsc =%00000000
w2=211
Gosub East
let pinsc =%00010000
w2=100
Gosub North
let pinsc =%00000000
w2=211
Gosub East
let pinsc =%00010000
w2=100
Gosub North
let pinsc =%00000000
w2=211
Gosub West
let pinsc =%00010000
w2=200
Gosub North
let pinsc =%00000000
w2=211
Gosub East
let pinsc =%00010000
w2=400
Gosub North
let pinsc =%00000000
w2=211
Gosub East
let pinsc =%00000000
let pins = %00000000
stop
North: ; forward stepper sequence (half step)
for w1=0 to w2
let pins =%10001000
pause 1
let pins =%11001100
pause 1
let pins =%01000100
pause 1
let pins =%01100110
pause 1
let pins =%00100010
pause 1
let pins =%00110011
pause 1
let pins =%00010001
pause 1
let pins =%10011001
pause 1
next w1
return
stop
South: ; backward stepper sequence (half step)
for w1=0 to w2
let pins =%10011001
pause 1
let pins =%00010001
pause 1
let pins =%00110011
pause 1
let pins =%00100010
pause 1
let pins =%01100110
pause 1
let pins =%01000100
pause 1
let pins =%11001100
pause 1
let pins =%10001000
pause 1
next w1
return
East: ; clockwise stepper sequence (half step)
for w1=0 to w2
let pins =%10011000
pause 1
let pins =%00011100
pause 1
let pins =%00110100
pause 1
let pins =%00100110
pause 1
let pins =%01100010
pause 1
let pins =%01000011
pause 1
let pins =%11000001
pause 1
let pins =%10001001
pause 1
next w1
return
West: ; anticlockwise stepper sequence (half step)
for w1=0 to w2
let pins =%10001001
pause 1
let pins =%11000001
pause 1
let pins =%01000011
pause 1
let pins =%01100010
pause 1
let pins =%00100110
pause 1
let pins =%00110100
pause 1
let pins =%00011100
pause 1
let pins =%10011000
pause 1
next w1
return
This uses the "Pause" command :-
Code:
; Auto-mode Sub 20 Dollar Robot
; addition of Sharp distance sensor.
; Stepper Driver code for testing 0.99p Stepper motors
; Gareth - aka youtube "Chiprobot"
let dirsc =%00010000 ;UV Led pin
let pinsc =%00010000
let w4=timer ; seed the random number generator
main:
let pinsc =%00010000 ; switch UV LED "On"
w2=1
Gosub North ; General full steam ahead direction
readadc10 1,w1 ; Sharp sensor or IR analog input
readadc10 0,w5 ; Lipo Battery monitor analog (simply connected to 5V regulator)
if w5 <980 then sleep 1 endif ; if Battery analog dips below this level, then either Sleep (or shutdown) to save the Lipo batteries from dropping below 3Volts
if w1>400 then ; trip level - object detected - do something different
random w4
let pinsc =%00000000 ; switch UV LED "Off" whilst turning
w2=b8
if w2>127 then gosub West ; This part of code stops the
if w2<127 then gosub East ; robot getting stuck in a corner
endif
goto main
North: ; forward stepper sequence (half step)
for w1=0 to w2
let pins =%10001000
pause 1
let pins =%11001100
pause 1
let pins =%01000100
pause 1
let pins =%01100110
pause 1
let pins =%00100010
pause 1
let pins =%00110011
pause 1
let pins =%00010001
pause 1
let pins =%10011001
pause 1
next w1
return
stop
South: ; backward stepper sequence (half step)
for w1=0 to w2
let pins =%10011001
pause 1
let pins =%00010001
pause 1
let pins =%00110011
pause 1
let pins =%00100010
pause 1
let pins =%01100110
pause 1
let pins =%01000100
pause 1
let pins =%11001100
pause 1
let pins =%10001000
pause 1
next w1
return
East: ; clockwise stepper sequence (half step)
for w1=0 to w2
let pins =%10011000
pause 1
let pins =%00011100
pause 1
let pins =%00110100
pause 1
let pins =%00100110
pause 1
let pins =%01100010
pause 1
let pins =%01000011
pause 1
let pins =%11000001
pause 1
let pins =%10001001
pause 1
next w1
return
West: ; anticlockwise stepper sequence (half step)
for w1=0 to w2
let pins =%10001001
pause 1
let pins =%11000001
pause 1
let pins =%01000011
pause 1
let pins =%01100010
pause 1
let pins =%00100110
pause 1
let pins =%00110100
pause 1
let pins =%00011100
pause 1
let pins =%10011000
pause 1
next w1
return
Using "Pauseus" command enables tighter control over stepper coil energisation.
Code:
; Auto-mode Sub 20 Dollar Robot Version 2.0
; Adjust w6 to suit your motors (ie if steppers "Stutter" or "Stop" increase this value untill both motors run smoothly under load.
; addition of Sharp distance sensor.
; Stepper Driver code for testing 0.99p Stepper motors
; Gareth - aka youtube "Chiprobot"
let dirsc =%00010000 ;initialise Ultra Violet Led pin
let w4=timer ; seed the random number generator ...not sure if this is actually nessesary..
let w6=40 ; delay between stepper phases (30to50 is optimal for my steppers)
main:
let pinsc =%00010000 ; switch UV LED "On"
let w2=1 ; Step Forward 1
Gosub North ; General full steam ahead direction
readadc10 1,w1 ; Sharp sensor or IR analog input
readadc10 0,w5 ; Lipo Battery monitor analog (simply connected to 5V regulator)
if w5 <980 then sleep 1 endif ; if Battery analog dips below this level, then either Sleep (or shutdown) to save the Lipo batteries from dropping below 3Volts
if w1>400 then ; trip level - object detected - do something different too avoid disaster
let pinsc =%00000000 ; switch UV LED "Off" whilst turning else it will suntan a ring by overexposing
random w4 ; choose some random number
w2=b8 ; just extract one part of it as we only actually need a "1" or "0" .... best we can do is 8 bits so we do it this way
if w2>127 then gosub West ; This part of code stops the robot getting stuck in a corner
if w2<127 then gosub East ; here tooooo....
goto main
[B]North: ; forward stepper sequence (half step)[/B]
for w1=1 to w2
let pins =%10001000
pauseus w6
let pins =%11001100
pauseus w6
let pins =%01000100
pauseus w6
let pins =%01100110
pauseus w6
let pins =%00100010
pauseus w6
let pins =%00110011
pauseus w6
let pins =%00010001
pauseus w6
let pins =%10011001
pauseus w6
next w1
return
stop
[B]South: ; backward stepper sequence (half step)[/B]
for w1=1 to w2
let pins =%10011001
pauseus w6
let pins =%00010001
pauseus w6
let pins =%00110011
pauseus w6
let pins =%00100010
pauseus w6
let pins =%01100110
pauseus w6
let pins =%01000100
pauseus w6
let pins =%11001100
pauseus w6
let pins =%10001000
pauseus w6
next w1
return
[B]East: ; clockwise stepper sequence (half step)[/B]
for w1=1 to w2
let pins =%10011000
pauseus w6
let pins =%00011100
pauseus w6
let pins =%00110100
pauseus w6
let pins =%00100110
pauseus w6
let pins =%01100010
pauseus w6
let pins =%01000011
pauseus w6
let pins =%11000001
pauseus w6
let pins =%10001001
pauseus w6
next w1
return
[B]
West: ; anticlockwise stepper sequence (half step)[/B]
for w1=1 to w2
let pins =%10001001
pauseus w6
let pins =%11000001
pauseus w6
let pins =%01000011
pauseus w6
let pins =%01100010
pauseus w6
let pins =%00100110
pauseus w6
let pins =%00110100
pauseus w6
let pins =%00011100
pauseus w6
let pins =%10011000
pauseus w6
next w1
return
Attachments
-
126.7 KB Views: 9
Last edited: