Intro: Arduino Controlled Rotary Stewart Platform
This instructable is about building a Rotary Stewart Platform. It allows to position its moving platform in six degrees of freedom. This specific platform is designed to be able to position a DSLR or any other digital camera.
This version of Stewart Platform uses instead of linear actuators just ordinary hobbyist servos for motion. Whole platform is controlled by an Arduino Uno, it computes all necessary equations to get the platform into right position and also controls servos.
Video of movement of completed platform can be seen here. Quality is not very good, but camera with better picture was at the time of capture on the platform. It was set-up for random position every 4 seconds.
Some informations about platform:
- weight of load can be up to 2Kg (platform tested with 1.5Kg with no observable problems during moves in whole range of movements), theoretically platform should be able to cope with even higher loads, but it wasn't tested with such load
- low power consumption - with load of 1kg was consumption of around 5W.
- very good fineness of moves - smallest possible move is around 1mm
- perfect ability to repeatedly achieve the same positions.
- good stability of platform even with big loads.
All source files for platform (templates, Arduino source code, code for communication library can be found here.
Price of platform mostly depends on the price of servos and of the Arduino board. Cutting of parts, all other needed parts cost at most 50$. Total price can be around 150$.
IrDA and LCD with I2C interface were bought from ebay, they are very cheap (together around 10$)
Parts of platform are cutted from acrylic, i used 4mm acrylic.
- tools needed for soldering and creation of PCB for connecting external power supply
- measuring tools
- double sided tape
In case of any questions, feel free to contact me.
Step 1: Building Moving Platform
We start by cutting parts from acrylic, here we will use templates from files platform_bot and platform_top. This platform is divided into two parts for better universality, just by changing top part of platform you can adapt it for various purposes. They are put together using screws placed in holes A1-A3.
Dimensions are chosen with respect to size of ordinary DSLR. Platform can be changed to be smaller or bigger.
At denoted places B1-B3 in bottom part of platform it is needed to drill holes which are used for anchoring of connecting rods. On third picture you can see proper way of doing that. These weird deformations in acrylic were caused by using CA glue to fix screws in acrylic.
On top of the moving platform it is necessary to place a piece of rubber or foam and fix it there with double sided tape. It will prevent unwanted rotations and movements of camera on the platform.
Length of connecting rods should be around 12cm and they should be bended as can be seen on picture of completed platform. This bend greatly improves range of movements. Length of rods should be chosen so that the angle between servo arms in horizontal position and the rod is around 70°.
Step 2: Building Base of the Platform
To build base of the platform we will at first need to build PCB for connecting external power supply for the servos. Basic idea behind it and whole schematic of all connections can be seen on the schematic. Layout of the PCB is in the power_board_layout.svg. To all connection points in blue rectangle will go pins for connecting servos. In green area should be sockets for providing power to other accessories such as LCD and IrDA. In purple is shown connection point of power switch. By letter C are denoted positions of capacitors. Last signal cable is connected to ground, this one will be connected to GND socket on the Arduino. Without this connection, servos would run very badly.
Next you should cut main base parts from acrylic based on templates base_bot and base_top. At first, fix the PCB on the bottom part with screws through holes C, and fix three connecting legs (from file servo_arm.dxf) to holes B1-B3. Next place servos on top part, servos should be mounted in holes A0-A5, their signal cables should be led through holes S and W, the right way can be seen on a provided picture, connect all servo connectors to the board, also get all signal cables supposed to go into the Arduino to the top side through holes W. Now fix the connecting leg on top side of base, now it should hold together tightly, if servos can move, fix them with a bit of glue from hot melt glue gun.
Screw spacer screws into holes AD, fix Arduino on them, connect all the cables. Fix the power switch in hole SW. IrDA receiver board is easily fixed with screws through holes I. To fix LCD it is necessary to fix it through helper post - it is fixed on top of the base, LCD is fixed to it from front side. Also connect all cables for LCD and IrDA.
Step 3: Putting It All Together
Cut 6 pieces of servo arms from file servo_arm.dxf. Drill hole on far side with right dimension to be able to screw there nut bolt for ball joint. On the other side drill hole through the arm, place there nut bolt used for fixing it on the servo. This can be seen on a provided picture.
Place all servos into zero position (pulse length of 1500us), then place the arms in horizontal position, tighten the screw. Now is the platform complete and ready to be used.
In source codes, there is file platform.ino, this is main program for the Arduino. Here you have to change few variables with respect to built platform. Many variables are shown on a picture.
MIN and MAX defines - min and max values of servo pulse length
zero - pulse lengths in which arms are in completely horizontal position
beta - angle between x axis and servo arm
servo_min, servo_max - angle of servo arm in min and max position
servo_mult - values are from technical documentation of the servo, it's pulse length and the resulting angle of rotation corresponding to this pulse length
L1 - servo arm length (from servo rotation point - middle of axis to the center of attachment point - ball joint). In inches
L2 - connecting leg length, in inches
z_home - height of moving platform above base, distance between servo arm and platform.
RD, PD, theta_p, theta_r values - they can be seen on pictures in previous and in this step.
equations for x and y position of servo rotation points on base and platform attachment points, they have to be calculated specificall with respect to desired orientation of x axis. It is just basic goniometry, provided picture can help understand these equations.
Step 4: How Does It Work?
Controlling platform uses inverse kinematics. We know position of base, desired position of platform, then calculate necessary rotation of servos, send them right pulses and its done.
First it is important to define basic position of base rotation points and attachment points of platform, this is bit explained in previous step.
After obtaining values of desired moves, program calculates corresponding position of moving platform attachment points. This is separated into two parts, getting translational vector - vector of movement in x y z axis, rotational matrix - matrix representing values of movement in pitch, roll, yaw, next it is combined in function getrxp, result is new position of platform. From this program finds necessary rotation of each servo, converts this angle into corresponding pulse length and sends it to the servos.
Platform with provided source code listens on serial interface, it accepts at first controlling char which denotes action, then it either executes the action or obtains/sends some data. For easier control of the platform, in src_comm_lib is C++ library for easier interfacing with Arduino, in header file there is explained its usage.