' PICAXE 18M2 for Hand Gesture Robot JULY 2011
' www.ironjungle.com
' Other than the minium PICAXE 18M2 'keep alive' 22K R & 10K R
' no other R, C, L, etc need for the project.
' Everything powered by 4.5VDC
' The PICAXE drives the servos straight from the chip.
' See pinouts in comments
' 0 is Thumb (PICAXE pin 6)
' 1 is Pointer (PICAXE pin 7)
' 2 is Middle (PICAXE pin 8)
' 3 is Ring (PICAXE pin 9)
' 4 is Pink (PICAXE pin 10)
' Normallu Open Button Switch is PICAXE pin 18 (pulled HIGH with 10K)
'Define Servo values to fully EXtend/Open finger
Symbol Ex_Thumb = 60
Symbol Ex_Pointer = 60
Symbol Ex_Middle = 245
Symbol Ex_Ring = 60
Symbol Ex_Pink = 60
'Define Servo values to fully CLose finger
Symbol CL_Thumb = 225
Symbol CL_Pointer = 240
Symbol CL_Middle = 50
Symbol CL_Ring = 240
Symbol CL_Pink = 240
'Init the servos
servo 0, Ex_Thumb
servo 1, Ex_Pointer
servo 2, Ex_Middle
servo 3, Ex_Ring
servo 4, Ex_Pink
pause 400
'Gesture Subroutines are:
' One
' Two
' Three
' Four
' Open_Hand
' Hook_em
' Gig_em
' Hang_Loose
' Fist
' F_You
' Walk
main:
'Insure Open_Hand position and
'Turn the servos off so they don't jitter
gosub Open_Hand
pause 400
servopos 0, off
servopos 1, off
servopos 2, off
servopos 3, off
servopos 4, off
do until pinC.1 = 1 'wait for RED button press (PICAXE pin18)
RANDOM w12 ' w13 will be use to in Case Statement
w13 = w12 // 11 + 1 '"//" is modulus divide (returns remainder)
loop
'Turn the servos on. We turned them off so they didn't jitter
'Hand is already in the Open_Hand position
servo 0, Ex_Thumb
servo 1, Ex_Pointer
servo 2, Ex_Middle
servo 3, Ex_Ring
servo 4, Ex_Pink
Select Case w13
Case 1
gosub One
Case 2
gosub Two
Case 3
gosub Three
Case 4
gosub Four
Case 5
gosub Hook_em
Case 6
gosub Gig_em
Case 7
gosub Hang_Loose
Case 8
gosub Fist
Case 9
gosub F_You
Case 10,11 'add cases so this will come up more often
gosub Walk
endselect
pause 3000 ' hold the selected gesture
goto main 'return and wait for button press
' Gesture Subroutines below:
Open_Hand:
servopos 0, Ex_Thumb
servopos 1, Ex_Pointer
servopos 2, Ex_Middle
servopos 3, Ex_Ring
servopos 4, Ex_Pink
return ' Open_Hand
Gig_em:
servopos 0, Ex_Thumb
servopos 1, CL_Pointer
servopos 2, CL_Middle
servopos 3, CL_Ring
servopos 4, CL_Pink
return 'Gig_em
Hook_em:
servopos 0, CL_Thumb
servopos 1, Ex_Pointer
servopos 2, CL_Middle
servopos 3, CL_Ring
servopos 4, Ex_Pink
return 'Hook_em
F_you:
servopos 0, CL_Thumb
servopos 1, CL_Pointer
servopos 2, Ex_Middle
servopos 3, CL_Ring
servopos 4, CL_Pink
return 'F_you
One:
servopos 0, CL_Thumb
servopos 1, Ex_Pointer
servopos 2, CL_Middle
servopos 3, CL_Ring
servopos 4, CL_Pink
return 'One
Two:
servopos 0, CL_Thumb
servopos 1, Ex_Pointer
servopos 2, Ex_Middle
servopos 3, CL_Ring
servopos 4, CL_Pink
return 'Two
Three:
servopos 0, CL_Thumb
servopos 1, Ex_Pointer
servopos 2, Ex_Middle
servopos 3, Ex_Ring
servopos 4, CL_Pink
return 'Three
Four:
servopos 0, CL_Thumb
servopos 1, Ex_Pointer
servopos 2, Ex_Middle
servopos 3, Ex_Ring
servopos 4, Ex_Pink
return 'Four
Fist:
servopos 0, CL_Thumb
servopos 1, CL_Pointer
servopos 2, CL_Middle
servopos 3, CL_Ring
servopos 4, CL_Pink
return 'Fist
Hang_Loose:
servopos 0, Ex_Thumb
servopos 1, CL_Pointer
servopos 2, CL_Middle
servopos 3, CL_Ring
servopos 4, Ex_Pink
return 'Hang_Loose
Walk: 'waves the fingers
servopos 0, CL_Thumb
pause 70
servopos 1, CL_Pointer
pause 70
servopos 2, CL_Middle
pause 70
servopos 3, CL_Ring
pause 70
servopos 4, CL_Pink
pause 70
servopos 0, Ex_Thumb
pause 70
servopos 1, Ex_Pointer
pause 70
servopos 2, Ex_Middle
pause 70
servopos 3, Ex_Ring
pause 70
servopos 4, Ex_Pink
return 'Walk
; PICAXE 18M2 for Hand Gesture Robot JULY 2011
; www.ironjungle.com
; Other than the minium PICAXE 18M2 ;keep alive; 22K R & 10K R
; no other R, C, L, etc need for the project.
; Everything powered by 4.5VDC
; The PICAXE drives the SERVOs straight from the chip.
; See pinouts in comments
; 0 is Thumb (PICAXE pin 6)
; 1 is Pointer (PICAXE pin 7)
; 2 is Middle (PICAXE pin 8)
; 3 is Ring (PICAXE pin 9)
; 4 is Pink (PICAXE pin 10)
; Normally Open Button Switch is PICAXE pin 18 (pulled HIGH with 10K)
;Define SERVO values to fully EXtend/Open finger
SYMBOL Ex_Thumb = 60
SYMBOL Ex_Pointer = 60
SYMBOL Ex_Middle = 245
SYMBOL Ex_Ring = 60
SYMBOL Ex_Pink = 60
;Define SERVO values to fully CLose finger
SYMBOL CL_Thumb = 225
SYMBOL CL_Pointer = 240
SYMBOL CL_Middle = 50
SYMBOL CL_Ring = 240
SYMBOL CL_Pink = 240
;Init the SERVOs
SERVO 0, Ex_Thumb
SERVO 1, Ex_Pointer
SERVO 2, Ex_Middle
SERVO 3, Ex_Ring
SERVO 4, Ex_Pink
PAUSE 400
;Gesture Subroutines are:
; One
; Two
; Three
; Four
; Open_Hand
; Hook_em
; Gig_em
; Hang_Loose
; Fist
; F_You
; Walk
Init:
GOSUB Open_Hand
PAUSE 400
Main:
;Insure Open_Hand position and
;Turn the SERVOs off so they don;t jitter
SERVOPOS 0, off
SERVOPOS 1, off
SERVOPOS 2, off
SERVOPOS 3, off
SERVOPOS 4, off
DO
RANDOM w12 ; w12 used to create w13 that will be use to in ON....GOSUB Statement
LOOP UNTIL pinC.1 = 1 ; wait for RED button press (PICAXE pin18)
;Turn the SERVOs on. We turned them off so they didn;t jitter
;Hand is already in the Open_Hand position
GOSUB Open_Hand
w13 = w12 // 11 [COLOR="#FF0000"]; + 1[/COLOR] ;"//" is modulus divide (RETURNs remainder)
[COLOR="#FF0000"]ON w13 GOSUB One, Two, Three, Four, Hook_em, Hang_Loose, Fist, F_You, Walk, Walk[/COLOR]
PAUSE 3000 ; hold the selected gesture
GOTO Main ; return to the start of Main loop and wait for button press
; Gesture Subroutines below:
Open_Hand:
SERVOPOS 0, Ex_Thumb
SERVOPOS 1, Ex_Pointer
SERVOPOS 2, Ex_Middle
SERVOPOS 3, Ex_Ring
SERVOPOS 4, Ex_Pink
RETURN ; Open_Hand
Gig_em:
SERVOPOS 0, Ex_Thumb
SERVOPOS 1, CL_Pointer
SERVOPOS 2, CL_Middle
SERVOPOS 3, CL_Ring
SERVOPOS 4, CL_Pink
RETURN ;Gig_em
Hook_em:
SERVOPOS 0, CL_Thumb
SERVOPOS 1, Ex_Pointer
SERVOPOS 2, CL_Middle
SERVOPOS 3, CL_Ring
SERVOPOS 4, Ex_Pink
RETURN ;Hook_em
F_you:
SERVOPOS 0, CL_Thumb
SERVOPOS 1, CL_Pointer
SERVOPOS 2, Ex_Middle
SERVOPOS 3, CL_Ring
SERVOPOS 4, CL_Pink
RETURN ;F_you
One:
SERVOPOS 0, CL_Thumb
SERVOPOS 1, Ex_Pointer
SERVOPOS 2, CL_Middle
SERVOPOS 3, CL_Ring
SERVOPOS 4, CL_Pink
RETURN ;One
Two:
SERVOPOS 0, CL_Thumb
SERVOPOS 1, Ex_Pointer
SERVOPOS 2, Ex_Middle
SERVOPOS 3, CL_Ring
SERVOPOS 4, CL_Pink
RETURN ;Two
Three:
SERVOPOS 0, CL_Thumb
SERVOPOS 1, Ex_Pointer
SERVOPOS 2, Ex_Middle
SERVOPOS 3, Ex_Ring
SERVOPOS 4, CL_Pink
RETURN ;Three
Four:
SERVOPOS 0, CL_Thumb
SERVOPOS 1, Ex_Pointer
SERVOPOS 2, Ex_Middle
SERVOPOS 3, Ex_Ring
SERVOPOS 4, Ex_Pink
RETURN ;Four
Fist:
SERVOPOS 0, CL_Thumb
SERVOPOS 1, CL_Pointer
SERVOPOS 2, CL_Middle
SERVOPOS 3, CL_Ring
SERVOPOS 4, CL_Pink
RETURN ;Fist
Hang_Loose:
SERVOPOS 0, Ex_Thumb
SERVOPOS 1, CL_Pointer
SERVOPOS 2, CL_Middle
SERVOPOS 3, CL_Ring
SERVOPOS 4, Ex_Pink
RETURN ;Hang_Loose
Walk: ;waves the fingers
SERVOPOS 0, CL_Thumb
PAUSE 70
SERVOPOS 1, CL_Pointer
PAUSE 70
SERVOPOS 2, CL_Middle
PAUSE 70
SERVOPOS 3, CL_Ring
PAUSE 70
SERVOPOS 4, CL_Pink
PAUSE 70
SERVOPOS 0, Ex_Thumb
PAUSE 70
SERVOPOS 1, Ex_Pointer
PAUSE 70
SERVOPOS 2, Ex_Middle
PAUSE 70
SERVOPOS 3, Ex_Ring
PAUSE 70
SERVOPOS 4, Ex_Pink
RETURN ;Walk
@ IronJungle : Excellent job and you might like to consider uploading to the PICAXE Project Gallery ...
http://www.picaxe.com/Project-Gallery/Submit
Every month we're giving a prize away for the most interesting / amusing / innovative project and the same for one lucky winner from all who upload their project. Pretty good prizes as well ...
* AXE091 Experimenter Board
* PICAXE-20X2 Microbot
* PICAXE-28X2 Module
All entrants need to do is write a brief description of their project, have an uploadable photo of it, ideally have a youtube video of it ( but that's not essential ), and that's pretty much it.
Big or small, complex or simple; put your PICAXE project on show !
http://www.picaxe.com/Project-Gallery
From the link in Post 1 and the link therein to Hack-a-Day:Hi, May I ask, what did you use for the fingers?
Thanks,
These cheap robot hands usually only use one wire to move all five fingers.
[member onefivefour] improved upon the design and added five servos to allow independent control of each digit.