USB camera module | high frame rate global exposure object recognition auto focus face recognition biometric security industrial control medical vision 5g artificial intelligence sensor | VR 2K 4K 8K HDR ahd dual lens module high definition USB camera module manufacturer
13423810014

Serial camera module communication transmission protocol v1.1

作者:admin 发布时间:2020-10-05 10:35:26 点击量:2879
Serial camera vf-06 uses this protocol, four micro head dials can set the address range of 0x20 -- 0x2F, a total of 16 addresses, can carry 16 such sub devices. When there is no jumper, the address of the device is 0x2F, and that of the factory is 0x2F.
1、 Camera type
1. According to the different forms of serial interface, the interface can be divided into two types as follows:
(1) Vf-06-485, standard RS-485.
(2) Vf-06-232, standard RS-232:
Model 485 is a bus type interface, and a special bus address must be set for it. When sending the command, the bus address code of the command is consistent with the bus address of the camera, and the camera will respond to the command.
The bus address of the camera is the sum of the base address and the dial switch code value. The base address is preset at the factory and is generally hexadecimal. The base address of the module is 0x20, which can also be preset by the user, but can not be changed after delivery.
The 232 interface is single head type and does not support bus type interface
2. Dormancy
The camera has the function of power on and body sleep, that is, only the communication interface and image memory work when powered on, and the image processing part which consumes more power is in the body sleep state. In the sleep mode, the power consumption of the module is only 10 mA. The image processing part should be started to work normally after waking up before sending out the photo taking command to the lifting hair. After normal operation, the camera will not automatically enter the sleep state unless receiving the sleep command.
For model 485, it has been preset as power on body sleep when leaving the factory, and it can be set to power on non sleep state according to customer's needs. If more than one camera is connected to a bus, it is recommended that the user must be powered on to sleep, and sleep with the command body after taking pictures and fetching data, so as to avoid excessive bus power supply current when multiple cameras are working at the same time

2、 Image format
Each image format VGA (640x480), QVGA (320x240), 09vga (160x120) corresponds to three kinds of compression quality
A: Average, B: better, C: good
3、 Data format
In the asynchronous serial interface (in this protocol), a byte of data consists of a start bit, an 8-bit data bit, and a stop bit. The start bit is always 0, the low bit of data is sent first, the stop bit is always 1, and finally sent. The figure below shows sending an Oxal byte.
Packet length = command code bytes + data area bytes + check sum bytes;
Check sum = command code + Data0 + data1 + data2 + datax-1;
The data area is multi byte, and the rest are single byte. The check sum is the sum of the command code and each byte in the data area. The check sum only takes the numbers in the protocol, which are all hexadecimal values. For example, FF means 0xff.
5、 Timing
1. Normal working sequence
After the camera is powered on, it should wait for 3 seconds for the module to reset normally. After the loader works stably, the working command can be sent to the camera. When the power supply is stable, the work order can be sent to it at any time.
The camera receives the complete shooting command, and takes pictures within 5.5 seconds under the condition of the same image format. Small photos are usually stored in 2 seconds, and normally it may take 2-4 seconds. After shooting, the camera will send information such as the length of the data packet of the frame image to the host. Although the camera can take photos in 5.5 seconds at most, in order to work stably and reliably, the host computer does not send any information to the camera module within 7 seconds after receiving the shooting command.
For other commands sent by the host computer to the camera, the camera will respond and send the corresponding information within 60ms. However, in order to ensure the stability and reliability of communication, it is better to set the response time longer, such as 100ms.
If there is a wrong code in the received data, the check sum will be inconsistent. In this case, the group of data should be abolished and the same command should be sent again immediately. Error code may also cause the number of bytes received is inconsistent with the expected number, resulting in over collection or timeout.
After receiving the data packet length and other information of the frame picture, the host can immediately send out the image packet command to the camera hair. After getting a packet of data, it can immediately take down a packet of command. Be careful not to send any command to the module during data transmission.
The host should send commands to the camera in order, and send the next command after receiving the camera's response to the current command. If RS-485 half duplex bus mode is adopted for serial communication and multiple devices are connected, it is necessary to access another device after the work instruction of one device is completely finished, and it is not allowed to access another device at the same time.
If the image processing part is not required to work for a long period of time, a sleep command should be sent to the camera hair to save power.
2. The normal working mode of this camera is as follows:
(1) Power on and delay for 3 seconds. Wake up and shake hands. After that, some related data configuration can be made or not.
(2) Whether there is sleep or not, a picture is saved in the buffer;
(3) If you want to take a picture, you must wake up first and then send the photo taking command;
(4) After the photo command is sent out, delay waiting, receiving the response and picture length information;
(5) . after receiving the response information, you can immediately or at any other time issue a packet retrieval command to retrieve the packet until all the image data are retrieved

(6) Send sleep command

6、 Image packet protocol
In the following example, the device address is 0 × 00
1. Initialization (01h)
This command sets the image parameters, such as: whether to use compression method, image format, image size
Note: P1 is 04, fixed, do not change this data
P2 value: set to 0x07 means that the image data is in compression mode and JPEG format, which is fixed and unchanged. The user does not change this data
P3 value: if P2 value is non-0x07 (i.e. non compressed image data), P3 value is valid, set the image size P4 value: P2 value is 0x07, it means that the image data is compressed, and the image format is determined by P4 value
For example:
The host sends AA 00 06 01 04 07 00 07 13, and the normal return message is AA 00 03 0e 01 0f
AA 00 06 01 04 07 00 07 13 means that the camera is initially jpfg image format, and the image format is 640 * 480;
AA 00 06 01 04 07 00 05 11 means that the camera is initially in JPEG image format, and the image format is 320 * 240; AA 00 06 01 04 07 00 03 0f means that the camera is initially JPEG image format, and the image format is 160 * 120;
2. The command is reserved (02h)
3. Register setting (03h)
No use, no access and no settings
4. Getting images
for example
The host sends AA 00 03 04 05 09, and the normal response is AA 00 03 0e 04 12
After waiting for 5.5 seconds for an image to be shot, the host computer will receive the command: AA 00 06 0A 05 Ao CB 00 7a AA 00 03 04 05 09: the command to take a picture
AA 00 06 0A 05 A0 CB 00 7a: it means that the data length of the frame is: oxcba0 = 52128bytes
The host obtains a frame of image data through this command. After receiving this command, it will first return to ACK and then send it
Data command, which contains the size of JPEG image data
5. Snapshot settings (05H), do not use
6. Set packet size 06h)
for example
The host sends AA 00 03 06 02 08, and the normal response is AA 00 03 0e 06 14
AA 00 03 06 02 08; indicates that the packet is set to 512 bytes
AA 00 03 06 01 07; indicates that the packet is set to 256 bytes
AA 00 03 06 04 0A; indicates that the packet is set to 1024 bytes
The host sets the size of each packet of image data sent by the camera through this command. This command must be sent before getting the image command. If it is not set, the default value is 512bytes per packet. It must be noted that the size of the last packet of images is uncertain
7. Set baud rate (07h)
For example:
The host computer through this command refers to the baud rate of the camera. The default is 115200bps. After power on, the host must default baud rate to establish a connection with the camera.
8. Reset (o8h)
9. Sleep / wake up (09h)
AA Ad dr 04 09 P1 P2 Sum
Answer: AA addr030e09sum
Host sends AA 00 04 09 00 09 normal response AA 00 03 OE 09 17
AA 00 04 09 00 00 09: indicates that the camera is in sleep mode
AA 00 04 09 01 00 0A: wake up the camera
10. Image data length (OH)
AA addr 06 0A 05 P1 P2 P3 sum ‖ image size
This command is not sent by the host computer, but sent to the host computer by the camera hair. This command is issued after waiting for several seconds after answering the image command (shooting).
P1, P2, P3 is the size of the frame image, P3, high byte, P1, low byte
AA 00 06 0A 05 00 A0 00 AF: indicates that the size of the image is 0 x 100
AA 00 06 0A 05 A0 D5 00 84: indicates that the size of the image is 0 xd5a0
11. Synchronous (0dh)
Establish handshake connection command with camera
AA Addr 02 OD Sum
Answer: AA addr 03 0e od sum
Host sends AA 00 02 0d 0d normal response AA 00 03 0e 0D 1B
12、ACK(0ch)
Answer command
Format: AA addr 03 0e command ID number sum
for example
AA 00 03 0e 01 0f: reply to initialization command
AA 00 03 0e od Ib: reply synchronous signal
AA 00 03 0e 07 15: answering baud rate setting command
13、NAK(Ofh)
Error response signal of camera or host computer
AA addr 03 0f command ID number sum
14. Infrared command (20h switch)
format
AA Addr 03 20 PI Sum
Answer: AA addr 03 0e 20 sum
For example:
AA 00 03 20 00 20: turn off the infrared light
AA 00 03 20 01 21: it means to turn on the infrared lamp
P1: when it is 0, it means that the infrared lamp is turned off; when it is 1, it means that the infrared indicator light is turned on
15. Image instruction setting instruction (22h)
Format:
AA Addr 03 22 PI Sum
A: AA addr 03 0e 22 sum
For example:
AA 00 03 22 00 22: indicates that the image command is set as best
AA 00 03 22 01 23: indicates that the setting image command is better

AA 00 03 22 02 24: indicates that the setting image command is general
16. Packet fetch instruction (2eh)
Format:
AA Addr 04 2E P1 P2 Sum
Answer: AA addr 02 2E sum
For example:
AA 00 04 2E 00 00 2e: data with package number 0
AA 00 04 2E 05 00 2e: the data with package number 5 is taken
AA 00 04 2E 00 01 2e: the data with package number 256 is taken
P1 and P2 are packet numbers. The packet numbers start from 00 and can be up to 255. Any packet data in the order can be used at will during packet retrieval. You can also use this instruction to retrieve packet data.

Wechat Skype QQ