Just wanted to post a short video of my new prop. His jaw is controlled with a microphone so he can tell jokes to the kids as he gives away candy at our church's Trunk-or-Treat this year. The head movement is controlled by a PICaxe chip and the Jaw is controlled with a Simple Sound to Servo. The head moves at random while he is not talking and always looks forward while talking.
nice job !!
I like it. Head moves to and fro as if he is looking around. Nice realism to the prop.
Regards,
Lightman
Nice looking Tyler,,, looks like your just about ready for Holloween...:holloween:
Nice job ..
any chance of getting you to share the way you altered the code/program for the pic ?
the kids are gonna LOVE it !
JackFrost wrote:Nice job ..
any chance of getting you to share the way you altered the code/program for the pic ?
the kids are gonna LOVE it !
Absolutely, I have always been a big believer in sharing any of my work with anyone willing to listen. The head controller used is the EZ-4 controller designed by user Halstaff he is a member here and a moderator over at hauntforum. More info on the EZ-4 can be found here and here. The jaw is controlled by the Simple Sound to Servo controller more info can be found here. I have attached a picture below to help show how the controllers are connected together.
The EZ-4 controller uses a PICaxe 08M2 chip. PICaxe is very similar to Microchip PIC but it uses a different programming language and a different programmer. The programmer is really just an RS-232 cable so if your PC has a serial port your in luck all you need to do is hack up an old serial cable and you're good to go. If not there is a USB programmer for around $30.
OK about the code. the code takes advantage of the 08M2's ability to do multitasking. There are 3 separate tasks going on at the same time. Start0 turns the head at random to one of 3 horizontal position labeled as left, middle and right. Start1 nods the head at random to 1 of 3 vertical positions also labeled left, middle, and right. It really should be up, middle, and down but it was a copy/paste and I was too lazy to change it. Start2 continually checks pinC.2 for a talking signal and redirects both head servos to a 4th talking position when talking is detected. Since every head will be different you will need to change the values in the code to match where your head is looking the correct direction.
symbol counter = b9
symbol pointer = b8
symbol delay = 20
symbol counter1 = b19
symbol pointer1 = b18
symbol delay1 = 20
symbol talk_count=b1
start0: ;up/down
let b8=140 'set pointer offset so that head loop does not get stuck
let b6=150
let b7=150 'set default center values
let talk_count=1
servo C.1,pointer 'center servo
pause 6000 'full motion range test
for counter = 140 to 100 step -1 'move head from middle to right side
servopos C.1,counter
pause delay
next counter
pause 3000
for counter = 100 to 190 step 1
servopos C.1,counter 'move head from right to left
pause delay
next counter
pause 3000
for counter = 190 to 140 step -1
servopos C.1,counter 'move head from right to middle
pause delay
next counter
pause 2000
move:
random w3 'place a random number in wo (also B0 & B1)
if talk_count>100 then talk ;check for talking
if b7<120 then left 'check for random left
if b7>=120 and b7<150 then middle 'check for random middle
if b7>=150 then right 'check for random right
goto move 'keep moving the head back to move loop
right:
if pointer = 100 then move 'if head is already Right goto back to move
if pointer = 140 then mr 'check to see if head in pointed middle or the left
for counter = 190 to 100 step -1 'move head from left side to the right side
servopos C.1,counter
pause delay
next counter
pointer = 100 'set head pointer direction to right
goto skipmr
mr:
for counter = 140 to 100 step -1 'move head from middle to right side
servopos C.1,counter
pause delay
next counter
pointer = 100 'set head pointer direction to right
skipmr:
for b2=1 to 140
if talk_count>100 then talk
pause 50 'delay to look natural
next b2
goto move 'return to move loop
middle:
if pointer = 140 then move 'if head is already in the middle then go back to move
if pointer = 100 then ml 'check to see if head is pointed left or right
for counter = 190 to 140 step -1
servopos C.1,counter 'move head from right to middle
pause delay
next counter
pointer = 140
goto skipml
ml:
for counter = 100 to 140 step 1
servopos C.1,counter 'move servo from left to middle
pause delay
next counter
pointer = 140
skipml:
for b2=1 to 160
if talk_count>100 then talk
pause 50 'delay to look natural
next b2
goto move 'return to move loop
left:
if pointer = 190 then move 'if head is already left then return to move
if pointer = 100 then lmr 'check if the head is in the middle or the right
for counter = 140 to 190 step 1
servopos C.1,counter 'move head from middle to left
pause delay
next counter
pointer = 190
goto skiplmr
lmr:
for counter = 100 to 190 step 1
servopos C.1,counter 'move head from right to left
pause delay
next counter
pointer = 190
skiplmr:
for b2=1 to 180
if talk_count> 100 then talk
pause 50 'delay to look natural
next b2
goto move 'return to move loop
talk:
if pointer = 140 then move 'if head is already in the middle then go back to move
if pointer = 100 then ml 'check to see if head is pointed left or right
for counter = 190 to 140 step -1
servopos C.1,counter 'move head from right to middle
pause delay
next counter
pointer = 140
goto move
start1: 'Side to Side
let b18=173 'set pointer offset so that head loop does not get stuck
let b16=130
let b17=130 'set default center values
servo C.4,pointer1 'center servo
pause 8000 'full motion range test
for counter1 = 170 to 155 step -1 'move head from middle to right side
servopos C.4,counter1
pause delay1
next counter1
pause 3000
for counter1 = 155 to 180 step 1
servopos C.4,counter1 'move head from right to left
pause delay1
next counter1
pause 3000
for counter1 = 180 to 170 step -1
servopos C.4,counter1 'move head from right to middle
pause delay1
next counter1
pause 2000
move1:
random w8 'place a random number in wo (also B0 & B1)
if talk_count>100 then talk1
if b17<155 then left1 'check for random left
if b17>=155 and b17<170 then middle1 'check for random middle
if b17>=170 then right1 'check for random right
goto move1 'keep moving the head back to move loop
right1:
if pointer1 = 155 then move1 'if head is already Right goto back to move
if pointer1 = 170 then mr1 'check to see if head in pointed middle or the left
for counter1 = 180 to 155 step -1 'move head from left side to the right side
servopos C.4,counter1
pause delay1
next counter1
pointer1 = 155 'set head pointer direction to right
goto skipmr1
mr1:
for counter1 = 170 to 155 step -1 'move head from middle to right side
servopos C.4,counter1
pause delay1
next counter1
pointer1 = 155 'set head pointer direction to right
goto move1
skipmr1:
for b2=1 to 14
if talk_count>100 then talk1
pause 500 'delay to look natural
next b2
goto move1 'return to move loop
middle1:
if pointer1 = 170 then move1 'if head is already in the middle then go back to move
if pointer1 = 155 then ml1 'check to see if head is pointed left or right
for counter1 = 180 to 170 step -1
servopos C.4,counter1 'move head from right to middle
pause delay1
next counter1
pointer1 = 170
goto skipml1
ml1:
for counter1 = 155 to 170 step 1
servopos C.4,counter1 'move servo from left to middle
pause delay1
next counter1
pointer1 = 170
skipml1:
for b2=1 to 180
if talk_count> 100 then talk1
pause 50 'delay to look natural
next b2
goto move1 'return to move1 loop
left1:
if pointer1 = 180 then move1 'if head is already left then return to move
if pointer1 = 155 then lmr1 'check if the head is in the middle or the right
for counter1 = 170 to 180 step 1
servopos C.4,counter1 'move head from middle to left
pause delay1
next counter1
pointer1 = 180
goto skiplmr1
lmr1:
for counter1 = 155 to 180 step 1
servopos C.4,counter1 'move head from right to left
pause delay1
next counter1
pointer1 = 180
skiplmr1:
for b2=1 to 140
if talk_count> 100 then talk1
pause 50 'delay to look natural
next b2
goto move1 'return to move loop
talk1:
if pointer1 = 170 then move1 'if head is already in the middle then go back to move
if pointer1 = 155 then ml1 'check to see if head is pointed left or right
for counter1 = 180 to 170 step -1
servopos C.4,counter1 'move head from right to middle
pause delay1
next counter1
pointer1 = 170
goto move1
;this section of code is used to check for talking active low siginal
;from pin1 of the 4066 chip of the ound to servo board
;you will also need to install a 10k pull-up resistor from +5 volt to C.2
start2:
if pin2=0 then goto talking
if pin2=1 then goto not_talking
goto start2
talking:
let talk_count=talk_count+20 max 200
goto start2
not_talking:
let talk_count=talk_count-1 min 1
pause 200 ;delay the transition from talking to not talking increase this number for longer wait time before returning to random head movement
goto start2
Wow .... SUPER great ! ! ! Thank you VERY much ! This helped a LOT ...:biggrin::biggrin::biggrin:

