Design Project: Control a Pan-Tilt Platform with Raspberry Pi and Smartphone
This is purely the design for the projected. Presented is a detailed paper design of a smartphone controlled pan-tilt camera platform for exploring telepresence and POV drone and robot interaction and control.
A pan-tilt platform can be used to position various instruments and tools, the most common of which is a camera. The pan-tilt platform allows a user to be able to change where the camera is pointing from a remote location so that a single camera can cover a larger area than if it were fixed. It also allows for automatic control of where the camera is pointing and allows for the stabilization of cameras on drones and other remotely operated vehicles. The automatic tracking of objects in the video captured by the camera is also possible, the video below shows the pan-tilt mechanism being used in such an application.
With recent interest in virtual reality (VR) systems and the VR experience becoming more and more cost effective and accessible (Google cardboard thingy) VR apps are starting to come to the fore and are heading for mainstream acceptance. One such application is enhanced telepresence systems such as remotely operated construction equipment or a specialist surgeon performing surgery remotely. This design project presents an exploration of what might be required to build an enhanced telepresence systems where the user is able to control a camera mounted on a remote platform such as a drone, remotely operated ground vehicle or just a fixed position in a remote location.
The basis for this project will be an raspberry pi controlled pan-tilt platform controlled by a smartphone that communicates with the raspberry pi via Bluetooth. A block diagram of the proposed system is shown in figure 1 below.
The smartphone will server as the main user interface to the systems. It will have an app that will capture movement and orientation information from the internal accelerometer and transform these into control signals for the raspberry pi pan-tilt platform. The control signals will be sent via Bluetooth to a Bluetooth module on the raspberry pi, the embedded code on the raspberry pi will then decide how to position the camera via the pan-tilt mechanism. The video feed supplied by the camera is relayed back to the smartphone via WiFi and is displayed to the user via the app.
This setup allows the user to control the position of the camera by just moving his phone and when mounted as a VR display the camera is controlled by the user just moving his head. This gives a greater sense of immersion and intuitive control when viewing a remote location by a drone or otherwise.
The components required for this system are listed below and relevant links to buy them on amazon.
- Raspberry PI Kit (raspberry pi, HDMI cable, power supply, SD card, WiFi dongle, case) buy on Amazon
- Bluetooth Dongle buy on Amazon
- Webcam Compatible webcams or buy on Amazon
- Pan-Tilt Servo Mechanism and Servo Motors buy on Amazon
- Nuts and Bolts Various to be determined
- Smartphone and App To be developed based on demand contact me to vote
If you need to buy a single part then that is obviously better, better still if you have all the parts already lying around, but if you are buying all the parts, a better value may be to get a raspberry pi starter kit such as this one from canakit on Amazon for all the raspberry pi parts required.
The system operation for the two major components, the smartphone and raspberry pi, can be summarized in pseudo code, this is a representation of the control algorithms and will serve as the basis for writing the actual control code for the units.
Smartphone Control Pseudo Code
- Initialize UI
- Initialize accelerometer
- Initialize Bluetooth
- Connect to raspberry pi Bluetooth
- Initialize WiFi networking
- Connect to raspberry pi camera stream
- While 1
- Read accelerometer
- Condition data
- Send data by Bluetooth to raspberry pi
- End While
Raspberry Pi Control Pseudo Code – Pan-tilt Control
- Initialize servo motors
- Initialize Bluetooth
- Connect to smartphone
- While 1
- Receive Bluetooth data
- Calculate servo movement
- Move servos
- End While
Raspberry Pi Control Pseudo Code – Video Stream
It is expected that the streaming of the webcam video over the network will be done by one of the many webcam streaming apps that already exist for Linux on the raspberry pi, such as motion or MJPG-streamer. Some reference projects are at the following links:
>Raspberry Pi Motion webcam server: http://www.instructables.com/id/Raspberry-Pi-remote-webcam/ http://jacobsalmela.com
>Raspberry Pi Motion MJPG streamer server: /raspberry-pi-webcam-using-mjpg-streamer-over-internet/
Some reference code to get this project started can be found at the links below, these should shorten development time as they can be applied to the current application with some modification. This is generally quicker than developing everything from scratch.