I made this pan and tilt to film the village theater from the back of the room. Due to the high zoom rate, slow movements are required.
As there is already a high density of wifi and bluetooth in this room, I have chosen to use a wired connection to avoid disturbances. The handiest way was to use an RJ45 ethernet cable (e.g. cat 5). The 4 pairs of wires carry the motor control signals, ground and power.
A Hall sensor joystick allows the camera to be positioned at a speed proportional to the movement of the stick. The speed is also conditioned by the position of the speed potentiometer. It ranges from 1 (slowest) to 255 (fastest). In the video below, the potentiometer is set to maximum speed.
The stepper motor drivers are mounted on a perfboard, directly on the underside of the pan and tilt base. The arduino, the display and the control devices are in a separate control box.
The control boxA Ky-023 joystick for Arduino gave no satisfaction because it was not precise enough. So I switched to a Hall sensor joystick that can be found on eBay under "Jumper Hall Sensor Gimbal"
The joystick, LCD display, speed pot and backlight pot are mounted on the front plate. Only one RJ45 connector is on the side of the box.
Inside the control box, the regulators, the Arduino and other components are soldered and wire connected on a perfboard. I used some SMD parts and an Arduino Pro Mini because there was not enough room for the Nano in the case.
But with the Pro Mini there is a problem: the 3.3V will be the reference for the ADC but the VREF pin is not connected. To overcome to this problem, I cut the track going to the RST pin and connected pin 98 from the ATMEGA328P to this freed pin. This is very tricky if you are not used to solder on such small components as the Atmega328p chip. I prefer to advise you to use an Arduino Nano instead...
In some situations the speed increase is growing too quickly at the end of the joystick stroke. So I added a switch according to the state of which the equation is changed dynamically in the procedure "CalculateSpeed". The position of the switch is displayed on the LCD screen (Lin. Fa. or Sl.), but it is only refreshed when a movement is requested by the joystick.
With this 3 position SPDT switch "ON-OFF-ON" (center is OFF), the choice between 3 equations is now possible :
- exponential - Slow growth at the beginning (same than in first version)
- exponential - slightly Faster growth in the beginning
- linear
See the graph below for the motor speed relationship as a function of the joystick position for each of the 3 equations.
The finished box looks like this now with the switch between the two potentiometers :
The drive is made with NEMA 14 (tilt) and NEMA 16 (pan) stepper motors of 0.9° per step. They are driven with a 1/16 micro-step. In order to achieve a slow and smooth motion, additional reduction is performed by pulleys and timing belts. The reduction ratio is about 15 to 160 teeth for the pan and 15 to 60 teeth for the tilt (the latter should have had 120 teeth instead of 60, but the pulley that was delivered to me was too damaged to use it). As no 160 teeth timing pulley was available, I machined a smooth pulley as big as possible (Ø 102mm) in a recovery piece of PVC. The drive is done by friction with the timing belt. A roller on an articulated arm and a spring keeps this belt taut. A small elastic metal bracket allows blocking the arm to release the tension of the belt when it is not used.
For the panoramic axis, I used a bearing assembly of a VCR playback head. I had made a mock-upwith a 3.5" hard drive spindle bearing, but I found it undersized for the camera I had (about 800g). I have since switched to a 4K camera that weighs only 400g. So the hard drive bearing might have been enough...
For end of rotation the aluminum plates mounted in the profile come to stop on the motor shaft. (see on the pictures below).
Two ball bearings were fitted with a spacer in the vertical profile for the "tilt" movement. The one outside is barely visible on the left picture. The black M8 torx screw is mounted inside. It fixes the notched pulley with the black arm. The stepper motor is fixed on a mobile carriage. A Wing Nut ensures the blocking after tensioning the belt manually. The white nylon stop on the motor carriage ensures rotation blocking with the black tilt arm.
A screw thread for a photo mount (Kodak pitch: ¼" UNC - 20 tpi) is inserted in the bottom plate, nearly vertical to the center of gravity.
Spirit level, hinged plate for wall mounting and a stop to adjust horizontality allow for different types of installation. In particular wall mounting in the theater room.
The centers of gravity of the moving assemblies, with the camera mounted, are placed as close as possible to the axes of rotation. Thus, the required torque of the motors has been minimized. The optical axis is a little off center. In use, this is not annoying.
With the assembly of plastic plates and aluminum profiles of recovery, the aesthetics is a little "DIY" but it works rather well. I worked without mechanical plans, with what I could find to recycle...
As a final improvement, I replaced the too noisy two DRV8825 by two AT2100 while waiting for the delivery of new TMC2208 (I had broken the first ones with a reverse polarity power supply). I can't recommend the use of these AT2100 drivers: there is no documentation on this chip and, on the other side, the micro-step ratio of 1/16 can not be modified if faster mooving shall be required...
The softwareThe software itself is a little bit tricky. Because of time consuming exponential calculations (something like ((x/40)^2)+ 0.1x), AccelStepper is not called in "loop()" but in a timer interrupt. This allow smooth and "fast" running of the stepper motors without hicking.
I have tried several equations for the calculation of displacement according to the position of the joystick (linear, exponential, first degree, second degree, cubic). The second degree equation was the one that seemed to me to were the most pleasant in the proportionality of the displacements. But you can choose which you like most or create your own one. You only need to change the equation in the function "CalculateSpeed". Commented out you can find there two other equations I tested.
Version 1.2 of the software. I mainly changed the setPinsInverted () of the two stepper motors because with the TMC2208 the direction of rotation is reversed. I also increased the joystick deadzone in tilt.
Before compiling the arduino software, you must copy to a subdirectory "Pan_and_Tilt_Head" these both files:
- "Pan_and_Tilt_Head.ino
Version 2.1 of the software:
Only changed the file "Pan_and_Tilt_Head.ino".The file "PrintAlign.ino" remain the same.
New in "Pan&Tilt v2.1":
- Replaced some "#define" with "const"
- Serial.print are commented out in the "loop" to gain compute time
- There was error in the formula: value was first divided and then squared instead of the reverse. The formula is now corrected and the factors are updated (the curve is the same than before)
- In some situations the speed increase is growing too quickly at the end of the joystick stroke. A 3-position switch now allows the choice between 3 equations.
Note: the position of the switch is displayed on the LCD screen (Lin. Fa. Or Sl.) but is only refreshed when a movement is requested by the joystick.
*/
Comments