3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Easy build self balancing electric skateboard

Step 26Gyros orientation

Gyros orientation
Can be tricky to get your head around which gyro is doing what and in which axis of rotation.

NOTE: (March 2011) I have added a lot more on this with photos and video on page 41 as very easy to get this all mixed up in which case your machine just will not balance at all!

Do the soldering properly and carefully, no bodges here otherwise your machine will behave chaotically.
I have also added an IMU testing sketch to check this is set up correctly (see page 41 onwards).


Accelerometer used because will give accurate data on which way is upright (direction of gravity). However it is very sensitive to vibration and we have a lot of that over anything other than smooth flooring.

Gyro gives instant real time data on rate of rotation (i.e. rate of tipping over of our machine), is insensitive to vibration BUT drifts slowly with time.

If you wire up the IMU as I have in the photos then the diagrams on the right will hold true.

The IMU is interesting as the gyros each have 2 output pins with a varying voltage on each. One is relatively insensitive but works up to a rotational speed of 500 degrees per second. The second is more sensitive and works over a range up to 110 degrees per second. The arduino software is therefore written to read the insensive one when tipping fast, but switch to the other higher resolution one when tilting more slowly.

The "complimentary filter" uses best bits of each: the gyro is used to measure very short term changes in tilt and the accelerometer readings are averaged over time to give a stable value of which way is "up." This is then used to correct the drift of the gyro.

If you read around this on the net it is called PID tuning. There is also a very complicated way of doing the maths called a Kalman filter. However an engineer told me that ths is only optimal when you know the control inputs as well (as in an aircraft).  In this case the "skateboard" is dumbly just trying to stay upright, it does not know if I am leaning more on one end or the other or how flexible my joints are etc. Therefore he told me the complimentary filter is actually the more appropriate technique to use.
I am not an engineer so I am sure there are some out there who will expand on this or correct me if I am wrong.

Anyway, bottom line is that the complimentary filter works fine. Also, no matter how much modelling people do they all seem to in the end have to fine tune their devices by hand (there are links to many other segway type projects on my website).
« Previous StepDownload PDFView All StepsNext Step »
2 comments
Aug 7, 2011. 5:05 PMPositive07 says:
Which gyro is that? it is from sparkfun?.... Oh and i have to said your board is awesome :D
Mar 29, 2010. 7:55 PMsiedpe13 says:
anti-clockwise, lol, i believe the correct term is counter-clockwise. But im seriously considering to follow this tutorial as it is so well done putting this together should be do-able

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
127
Followers
10
Author:XenonJohn