Skip to content

Latest commit

 

History

History
289 lines (205 loc) · 7.54 KB

device-digitus-dn16048.md

File metadata and controls

289 lines (205 loc) · 7.54 KB

Digitus DN-16048 Optizoom PTZ

Pan, Tilt, Focus and Zoom (via command line ssh)

Flashing OpenIPC:

Opening the case, it turns out, that the SoC is hi3518cv100, 16MB, and the camera sensor is mt9p006. Install a TFTP server at the PC and follow the installation instructions: https://github.com/OpenIPC/wiki/blob/master/en/installation.md Download the correct image (16MB, Lite) from here https://openipc.org/cameras/vendors/hisilicon/socs/hi3518cv100 and put it into the directory of the TFTP server (in case the image is not packed, the "unpacking" step can be skipped). As described, connect a UART adapter to the pins on the SoC board and start a terminal at the PC:

screen -L -Logfile ipcam-$(date +%s).log /dev/ttyUSB0 115200

Follow the instructions that are generated by the OpenIPC web page. To access UBOOT, press Ctrl-C immediately after plugging in the power supply. To make the network work later on in Linux: Before the final "reset" command in UBOOT, enter the following commands, according to: https://github.com/OpenIPC/wiki/blob/master/en/network-perversions.md

setenv extras 'hieth.phyaddru=3 hieth.mdioifu=0'
saveenv

Finally enter:

reset

Logon to Linux using "root" and "12345". In Linux enter:

firstboot

Login to Linux again. The sensor will not be detected automatically. Therefore enter the following commands in Linux on the camera:

fw_setenv soc hi3518cv100
fw_setenv sensor mt9p006

Find out the IP address of the camera via

ip a

Change password and MAC address:

Access the web interface using a browser via port 85 and change the password and the MAC address.

Configure night mode switching:

Via ipctool (ipctool gpio scan) one can find out easily, that the light sensor input (for automatic switching between day and night) is number 2. The IR cutoff is controlled by 1 and 0.

  • Preview-NightMode-Settings:
Enable Night mode: on
GPIO pin of signal from IR sensor: 2
GPIO pin1 of signal for IRcut filter: 1
GPIO pin2 of signal for IRcut filter: 0

Configure the camera resolution:

  • Mainstream Video (Video0):
Video resolution: 1280x720
Video framerate: 10

When using RTSP you might want to increase the frame rate at Video0 to 15. Higher frame rates might be possible, but above 15 memory runs low and suddenly the web gui might not be reachable anymore (and probably other unwanted effects will occur).

  • RTSP:
RTSP enable output: on
  • MJPEG:
Video resolution: 1280x720
  • JPEG:
Snapshot size: 1280x720

Configure the Image Signal Processor:

  • Image Signal Processor (ISP):
Path to sensor configuration file: /etc/sensors/mt9p006_i2c_dc_720p.ini
Block count: 4

Configure web admin:

  • System:
Serve Web Admin via Majestic: off

Configure the watchdog:

  • Watchdog:
Enable watchdog: on
Watchdog timeout: 120

Test the MJPEG stream:

For example, using a browser or the Android app "IPCamViewer" (replace IP with your current one).

192.168.1.188/mjpeg

Test the RTSP stream:

For example, using "mpv" on Linux or the Android app "IPCamViewer". When using "IPCamViewer" select "Generic RTSP over UDP" (replace the password and IP with your current ones).

mpv rtsp://root:[email protected]:554/stream=0

Test pan, tilt, zoom and focus:

It turns out, that the camera uses the pelco-d protocol via the serial port ttyAMA1, so logon to the camera via ssh (use your ip):

The serial port can be configured via the following stty command:

stty -F /dev/ttyAMA1 2400

Create the following scripts with the editor "vi" or copy the files via tftp. Use chmod to make the files executable. For example:

chmod +x ./right

Script ./right

#!/bin/sh 
stty -F /dev/ttyAMA1 2400 
printf '\xFF\x01\x00\x00\x00\x00\x01' >/dev/ttyAMA1 
printf '\xFF\x01\x00\x02\x20\x00\x23' >/dev/ttyAMA1 
sleep 0.1 
printf '\xFF\x01\x00\x00\x00\x00\x01' >/dev/ttyAMA1

Script ./left

#!/bin/sh 
stty -F /dev/ttyAMA1 2400 
printf '\xFF\x01\x00\x00\x00\x00\x01' >/dev/ttyAMA1 
printf '\xFF\x01\x00\x04\x20\x00\x25' >/dev/ttyAMA1  
sleep 0.1 
printf '\xFF\x01\x00\x00\x00\x00\x01' >/dev/ttyAMA1

Script ./up

#!/bin/sh 
stty -F /dev/ttyAMA1 2400 
printf '\xFF\x01\x00\x00\x00\x00\x01' > /dev/ttyAMA1 
printf '\xFF\x01\x00\x08\x20\x00\x29' > /dev/ttyAMA1 
sleep 0.1 
printf '\xFF\x01\x00\x00\x00\x00\x01' > /dev/ttyAMA1

Script ./down

#!/bin/sh 
stty -F /dev/ttyAMA1 2400 
printf '\xFF\x01\x00\x00\x00\x00\x01' >/dev/ttyAMA1 
printf '\xFF\x01\x00\x10\x20\x00\x31' >/dev/ttyAMA1 
sleep 0.1 
printf '\xFF\x01\x00\x00\x00\x00\x01' >/dev/ttyAMA1

Script ./in (Zoom)

#!/bin/sh 
stty -F /dev/ttyAMA1 2400 
printf '\xFF\x01\x00\x00\x00\x00\x01' >/dev/ttyAMA1 
printf '\xFF\x01\x00\x20\x00\x00\x21' >/dev/ttyAMA1 
sleep 1  
printf '\xFF\x01\x00\x00\x00\x00\x01' >/dev/ttyAMA1

Script ./out (Zoom)

#!/bin/sh 
stty -F /dev/ttyAMA1 2400 
printf '\xFF\x01\x00\x00\x00\x00\x01' >/dev/ttyAMA1 
printf '\xFF\x01\x00\x40\x00\x00\x41' >/dev/ttyAMA1  
sleep 1 
printf '\xFF\x01\x00\x00\x00\x00\x01' >/dev/ttyAMA1

Script ./near (Focus)

#!/bin/sh
stty -F /dev/ttyAMA1 2400
printf '\xFF\x01\x00\x00\x00\x00\x01' >/dev/ttyAMA1
printf '\xFF\x01\x01\x00\x00\x00\x02' >/dev/ttyAMA1 
sleep 0.1 
printf '\xFF\x01\x00\x00\x00\x00\x01' >/dev/ttyAMA1

Script ./far (Focus)

#!/bin/sh
stty -F /dev/ttyAMA1 2400
printf '\xFF\x01\x00\x00\x00\x00\x01' >/dev/ttyAMA1
printf '\xFF\x01\x00\x80\x00\x00\x81' >/dev/ttyAMA1 
sleep 0.1 
printf '\xFF\x01\x00\x00\x00\x00\x01' >/dev/ttyAMA1

Script ./scanh

#!/bin/sh 
stty -F /dev/ttyAMA1 2400 
printf '\xFF\x01\x00\x00\x00\x00\x01' >/dev/ttyAMA1 
sleep 0.5 
printf '\xFF\x01\x00\x04\x08\x00\x0d' >/dev/ttyAMA1

Script ./scanv

#!/bin/sh 
stty -F /dev/ttyAMA1 2400 
printf '\xFF\x01\x00\x00\x00\x00\x01' >/dev/ttyAMA1 
sleep 0.5 
printf '\xFF\x01\x00\x08\x08\x00\x11' >/dev/ttyAMA1

Script ./stop

The following script stops every action including horizontal and vertical scan). It is a workaround, because the normal pelco-d "stop" command did not always work. It turned out that "up", "down", "left", "right" always stops the scan commands, so short left+right commands are included in this script:

#!/bin/sh 
stty -F /dev/ttyAMA1 2400 
printf '\xFF\x01\x00\x00\x00\x00\x01' >/dev/ttyAMA1 
printf '\xFF\x01\x00\x02\x20\x00\x23' >/dev/ttyAMA1 
printf '\xFF\x01\x00\x00\x00\x00\x01' >/dev/ttyAMA1 
printf '\xFF\x01\x00\x04\x20\x00\x25' >/dev/ttyAMA1 
printf '\xFF\x01\x00\x00\x00\x00\x01' >/dev/ttyAMA1 
printf '\xFF\x01\x00\x04\x20\x00\x25' >/dev/ttyAMA1 
printf '\xFF\x01\x00\x00\x00\x00\x01' >/dev/ttyAMA1

Possible further improvements:

  • The camera seems to have a PoE board, but it does not seem to work. Maybe there are two versions (one with 12V and one with PoE) that mainly differ from each other by the cable. So maybe the camera can be modified to use the PoE board.

  • There is a SDCard slot (although only accessible when opening the case). It does not work at the moment. Although there had been an update of the stock firmware addressing explicitly the SDCard functionality, it is not sure whether it ever worked with stock firmware.

  • The camera has got a Wifi module. Probably this could be activated via OpenIPC.

  • The camera has got a zoom and focus board. Documentation for this board exists in Chinese (can be translated via google translate). There seems to be a "factory calibration" procedure to assign "standard" focus settings for the zoom levels.