Introduction: Stewy Mk1

This is a semi-professional attempt to build an easy, cheap and working so-called "Stewart platform".
In the end, you will more or less be able to balance a ball on the top sheet of the platform wearing a glove, which is connected with an accelerometer :)

Supplies

- Arduino Uno

- 6 servos

- accelerometer

- lots of jumper wires

- breadboard

- cardboard / 3D printer

- wood sticks or steering rods from an RC car

- computer

Step 1: Step 1: Build the Platform

You will need to triangles, either cut out of cardboard or 3D-printed, where you cut off the edges. The upper triangle should be fully covering the lower one when laid on top and rotated by 60 degrees.

On the lower plate, you glue the six servos in the same way you can see on the images. Of course, there are more scientific ways of finding out the perfect position of each servo in regards to its connection to the rods and the upper plate, but for our use, this method works fine.

Once positioned all servos, you can start to think about a clever way of attaching the rods to both of the plates. In this case, we used a combination of 3D printing, screws and rubber band.

Step 2: Step 2: Accelerometer

Your accelerometer will have a lot of metal holes where you can attach stuff, but if you want to have a reliable connection, just putting wires through the holes and kinking them afterwards won't work.

You can either connect the accelerometer to a small breadboard with the "adapter" coming with the accelerometer, or you are as cool as us and show your soldering skills ;)

We only need connections to the first 4 holes. (VCC, GND, SCL, SDA)

Step 3: Step 3: Wiring

Now the fun parts start. Check the image for detailed information.

Basically, we connect all servos + the accelerometer in series to the 5V output of the Arduino. Of course, an external power supply would be a great idea here, but you know how it is...

What is left to do is only to translate information:

For the servos, the orange cable is doing that, which we are connecting to the digital ports 2-7 on the Arduino.

The accelerometer is a bit more complicated. The "SCL" and "SDA" outputs we connect to the analogue pins "A5" and "A4" respectively.

Step 4: Step 4: Code

Well, tbh, the code is a mess. We tried to include all maths required to translate a 2-axis.movement to 6 axes into the Arduino code in order to run the Arduino without a computer.

So do not get shocked by the line count of the code, most of the stuff is copied and translated math from Wikipedia.

There are three code files, two for setup and test, and one for the final thing.


First, you run the "reset to 90" code. This just rotates all servos to their mid position. Then the platform should look similar to the one in the pictures. The rods have a 90 degrees angle to the lever coming from the servo.

If not, just detach the lever quickly and put them back on in the right position.

The second code you wanna run is the "up and down" code. This one is not using the data from the accelerometer to move the platform but just rotates all servos at the same time to create an "up and down" movement. It is great to look at when it is working, so you can also call it a day afterwards, place the platform on your desk and call it art:)

But if you want to continue, here is the last part. Get on the glove or breadboard with the accelerometer and run the "stewy" code.

Here is some explanation:

We use 2 libraries, one for the servos called "Servo" and one for the accelerometer called "Wire".

Once they are imported, we initialise a bunch of variables for the math, all the servos and the accelerometer.

Then we are in the setup function, where we initialise the connection to the accelerometer and attach the servos and rotate them to their starting position (90 degrees).

In the loop, we then read out the data from the accelerometer, which by the way is sent in bytes, so we need to first encode them to get the right angles.

These angles we then feed in our maths calculations, which spits out 6 numbers. These six numbers are the rotation angles for the servos, which we send in the last part of the loop.

Step 5: Stewart Platform

Of course, there is more to the Stewart platform, and a lot of behind-the-scenes setup and math done in the code. But that's probably too much for here, and is already described a thousand times across the internet, so happy googling!

Arduino Contest

Participated in the
Arduino Contest