Reference
Library
- Raspberry Pi Libraries:
- lgpio: For Bookworm system. Install via
wget https://github.com/joan2937/lg/archive/master.zip && unzip master.zip && cd lg-master && sudo make install. Reference: https://github.com/gpiozero/lg. - bcm2835: For earlier systems. Install via
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.68.tar.gz && tar zxvf bcm2835-1.68.tar.gz && cd bcm2835-1.68/ && sudo ./configure && sudo make && sudo make check && sudo make install. Reference: http://www.airspayce.com/mikem/bcm2835/. - wiringPi: For earlier systems. Install via
sudo apt-get install wiringpi && wget https://project-downloads.drogon.net/wiringpi-latest.deb && sudo dpkg -i wiringpi-latest.deb. Verify withgpio -v(version 2.52 should appear).
- lgpio: For Bookworm system. Install via
- Jetson Nano Libraries:
- Jetson.GPIO: Install via
sudo pip3 install Jetson.GPIO. Configure withsudo groupadd -f -r gpio && sudo usermod -a -G gpio your_user_name && sudo cp /opt/nvidia/jetson-gpio/etc/99-gpio.rules /etc/udev/rules.d/ && sudo udevadm control --reload-rules && sudo udevadm trigger. - python-smbus: Install via
sudo apt-get install python-smbus. - python3-pil and python3-numpy: Install via
sudo apt-get install python3-pil && sudo apt-get install python3-numpy.
- Jetson.GPIO: Install via
Communication Protocol Description
This product employs I2C communication. I2C-bus has one data line(SDA) and one clock line(SCL). There are three kinds of signals in the process of communicating: Start signal, Stop signal and Answer signal.

-
Start signal: SCL is High, SDA changes from High to Low, start to transmit data
-
Stop signal: SCL is High, SDA changes from Low to High, stop transmitting
-
Answer signal: The receiver will answer a specific Low level pulse to sender after receiving 8-Bit data as ACK.
- I2C Write Data

When working, Raspberry Pi (hereafter named as Master) will first send a Start signal, then send a byte to TSL2581 sensor(hereafter named as Slaver), whose first 7bits are I2C address of Master and 1 bit write bit. Slave response with Answer signal every time it receives any data. Master send command register address to Slaver, then data of command register. Stop signals is sent to slave to stop communicating.
- I2C Read Data

When working, Master will first send a Start signal, then send a byte to Slaver, whose first 7bits are I2C address of Master and 1 bit write bit. Slave response with Answer signal every time it receives any data. Master send command register address to Slave. After that, Master will send a Start signal again, and then send a byte (7bits address and 1bit read bit) to Slaver. Slaver response and send data of the register to Master, master answer as well. Communication stops when Master sends Stop signal.
I2C Address
- PCA9685: Default I2C address is 0x40 (A5=A4=A3=A2=A1=0).
- TSL2581: Default I2C address is 0x39 (address pins Float). For STM32, add R/W bit to Low bit.


Principle
The controller of the product is PCA9685, an I2C-bus controlled 12-bit 16 channel PWM output chip. The Pan-Tilt HAT integrates an onboard TSL2581 light sensor that can be used to detect light and work with camera, and it uses I2C interface as well, saving pin resources.
Other Supplementary Information
- The Pan-Tilt HAT is unassembled, you need to get it done by yourself.
- Raspberry Pi board and Camera are not included.
- When using the module with STM32, add R/W bit to Low bit for I2C address.
- Assembly instructions:
(A: pan servo, B: tilt servo). - Camera assembly: Use the provided M2 screws and nuts to attach the camera to the acrylic plate.
Was this article helpful?
