SuperDVR4 & Picaxe

HAZELEB

Member
Description, Swann SuperDVR4.net pci card & Picaxe
This is for any one who wants to use the DVR4 with there own pan&tilt cameras. Commercial PTZ’s are expensive - way above my hobby budget,

This is the link to the SuperDVR’s manual http://www.swannsecurity.com/s/products/view/?product=379&panel=faqs
The software allows you to choose from a list of protocols, the lilin was the one that worked for me, baud mode set to N2400 it serout’s a string of unique numbers each of the five buttons “Up down left right & stop” The software also supports “focus zoom & Iris” if your camera supports it. Using two variables stores the first two numbers that can be used in your code with if statements, to see what the numbers are to start with use sertxd,

I used two picaxe’s 18X for the pan/tilt and 14M for the serin, I used the 14M as you need five outputs, bare in mind that if you use a 14M with the firmware version 9a you will need to split the variables as serin on this version only supports one variable, The firmware version 9e is ok.


Code for the 18X &14M are below. Hope this is useful.

Ted.

18X code

Code:
`The 18x controls the pan and tilt servos
#picaxe18x
SYMBOL COUNTER = B0						`counter for pan servo
SYMBOL LASTPOS = B1						`pan servo position
SYMBOL COUNTER2 = B3						`counter for tilt servo
SYMBOL LASTPOS2 = B4 						`tilt servo position
init:									`label initaliation
LASTPOS = 130							`pan servo start position
LASTPOS2 = 165							`tilt servo start position	
pause 1500								`pause

MAIN:									`label main
	low 1
	low 2									
	
	IF PIN0 = 1 THEN PANLF					
	IF PIN1 = 1 THEN PANRT					`if statements to jump to code
	IF PIN6 = 1 THEN TILTUP
	IF PIN2 = 1 THEN TILTDN
	
	GOTO MAIN
	
PANLF:
	servo 1,lastpos						`init servo 1
	FOR COUNTER = LASTPOS TO 200
	SERVOPOS 1,COUNTER
	PAUSE 100							`for next loop to pan left
	LASTPOS = COUNTER
	IF PIN7 = 1 THEN MAIN					`this stops the camera movement
	NEXT COUNTER
	GOTO MAIN
PANRT:
	servo 1,lastpos						`init servo 1
	FOR COUNTER = LASTPOS TO 90 STEP - 1
	SERVOPOS 1,COUNTER
	PAUSE 100							`for next loop to pan right
	LASTPOS = COUNTER
	IF PIN7 = 1 THEN MAIN					`this stops the camera movement
	NEXT COUNTER
	GOTO MAIN
TILTUP:
	servo 2,lastpos2						`init servo 2
	FOR COUNTER2 = LASTPOS2 TO 190
	SERVOPOS 2,COUNTER2
	PAUSE 100							`for next loop to tilt up
	LASTPOS2 = COUNTER2
	IF PIN7 = 1 THEN MAIN					`this stops the camera movement
	NEXT COUNTER2
	GOTO MAIN
TILTDN:
	servo 2,lastpos2						`init servo 2
	FOR COUNTER2 = LASTPOS2 TO 140 STEP - 1
	SERVOPOS 2,COUNTER2
	PAUSE 100							`for next loop to tilt down
	LASTPOS2 = COUNTER2
	IF PIN7 = 1 THEN MAIN					`this stops the camera movement 
	NEXT COUNTER2
	GOTO MAIN
14M code

Code:
`The 14m is connected to the dvr comport x
#picaxe14m
init:
serin 0,N2400,b0,b1						`two verables needed for the first numbers of lilin protocol
pause 300
	low 1
	low 2								`sets low outputs to prevent over run of servo when button releast 
	low 3
	low 4
	low 5

	
	if b0 = 1 and b1 = 4 then tiltup
	if b0 = 1 and b1 = 8 then tiltdn
	if b0 = 1 and b1 = 2 then panl			`if statements to indicate which button pressed to jump to the prog code
	if b0 = 1 and b1 = 1 then panr
	if b0 = 1 and b1 = 0 then sto_p
	goto init

tiltup:
	high 1
	goto init
tiltdn:
	high 2
	goto init
panl:									` outputs set high 
	high 3
	goto init
panr:
	high 4
	goto init
sto_p:
	high 5
	goto init
 
Top