MINI-SSC CONTROL FILES
All files in this zkpt2.zip file are copyright 2001 with all rights reserved. Use at your own risk. YMMV! (revised 8/1/01)
The zkpt2.zip file contains ZK1PT2.exe, ZK1PT2.bat, ZK2PT2.exe, ZK2PT2.bat, delay.exe, demo.bat, delay.txt, and this readme.txt file. In naming the files, the ZK identifies it as a zoomkat program, the 1 or 2 denotes the com port it uses, the PT indicates it is for pan and tilt control, and the 2 indicates that it is rev. two of the program (8/1/01). The .exe files work stand alone in the regular Apache cgi-bin folder and in the MS PWS server (at least the first PWS version, but it tends to hang after a while) scripts folder. The included zk1pt2.bat and zk2pt2.bat files will be needed to run the program on the ivista apache module. In this case, put the .exe and .bat files in the cgi folder, and make the link to the ZK1PT2.bat file instead of the ZK1PT2.exe file. The .bat file will run the .exe file. The .exe (or .bat) files are executed by using a html link like hostname/cgi/ZK1PT2.exe (or hostname/cgi/ZK1PT2.bat). The files provide the proper code to prevent the servo control panel from changing. The information concerning the servo actions is passed to the .exe programs via a string attached to the end of the html line. Examples below:
127.0.0.1/cgi/ZK1PT2.exe?00&000
127.0.0.1/cgi/ZK1PT2.bat?00&000
The string to the right of the ? is the servo control info. The first 00 is the servo number. This is 00 through 99 for the servos that the mini-ssc can control (for more than 16 you would probably need a custom chip). The "&" seperates the servo number from the servo position. It has been reported that with win2k, using the"&" in the string in the command line mode causes an error. Change the "&" to some other letter, characteror number to prevent the error. The servo position is the 000 to the right of the &. The servo number always needs to match the number of characters stated in the control string (00 or 000), and the servo position needs to be *three* characters (000). Anything different than this should be ignored by the program. The servo position range is from 000 through 254. The program is based on the quick basic example provided in the mini-ssc info. The program looks at the *length* of the control string to know how the string is to be processed, so it is *important* to get the characters arranged properly and the string be the correct length. Example strings with a 6 character length for moving a single servo:
127.0.0.1/cgi/ZK1PT1.exe?00&000 servo 00 to position 000
127.0.0.1/cgi/ZK1PT1.exe?03&027 Servo 03 to position 027
127.0.0.1/cgi/ZK1PT1.exe?13&216 servo 13 to position 216
To test the servos, put the included files in the web server cgi (cgi-bin, scripts) folder. Start the webserver. Put an html string like above that is appropriate for your server and servos in your brouser's URL window and hit the enter key. The files should execute, the servo position, and the current brouser web page *not* update. If this works, then you can just keep changing the servo numbers and positions in the brouser URL window to setup the desired travel on the servos. The programs now have improved error checking, and strange numbers and such in the info string should now be ignored by the program. If the com port gets hung for some reason (can happen if you try to open a port that is already in use), you usually have to reboot to free the port up again. Make a control panel using the html strings that you mouse click on. If the mini-ssc stops responding, something probably hung the com port.
8/1/01 updates:
A command line option has been added to the programs. The program will now look first to see if a command line string is available, and use it first. If the command line string is absent, then it looks for the cgi string input from the webserver. The demo.bat file is an example of running the program from the command line. Simple servo routines can be setup using the batch file. Also, the program should also now work with the ssc-12 controller using the 000&000 string format.
8/17/01 updates:
The zk1pt2c.exe and zk2pt2c.exe have been added to the zip file. These are command line only programs made for running several servo routines in side a batch file (see the democ.bat file). Use these programs with the webserver when they need to be executed more than once in a batch file.
The following are additional control strings that have been added:
SW1: 00&000&000 (servo#)&(servo position)&(delay)
This control string is 10 characters long and is for operating a switch
using a servo. The format is (servo#)&(servo position)&(time delay). The
"at rest" servo position is the mid point 127. The servo will return to
the 127 position when done. The time delay (in seconds) is 3 characters
long. Example time delays: .05, .50, 1.5, 10., 120, etc. Note that extended
time delays may cause a brouser timeout notification, as the server waits
for the delay to finish before sending the info to the brouser. Intended
use: select the servo for use, select the position it must move to to
actuate the switch, and select the time it needs to keep the switch pushed.
PSETA: 00&000&00&000
This control string is 13 characters long. This is for controlling two
servos that are used to pan and tilt a webcam and aiming the cam at a
*preset* position. The format is
(servo#)&(servo position)&(servo#)&(servo position).
PSETA1: 000&000&000&000
(servo)&(pos)&(servo)&(pos), 15 characters
PSETB: 00&000&000&00&000
This control string is 17 characters long. It has a time delay between
moving the servos. It can be used to move 2 servos with a time delay
between the two, or it can be used to move the same servo to a position,
have a time delay, then move the servo to another position. The format is
(servo#)&(servo poisiton)&(time delay)&(servo#)&(servo position).
PSETB1: 000&000&000&000&000
(serv)&(pos)&(delay)&(serv)&(pos) 19 char
PSETC: 00&000&00&000&00&000
(serv)&(pos)&(serv)&(pos)&(serv)&(pos) 20 char
PSETC1: 000&000&000&000&000&000 23 characters
(serv)&(pos)&(serv)&(pos)&(serv)&(pos)
PSETD: 00&000&00&000&00&000&00&000 27 characters
(serv)&(pos)&(serv)&(pos)&(serv)&(pos)&(serv)&(pos)
SW3: 00&000&000&00&000&000&00&000 28 characters
(serv)&(pos)&(delay)&(serv)&(pos)&(delay)&(serv)&(pos)
PSETD1: 000&000&000&000&000&000&000&000 31 characters
(serv)&(pos)&(serv)&(pos)&(serv)&(pos)&(serv)&(pos)
security:
To minimize people tweeking your control strings, you can add a "confusion
factor" to the string to to make it a little less obvious how it works. In
this version, the "&" only serves as a visual seperator between the servo
controls. The & can be replaced with other characters to make the control
scheme less obvious. Strings longer than needed can also be used if unused
servo numbers are used. The below string pairs are identical in actual
function.
04&127
044127
04&127&00&000&00&000&00&000
044127926201384902083816098
07&065&1.6&12&215
07306541.60126215
Using the command line option in batch files would be good where the servo can't move full range. The range could be preset in the file, and can't be changed by tinkering with the control string on the client computer.
Later,
zoomkat last updated 8/1/01