Pantroller (Pan Tilt Controller) is a small windows program that drives a PICAXE which controls two servos. The servos pan and tilt a webcam. The PICAXE used is a 14M, but it will probably run on an 08M. Here is the PICAXE source code:
I was having lots of trouble trying to receive both X and Y bytes on the same line, like ‘serin 1,n2400,("XY"),b0,b1’. Eventually tried splitting them and it worked.
This ZIP file (http://www.zen86415.zen.co.uk/pantroller.zip) contains the PC program that drives the PICAXE through the serial programming cable (COM1). In the ZIP is a screenshot, the source code in Ebasic (http://www.ionicwind.com/) and the compiled executable. The source, should you with to study it, is best viewed with all the proper context colouring etc. provided by the free Ebasic editor/compiler.
Screenshot:
The button functions are self explanatory. The box labelled ‘Pan’ has two functions. In addition to displaying the current pan position of the webcam, it can control the mechanism directly using the mouse. Just click and drag the target inside the box and the webcam will follow.
Here is a video of mouse-panning in action: http://www.zen86415.zen.co.uk/pantilt.MOV (5.7Mb Right-click>Save as...) Sorry it’s an MOV file, but that’s how it comes out of my Olympus digital camera.
I have posted here because the project is not complete. I will eventually be adding several bits and bats. It works well on my PC but feedback as to whether it works on other PCs would be useful.
Code:
servo 4,150:servo 5,150
pause 2000
do
setfreq m8
serin 1,n2400,("X"),b0
serin 1,n2400,("Y"),b1
setfreq m4
high 3
servo 4,b1:servo 5,b0
pause 15
low 3
loop
This ZIP file (http://www.zen86415.zen.co.uk/pantroller.zip) contains the PC program that drives the PICAXE through the serial programming cable (COM1). In the ZIP is a screenshot, the source code in Ebasic (http://www.ionicwind.com/) and the compiled executable. The source, should you with to study it, is best viewed with all the proper context colouring etc. provided by the free Ebasic editor/compiler.
Screenshot:
The button functions are self explanatory. The box labelled ‘Pan’ has two functions. In addition to displaying the current pan position of the webcam, it can control the mechanism directly using the mouse. Just click and drag the target inside the box and the webcam will follow.
Here is a video of mouse-panning in action: http://www.zen86415.zen.co.uk/pantilt.MOV (5.7Mb Right-click>Save as...) Sorry it’s an MOV file, but that’s how it comes out of my Olympus digital camera.
I have posted here because the project is not complete. I will eventually be adding several bits and bats. It works well on my PC but feedback as to whether it works on other PCs would be useful.