Advertisement

Pan-Tilt HAT User Manual

OVERVIEW

This is a 2-DOF pan-tilt kit designed for Raspberry Pi. With onboard PCA9685 PWM
chip and TSL2581 ambient light sensor, it allows the Pi to control camera movement
and sense light intensity through I2C interface.

SPECIFICATION

Operating voltage:
PWM driver:
Working voltage:
Interface:
Dimension:
Version: V1.0.0; Date: 2019.03.16
3.3V/5V
PCA9685
3.3V
I2C
56.6X65(mm)
Pan-Tilt HAT
User Manual
1 / 17

Advertisement

Table of Contents
loading

Summary of Contents for Waveshare Pan-Tilt HAT

  • Page 1: Overview

    Pan-Tilt HAT User Manual Pan-Tilt HAT User Manual OVERVIEW This is a 2-DOF pan-tilt kit designed for Raspberry Pi. With onboard PCA9685 PWM chip and TSL2581 ambient light sensor, it allows the Pi to control camera movement and sense light intensity through I2C interface.
  • Page 2: Table Of Contents

    Pan-Tilt HAT User Manual CONTENT Overview ................................1 Specification ............................1 Hardware ...............................3 Controller ..............................3 Communication protocol ........................3 I2C Write data ..........................3 I2C read data ..........................4 I2C adress .............................4 How to use ..............................5 Download examples .........................5 Examples ...............................6 Download examples to Raspberry Pi .................6 Install libraries ..........................6...
  • Page 3: Hardware

    The PWN driver is PCA9685, an I2C-bus controlled 26-channel LED controller, 12-bit resolution PWM output. Pan-Tilt HAT integrate TSL2581 on board. TSL2581 is a light sensor, can be used to detect light and work with camera. TSL2581 use I2C interface as well.
  • Page 4: I2C Read Data

    Pan-Tilt HAT User Manual When working, Raspberry Pi (hereafter named as Master) will first send a Start signal, then send a byte to TSL2581 (hereafter named as Slaver), whose first 7bits are address of Slaver and 1 bit write bit. Slave response with Answer signal every time it receives any data.
  • Page 5: How To Use

    This part shows you how to use the module based on demo codes provided on wiki DOWNLOAD EXAMPLES Search with key word “Pan-Tilt HAT” on Waveshare Wiki, open the wiki page and download examples: Uncompressing the 7z, you can get files as below:...
  • Page 6: Examples

    Pan-Tilt HAT User Manual EXAMPLES DOWNLOAD EXAMPLES TO RASPBERRY PI You can download the demo code from wiki, uncompressing and copy to Raspberry Pi, or directly clone it from github: Open terminal of Raspberry Pi and download it: git clone https://github.com/waveshare/Pan-Tilt-HAT...
  • Page 7 Pan-Tilt HAT User Manual sudo make check sudo make install Note: The xx is the version number you download, for example, if the version you download is bcm2835-1.52. then the command you should execute is sudo tar zxvf bcm2835-1.52.tar.gz wiringPi libraries: sudo apt-get install git sudo git clone git://git.drogon.net/wiringPi...
  • Page 8: Assembly

    Pan-Tilt HAT User Manual ASSEMBLY Note: Before you assemble servos to Pan-Tilt HAT, please test the servo with test codes to avoid of servo stuck when rotate Connect servos to Pan-Tilt HAT Brown wire Red wire Yellow wire S1/S0 You should connect the Pan servo (close to HAT board) to S1, and connect Tilt servo (close to camera) to S0.
  • Page 9 Pan-Tilt HAT User Manual test code Run the test code sudo make sudo ./main After running, both servos will rotate to 0-degree place (The starting place). Then power off and assemble the servo as assemble guide. (Do not rotate the servo...
  • Page 10: Servo And Light Sensor

    Pan-Tilt HAT User Manual SERVO AND LIGHT SENSOR To run the Servo Driver and Light Sensor examples. Please enter the folder and using following commands to execute programs: BCM2835 examples: cd bcm2835 sudo ./main wiringPi examples: cd wiringpi sudo ./main Python examples: sudo python main.py...
  • Page 11 Pan-Tilt HAT User Manual 3. Reboot Raspberry Pi sudo reboot 4. Test camera You can test the camera with command: raspistill -o image.jpg About details about the raspistill command, you can type raspistill -hell on Version: V1.0.0; Date: 2019.03.16 11 / 17...
  • Page 12: Web_Control

    Pan-Tilt HAT User Manual Terminal Note that you should connect a display to Raspberry Pi for previewing camera. 5. Video recording To record video via camera, you can use command: raspivid -o video.h264 -t 1000 For details about camera command, you can visit Raspberry Pi website.
  • Page 13 Pan-Tilt HAT User Manual 4. Get information Enter web_Python folder: cd Pan_Tile-HAT/web_Python Type pwd to get the current path information: Type ifconfig command to get the IP information Note: I connect the Raspberry Pi to WIFI, so the IP address is wlan0’s, if you directly connect network jack with cable, the IP address should be eth0’s...
  • Page 14 Pan-Tilt HAT User Manual Change the host to the IP address of your Raspberry Pi, for example: save and exit Version: V1.0.0; Date: 2019.03.16 14 / 17...
  • Page 15 6. Run the example: sudo python mian.py: 7. Download the AlpahBot.exe software from Waveshare wiki and open it. Type IP address of your Raspberry Pi to it and Click Video Connect and Cmd Connect to enable connection Note: The software only support Windows PC and some of the functions are unavailable for Pan-Tilt HAT.
  • Page 16: Expected Result

    Pan-Tilt HAT User Manual 8. To cancel the program, you need to disconnect Cmd and Camera first by pressing Video Connet and Cmd Connet buttons. The Ctrl+C to stop program. EXPECTED RESULT Servo Driver: The servos will rotate the Pan servo and Tilt servo...
  • Page 17: Faq

    Pan-Tilt HAT User Manual 1. Why the ID printed is 0xf0 or 0x00, and intensity data is 0 after running light sensor code? A: Check I2C address first by command: sudo i2cdetect -y 1: If the I2C addresses are incorrect in your Raspberry Pi, please check if you have modified I2C address, and check if you have enabled I2C interface.

Table of Contents