There are several Pan Tilt and Zoom (PTZ) caddies available for purchase on the main robotics websites to be used with the Raspberry Pi and other cameras that consist in two servos that manage to move the camera up and down (tilt) and to rotate the camera around from left to right and back (pan). However, most of the caddies available seem to have bad reviews and people claim that they are tough to assemble and require additional machining. It is however possible to design a PTZ caddy system from scratch, with minimal components, that can be used instead of a per-purchased PTZ caddy.
The following is a blueprint for a very simple two-piece caddy that can be used to create a PTZ caddy with the help of two servo motors based on some Chinese design that can be found online abundantly.
Along with the associated Adobe Illustrator source file.
During the realization phase it was deemed unnecessary to have the bracket go all the way around the plate such that the bracket was cut in half.
Along with the associated Adobe Illustrator source file.
The realization is split into the mechanical and electric realization sections.
The realization changes the blueprints a little (and they have been updated) in order to simplify the build a little. As you can see the bracket does not go all the way around the other side, like it did in the original build and that is because it is not required. Cameras that are meant to be used with the caddy are the micro-type cameras used for the Raspberry Pi or used with FPVs such that their weight will definitely not bend or distort the bracket that is meant to swivel in order to tilt the camera.
The results are fairly good and the two pieces are prepared to be painted. The caddy is meant to work with a device that incidentally is colored black such that both pieces will be spray-painted black as well.
As usual, filing down the aluminum a little using a steel thread brush in order to increase the grip of the paint, applying first the paint primer and then the black paint, the pieces are painted black to match the color of the project that the caddy will be used for.
The result is not too bad, with some problems given that for some reason the paint did not want to take hold on the back. Either way, after a fresh coat, the paint seems to be well-applied.
Now that the caddy is finished, the next part is to mount the servos. The servos chosen are the a pair of SG90 servo motors weighing just 9 grams and rated at a torque force of , which is way sufficient for the project.
These inexpensive motors are also created out of plastic and just like the previous judgments on simplifying the build, instead of screwing the motors into the aluminum caddy, it is much more efficient and also safe to just glue to the servo to the caddy chassis. Matching the price, the servo also seems fairly brittle when it comes to the connectors between the main wheel drive and whatever else must be fitted, with just a small threaded screw being provided. Following the theory on curses, it should also be said that coupling a cheap plastic torque wheel with a solid metal aluminum bit is bad omen and that such an arrangement will never work unless the bits are secured using some other technology. One the other hand, one has to keep in mind that the caddy is meant to provide a PTZ mechanism for cameras and in particular FPV cameras that incidentally boast about a low weight such that the torque provided by the servos should be more than sufficient.
The first servo is glued to the bottom plate and with the torque wheel pointing out perpendicular to the plane formed by the plate.
This servo will be responsible for roll (left and right) around its own axis. In fact, the transmission of force takes place mechanically, between whatever this bottom servo is secured to and the upper aluminum plate that holds the servo that will drive the swivel arm to achieve the tilt of the camera (up and down). JB weld, a better solution than just superglue, to the rescue and the servo is glued to the bottom of the aluminum plate.
Similarly, the top servo is mounted onto the plate, with the mechanical wheel protruding through the larger hole in the aluminum plate. The servo wheel will be connected to the tilt arm such that no friction between this servo and the aluminum plate is desired.
In order to better understand this, here is an image of the torque wheel protruding through the hole in the aluminum plate.
At this point, all that is required is to secure the arm to the top servo. Using pliers, the wheel is rotated to its extreme with the hopes of having an easy memorable value as the default reset point of the servo that corresponds to the swivel arm being perpendicular to the side of the aluminum plate. JB weld is applied to the orifice, the wheel and the other side of the swivel plate. The plate is then mounted onto the torque wheel and screwed in place with the provided screw. When the JB weld cures, the screw, the swivel arm and the torque wheel should be welded together securely.
Using the following Arduino code, the caddy can be controlled:
#include <ESP32Servo.h> #define SERVO_PAN 17 #define SERVO_TILT 5 Servo Servo1, Servo2; void setup() { // set up servo motors Servo1.setPeriodHertz(50); Servo1.attach(SERVO_PAN, 500, 2500); Servo2.setPeriodHertz(50); Servo2.attach(SERVO_TILT, 500, 2500); } void loop() { // tilt Servo2.write(0); delay(2500); Servo2.write(90); delay(2500); // pan Servo1.write(0); delay(2500); Servo1.write(180); delay(2500); }
where:
ESP32Servo
is an Arduino library for programming servos for ESP32 boards; the library also has an ESP equivalent, namely just plain Servo
,GPIO 17
, respectively GPIO 5
and these just so happen to be the GPIO pins to which the signal wire is pulled from the servo (the yellow wire),Note that the tilt ranges from to which makes the caddy move the swiper component just up, allowing a line of sight immediately above whilst the pan ranges from to meaning a full rotation as per the chosen servo-motors. The pan servo has to be calibrated such that the rotation corresponds to something useful, for example, movement around the main axis, with the camera pointing towards the front.
It is entirely possible to replace the pan and tilt servos with a servo in order to be able to also see behind but for the project at hand, it was deemed that it is unnecessary.