The project uses two servos from Trossen Robotics, shown here:
http://www.trossenrobotics.com/store...th-Servos.aspx
The camera and NSLU2 are shown here:

The pan/tilt servos are controlled by a PICAXE 08M microprocessor. The program, circuit schematic, and board images are below.
Code:
' 08Srv_1D test servo
#picaxe 08m
symbol panSpot = b13
symbol tiltSpot = b12
symbol activeServo = b11
symbol activeSpot = b10
symbol lastSpot = b9
symbol panServo = 1
symbol tiltServo = 2
symbol servoMin = 75
symbol servoMax = 225
symbol servoCenter = 150
symbol tiltMin = 135
pause 10000 ' wait 10 seconds
activeSpot = servoCenter
panSpot = activeSpot ' center
tiltSpot = activeSpot ' center
lastSpot = activeSpot - 1
'high 0 'set up for serout
ActiveServo = tiltServo ' tilt servo is active
gosub servoOut
ActiveServo = panServo ' pan servo is active
gosub servoOut
main:
do
serin 4,N2400,b1
' serout 0,N2400,(b1, " ", #b1, " ")
select b1
case "p"
activeServo = panServo
activeSpot = panSpot
lastSpot = panSpot ' make sure we move with new servo
case "t"
activeServo = tiltServo
activeSpot = tiltSpot
lastSpot = tiltSpot ' make sure we move with new servo
case "0"
activeSpot = servoCenter
case "1"
dec activeSpot
case "2"
inc activeSpot
case "3"
activeSpot = activeSpot - 5
case "4"
activeSpot = activeSpot + 5
case "5"
activeSpot = activeSpot - 10
case "6"
activeSpot = activeSpot + 10
case "7"
activeSpot = servoMin
case "8"
activeSpot = servoMax
endselect
activeSpot = activeSpot max servoMax
activeSpot = activeSpot min servoMin
if activeServo = tiltServo then
activeSpot = activeSpot min tiltMin
endif
if activeSpot <> lastspot then
' serout 0,N2400,(#activeServo, " ", #activeSpot)
if activeServo = panServo then
panSpot = activeSpot
else
tiltSpot = activeSpot
endif
gosub servoOut
lastspot = activeSpot
' pause 50
endif
loop
servoOut: ' smoothly move from lastSpot
b2 = activeSpot - lastSpot
b3 = 1
if activeSpot < lastSpot then
b2 = lastSpot - activeSpot
b3 = $FF ' minus one
endif
' serout 0,N2400,(#b2, " ", #b3, " ", #lastSpot, " ", #activeSpot,10,13)
activeSpot = lastSpot
for b4 = 1 to b2 ' move smoothly to new activeSpot
activeSpot = activeSpot + b3
' serout 0,N2400,(#b4, " ", #b3, " ", #b2, " ", #activeSpot,10,13)
pulsout activeServo,activeSpot
pause 20
pulsout activeServo,activeSpot ' twice seems to make it work
pause 20
next b4
return


I wrapped the board in electricians tape and was barely able to stuff it inside the case of the NSLU2. It would have been better to do the board with SMD components, but I’ve never done that. The number and size of the connectors is such that the board size could not have been reduced greatly, but it would have been less bulky. The connectors are: power, servo1, servo2, serial control line, programming connector.
I powered the picaxe board off of the NSLU2. The image below shows the power takeoff. Also shown is the DS1233 which I added to make the NSLU2 restart automatically if power has been disrupted and restored (see http://www.nslu2-linux.org/wiki/HowT...ePowerAlwaysOn Alternative one--with DS1233 instead of MPC120).
Bookmarks