# My Cheaper and Easier Way to run a 3 Axis Skull



## halstaff (Nov 18, 2009)

Here's a video showing the method I use for running my 3 axis skulls - 



This board controls the nod, tilt and rotate of the skull. Controlling the jaw servo to get him to talk requires another board.
I couldn't have done it without the work hpropman did on the random head code. It's what really makes this work.


----------



## RoxyBlue (Oct 6, 2008)

I'm sure this is basic stuff for those in the know, but not being "in the know", I find the technology impressive. Spooky1 has been wanting to learn how to do something like this for a while.


----------



## niblique71 (Dec 2, 2009)

Thanks Halstaff, I want to make one of these. This could be the way. Great Video.


----------



## pshort (May 6, 2008)

Nice.


----------



## SPOOKY J (Nov 20, 2009)

Thanks alot. Very inspiring.


----------



## Lunatic (Oct 3, 2006)

Outstanding Steve!
Great presentation and tutorial.
Your haunt must be the communities favorite place to visit.
Thanks for sharing!


----------



## hpropman (Jul 27, 2008)

Great Job Steve! Can you post the code for the picaxe? I Wrote something similar but it was not for a 3 axis skull.


----------



## halstaff (Nov 18, 2009)

Joe, the random head code I'm using is basically the same one you shared way back when. 
I'm testing out my new stand alone, 3 axis, talking skull controller now but I'm having an issue with one part of the code. As soon as I get it worked out, I'll post it.


----------



## Mr_Chicken (Nov 26, 2008)

Great idea. You're right, random movement is all most folks need. Very nicely made video, too!


----------



## ScaryLane (Jun 3, 2013)

As part of a project with CalHaunts and Steve, I've written a new random movement driver program for his board that moves the head from place to place as if it's looking around. There are head gesture for nodding no and tilt like the skull is looking a something. I've also added Inertia to the head vector code so the movement is more life like and not so robotic.

The page to download this new program is on my website at http://www.scarylane.com/3axes/index.shtml


----------



## halstaff (Nov 18, 2009)

Joe, here's the code I'm using for the 3 axis skull controller, thanks mostly to the work you did originally on it.

#Picaxe 08M2

'b18 byte variable 0-255 in 10uS increments.
'b15 Pause variable 0-65535 in 1mS increments.
'Hitec servo's like signals between 0.740 and 2.740 mS and period of 1 to 20 mS
'C.1 is tilt servo
'C.2 is turn servo
'C.4 is is nod servo

symbol counter = b9
symbol pointer = b8
symbol delay = 47
symbol counter1 = b19
symbol pointer1 = b18
symbol delay1 = 43
symbol counter2 = b25
symbol pointer2 = b24
symbol delay2 = 45
symbol center = 175 'Tilt center
symbol offset = Center+3 
symbol minimum = 145
symbol maximum = 195
symbol center1 = 150 'Turn center
symbol offset1 = center1+3 
symbol minimum1 = 100
symbol maximum1 = 200
symbol center2 = 120 'Nod center
symbol offset2 = center2+3 
symbol minimum2 = 100
symbol maximum2 = 145

start0:
high C.0

start1:'Tilt Head
let b8=offset 'set pointer offset so that head loop does not get stuck
let b6=center
let b7=center 'set default center values
servo C.1,pointer 'center servo
pause 7500
for counter = center to minimum step -1 
servopos C.1,counter
pause delay
next counter
pause 3000

for counter = minimum to maximum step 1
servopos C.1,counter 
pause delay
next counter
pause 3000

for counter = maximum to center step -1
servopos C.1,counter 
pause delay
next counter
pause 4000

move: random w3 'place a random number in wo (also B0 & B1)

if b7<minimum then left 'check for random down
if b7>=minimum and b7<=center then middle 'check for random middle
if b7>=center then right 
goto move 'keep moving the head back to move loop

right: if pointer = minimum then move 
if pointer = center then mr 
for counter = maximum to minimum step -1 
servopos C.1,counter
pause delay
next counter
pointer = minimum 
goto skipmr

mr: for counter = center to minimum step -1 
servopos C.1,counter
pause delay
next counter
pointer = minimum

skipmr: pause 7000 'delay to look natural
goto move 'return to move loop

middle: if pointer = center then move 'if head is already in the middle then go back to move
if pointer = minimum then ml 
for counter = maximum to center step -1
servopos C.1,counter 
pause delay
next counter
pointer = center
goto skipml

ml: for counter = minimum to center step 1
servopos C.1,counter 
pause delay
next counter
pointer = center

skipml: pause 9000 'delay to look natural
goto move 'return to move loop

left: if pointer = maximum then move 
if pointer = minimum then lmr 
for counter = center to maximum step 1
servopos C.1,counter 
pause delay
next counter
pointer = maximum
goto skiplmr

lmr: for counter = minimum to maximum step 1
servopos C.1,counter 
pause delay
next counter
pointer = maximum

skiplmr: pause 7000 'delay to look natural
goto move 'return to move loop

start2: 'Turn head
let b18=offset1 'set pointer offset so that head loop does not get stuck
let b16=center1
let b17=center1 'set default center values
servo C.2,pointer1 'center servo
pause 8000
for counter1 = center1 to minimum1 step -1 
servopos C.2,counter1
pause delay1 
next counter1
pause 3000

for counter1 = minimum1 to maximum1 step 1
servopos C.2,counter1 
pause delay1
next counter1
pause 3000

for counter1 = maximum1 to center1 step -1
servopos C.2,counter1 
pause delay1
next counter1 
pause 2000

move1: random w8 'place a random number in wo (also B0 & B1)

if b17<minimum1 then left1 'check for random left
if b17>=minimum1 and b17<=center1 then middle1 'check for random middle
if b17>=center1 then right1 
goto move1 'keep moving the head back to move loop

right1: if pointer1 = minimum1 then move1 
if pointer1 = center1 then mr1 
for counter1 = maximum1 to minimum1 step -1 
servopos C.2,counter1
pause delay1
next counter1
pointer1 = minimum1 
goto skipmr1

mr1: for counter1 = center1 to minimum1 step -1 
servopos C.2,counter1
pause delay1
next counter1
pointer1 = minimum1

skipmr1: pause 7000 'delay to look natural
goto move1 'return to move loop

middle1: if pointer1 = center1 then move1 'if head is already in the middle then go back to move
if pointer1 = minimum1 then ml1 'check to see if head is pointed left or right
for counter1 = maximum1 to center1 step -1
servopos C.2,counter1 
pause delay1
next counter1
pointer1 = center1
goto skipml1

ml1: for counter1 = minimum1 to center1 step 1
servopos C.2,counter1 
pause delay1
next counter1
pointer1 = center1

skipml1: pause 9000 'delay to look natural
goto move1 'return to move loop

left1: if pointer1 = maximum1 then move1 
if pointer1 = minimum1 then lmr1 
for counter1 = center1 to maximum1 step 1
servopos C.2,counter1 
pause delay1
next counter1
pointer1 = maximum1
goto skiplmr1

lmr1: for counter1 = minimum1 to maximum1 step 1
servopos C.2,counter1 
pause delay1
next counter1
pointer1 = maximum1

skiplmr1: pause 7000 'delay to look natural
goto move1 'return to move loop

start3: 'Nod
let b24=offset2 'set pointer offset so that head loop does not get stuck
let b22=center2
let b23=center2 'set default center values
servo C.4,pointer2 'center servo
pause 9500
for counter2 = center2 to minimum2 step -1 'move head from middle to right side
servopos C.4,counter2
pause delay2
next counter2
pause 3000

for counter2 = minimum2 to maximum2 step 1
servopos C.4,counter2 'move head from down to up
pause delay2
next counter2
pause 3000

for counter2 = maximum2 to center2 step -1
servopos C.4,counter2 'move head from right to middle
pause delay2
next counter2
pause 4000

move2: random w11 'place a random number in wo (also B0 & B1)

if b23<minimum2 then left2 'check for random left
if b23>=minimum2 and b23<=center2 then middle2 'check for random middle
if b23>=center2 then right2 'check for random right
goto move2 'keep moving the head back to move loop

right2: if pointer2 = minimum2 then move2 'if head is already Right goto back to move
if pointer2 = center2 then mr2 'check to see if head in pointed middle or the left
for counter2 = maximum2 to minimum2 step -1 'move head from left side to the right side
servopos C.4,counter2
pause delay2
next counter2
pointer2 = minimum2 'set head pointer direction to right
goto skipmr2

mr2: for counter2 = center2 to minimum2 step -1 'move head from middle to right side
servopos C.4,counter2
pause delay2
next counter2
pointer2 = minimum2 'set head pointer direction to right

skipmr2: pause 7000 'delay to look natural
goto move2 'return to move loop

middle2: if pointer2 = center2 then move2 'if head is already in the middle then go back to move
if pointer2 = minimum2 then ml2 'check to see if head is pointed left or right
for counter2 = maximum2 to center2 step -1
servopos C.4,counter2 'move head from right to middle
pause delay2
next counter2
pointer2 = center2
goto skipml2

ml2: for counter2 = minimum2 to center2 step 1
servopos C.4,counter2 'move servo from left to middle
pause delay2
next counter2
pointer2 = center2

skipml2: pause 9000 'delay to look natural
goto move2 'return to move loop

left2: if pointer2 = maximum2 then move2 'if head is already left then return to move
if pointer2 = minimum2 then lmr2 'check if the head is in the middle or the right
for counter2 = center2 to maximum2 step 1
servopos C.4,counter2 'move head from middle to left
pause delay2
next counter2
pointer2 = maximum2
goto skiplmr2

lmr2: for counter2 = minimum2 to maximum2 step 1
servopos C.4,counter2 'move head from right to left
pause delay2
next counter2
pointer2 = maximum2

skiplmr2: pause 7000 'delay to look natural
goto move2 'return to move loop


----------



## chrisc (Nov 12, 2013)

Tottally awesome halstaff.....good work!...


----------



## Onewish1 (Aug 4, 2012)

thank you for your EZ 4 Steve!!!


----------



## halstaff (Nov 18, 2009)

Onewish1 said:


> thank you for your EZ 4 Steve!!!


You're very welcome. So cool to see how others are putting the board to work!


----------

