Cameras for Raspberry Pi

  1. Home
  2. Docs
  3. Cameras for Raspberry Pi
  4. Native Raspberry Pi Cameras
  5. 5MP OV5647 PT&PTZ Camera Module

5MP OV5647 PT&PTZ Camera Module

Table Of Contents

Introduction

Arducam PT camera can move in two dimensions with 180 degrees horizontal and 145 degrees vertical movements. So it can be used to monitor places that should be covered by multiple ones commonly in the surveillance system.

Arducam PTZ cameras are the complete solution to turn your Raspberry Pi cameras into a fully functional surveillance camera that covers 360 degrees space. With the software autofocus function, you can clearly focus on your target when zooming. The IRCUT control also helps both the daylight and night vision. ​​

Models in this Series

There are two cameras in this series. The main difference between them is whether the lens can be zoomed. If you wanna a 5MP PTZ camera, B01675MP and Pan Tilt Digital Servo Kit are needed.

B0033PT

B01675MP

Common Specs

Image Sensor

Sensor ModelOV5647
Shutter TypeRolling Shutter
Active Pixels2592×1944
Resolution5MP
Image Sensor FormatType 1/4″
Pixel Size1.4μm×1.4μm
OV5647 Block Diagram
OV5647 Block Diagram

OV5647 Full Datasheet

Refer here:

https://www.arducam.com/downloads/modules/RaspberryPi_camera/OV5647DS.pdf

Quick Start Guide

Hardware Setup for B0033PT​​​​​

Video Tutorial
mini pt bracket
Assembling Steps
Wiring

Hardware Setup for B01675MP

Ensure your Raspberry Pi is turned off.

Connect the Camera Module to RPi with Ribbon Cable

The camera module connects to the RPi with a ribbon cable.

  • To connect to the standard RPi, such as Pi 4, use the included 15pin-15pin white ribbon cable.
  • To connect to Pi Zero and Compute Module, prepare a 15pin-22pin cable on your own.

The ribbon cable establishes a connection to the RPi and camera module with the help of metal contacts.

  • The ribbon cable comes with metal contacts on both ends, but different sides.
  • The camera module comes with metal contacts on the camera connector, beside the lens mount
  • The RPi also comes with metal contacts on its CSI camera connector, beside the HDMI connector
white camera ribbon cable contacts
Contacts on the white ribbon cable
metal contacts camera connector 2
Contacts on the Pi’s camera connector
camera ribbon cable contacts
Contacts on the gold ribbon cable
camera connector contacts
Contacts on the cam module’s connector

Therefore, to ensure we are connecting the components in the correct way, just make sure the metal contacts of the ribbon cable are touching those of the camera module and the RPi on both ends.

1.Locate the camera port (CSI)

For Raspberry Pi Model A & B, it’s between the HDMI and audio port of the Raspberry Pi board.

SPRK default preset name web 1920 – 1
2.Gently pull up on the edges of the connector’s plastic clip and avoid pulling it off
3.Insert the ribbon cable

Make sure the metal contacts are facing the HDMI connectors. Do not bend the flex cable, and make sure it’s firmly inserted.

4.Push the plastic clip down

Do it while holding the flex cable still, until the connector’s clip is back in place.

Connect the Servo Motors

The metal base with servos and jumper wire are not included in the package.

Connect the 3-pin plug of the servo motors to the two sockets of the driver controller board.

  • The left socket is for the pan servo, and the right socket is for the tilt servo.
  • Note the color of the 3-pin plug. It’s brown, red and yellow from left to right.

You can refer to Picture 1.

ptz camera servo connection
Picture 1: Servo plug connection

Connect the driver controller board jumpers

The metal base with servos and jumper wire are not included in the package.

The jumpers of the driver controller board can be separated into 3 pairs, and they are mainly for two purposes: I2C control signals and power supplies.

  1. The 1st pair connects to external power, with Pin#1 being Servo VCC and Pin#2 GND.
  2. The 2nd pair connects to the RPi’s GPIO pins for power, with Pin#3 being 5V and Pin#4 GND.
  3. The 3rd pair also connects to the RPI’s GPIO pins for I2C, with Pin#5 being SCL and Pin#6 SDA.

You can refer to Picture 2.

servo jumper connection pan tilt zoom ptz camera
Picture 2 : Driver controller board jumpers connection

Please note that In this illustrator, the different colors of the jumper wires are just to make it easier to distinguish them from each other. The order of those colors varies from item to item, so it may not match the one you’ve received. Therefore, instead of its color, you should rely on the position of the wire to correctly connect the jumpers.

After you finish the hardware assemble process, refer to Picture 3 to review the connections you’ve made.

HardwareConnection pan tilt zoon camera raspberry pi
Picture 3: Connection Overview

Software Setup​​ Preparation

  • Start up your Raspberry Pi.
  • Go to the main menu and open the Raspberry Pi Configuration tool.Raspberry Pi Configuration Tool
  • Select the Interfaces tab and ensure that the camera is enabled:Camera enabled
  • Reboot your Raspberry Pi.

Using the Arducam PT Camera Example for B0033PT

1. Clone the demo code

git clone https://github.com/Arducam/PCA9685.git

2. Enter the target Directory

cd PCA9685/

3. Comile

make

4.Run the demo

sudo ./RunServoDemo

Using the Arducam PTZ Camera Example for B01675MP

Arducam offers example codes for pan, tilt, zoom, and auto-focus the camera module. You can also modify the example code to better suit your applications.

1. Enable I2C on the Raspberry Pi

As we mentioned above, the driver controller board need I2C as the control signal. Therefore, we have to enable the I2C on the Raspberry Pi first.

We will edit the config.txt to enable the I2C on RPi.

  • In your Terminal, type the following command then hit Enter:
sudo nano /boot/config.txt

Now we will edit the config.txt file.

  • Use to navigate to the bottom of the config.txt file, and
  • Add the following line to it as the picture shows.
dtparam=i2c_arm=on

Save the change and exit.

  • Press Ctrl+o to save the changes, then hit Enter
  • Press Ctrl+x to exit.

After you exit Nano, go back to the Terminal and reboot so the changes can take effect.

  • In your Terminal, type the following command then hit Enter:
sudo reboot

2. Install python-opencv

  • In your Terminal, type the following command then hit Enter:
sudo apt-get install python-opencv

3. Download and run the examples

Firstly, we will download the Arducam_OBISP_MIPI_Camera_Module library.

  • In your Terminal, type the following command then hit Enter to download the library:
git clone https://github.com/ArduCAM/PTZ-Camera-Controller
  • In your Terminal, type the following command then hit Enter to enter the target folder:
cd PTZ-Camera-Controller/pyCode
  • In your Terminal, type the following command then hit Enter to run the demo:
python FocuserExample.py
Focus Example

1.Focuser.py

  • zoom-lens basic control component.

2.AutoFocus.py

  • Provide two autofocus methods are available, depending on Focuser.py, opencv, picamera
  • Use the sudo apt-get install python-opencv command to install opencv.

3.AutoFocusExample.py

  • Example of using autofocus, depending on AutoFocus.py

4.FocuserExample.py

  • zoom-lens controller.

Here are some tips for using the demo example:

  1. After you run the focuser example, you will see instructions in the terminal. Read through the instructions for how to operate with the keys.
  2. Press R to reset the lens before pressing Enter to start autofocus.

Was this article helpful to you? Yes No 1