Cameras for Raspberry Pi

  1. Home
  2. Docs
  3. Cameras for Raspberry Pi
  4. PTZ Camera
  5. Application Note

Application Note

1.Introduction

Auto-zoom lens controller is an i2c slave device. You can control the lens through the i2c bus. The slave address is 0x0c( 7bits address). Many registers are provided for users to write and read. Users can write and read them referring to the i2c write timing and i2c read timing we provide. For example, if you want to set the value of the zoom steps, you can write the value to the 0x00 address.

2. Register

2.1 I2C format (Slave address(7 bits): 0x0C)

  • Write Operation
image 5
  • Read Operation
image 10
  • Register Table
AddressFunction
00HZoom steps
01HFocus steps
02HZoom speed
03HFocus speed
04HLens motor state
05HServoX angle values
06HServoY angle values
07HZoom max value
08HFocus max value
0AHReset the zoom
0BHReset the focus
0CHIR cut control


2.2 Detail descriptions of registers

  • ZOOM steps [15: 0 ]
image 7

This is zoom steps data register. It is used to buffer the zoom steps data. When the user value is written to the register, the zoom step motor will rotate to the set position. Read it to get the current position of the zoom motor’s rotation.

  • FOCUS steps [15: 0 ]
image 8

This is focus steps data register. It is used to buffer the focus steps data. When the user value is written to the register, the focus step motor will rotate to the set position. Read it to get the current position of the focus motor’s rotation.

  • ZOOM speed [7: 0 ]
image 4

This is zoom speed register. It is used to buffer the zoom speed data. When the user value is written to the register, the zoom motor’s speed will change to the set value. Read it to get the current speed of the zoom motor’s rotation.

  • FOCUS speed [7: 0 ]
image 5
[x]: no use

This is the focus speed register. It is used to buffer the focus speed data. When the user value is written to the register, the focus motor’s speed will change to the set value…
Read it to get the current speed of the focus motor’s rotation.

  • State [0]
image 6
[x]: no use

This is a state register which just supports read. Read it to get the current state of the lens
Motor.

0: The lens motor is idle.

1: The lens motor is busy.

  • Pan angle values[11: 0 ]
image 2
[x]: no use
This is an angle value register. It is used to buffer the value of the pan. When the user value is written to the register, the pan will rotate to the set angle.
Read it to get the current angle of the pan.

  • Tilt angle values
image 3
[x]: no use
This is the tilt angle value register. It is used to buffer the value of tilt. When the user value is written to the register, the tilt will rotate to the set angle.
Read it to get the current angle of the tilt.

  • Reset the zoom
image 7
[x]: no use
This is reset the zoom register. It is used to reset the zoom. When the 0 is written to the D0, the zoom will reset.

  • Reset the focus
image 8
[x]: no use
This is reset the focus register. It is used to reset the focus. When the 0 is written to the D0, the focus will reset.

  • IR cut control
image 11
[x]: no use

This register is used to control the IR cut. Write the 1 to the D0 to enable the IR cut. Write 0 to disable the IR cut.

  • Joint control of Pan and Tilt angle values
image 9

This register is used to move pan and tilt simultaneously. For the use of Pan and Tilt registers refer to the explanation of 0x05 and 0x06 registers.

3.Operation Mode

The following steps are advised to control the lens

  • Step1: Before you read or write the register, You’d better read the state register to ensure the lens motor is idle.
  • Step2: If the lens motor is idle, read or write the new value to the register you want.

Was this article helpful to you? Yes 2 No 2