disclaimer!!!! i am a n00b! please do note that everything that i have worked on is subject to...
TRANSCRIPT
DISCLAIMER!!!!
I AM A N00B!Please do note that everything that I have
worked on is subject to questioning.. in fact.. I suggest it.
This entire project was a learning experience for me. Ive worked very hard and built this all from
scratch.
Many of the things Ive learned I want to share with you, and any help or suggestion is good :)
What is a Segwii?
Seg WiiSeg comes from
Segway, which is a product.
This is the self-balancing part (where the real
coding happens).
The Wiimote, aka one of the most
hacked products out there.
A bluetooth based controller.
Libraries out there to interface (almost all
open source).
Lets talk about the Seg part
How do you balance? Lets start simple.
0
X-X
Motor pushes the other way based on the
angle.
Angle measurement based off the
accelerometer reading.
Torque = angle*gain
Gain is a constant based on your
setup.
Mach 1 (Ghetto bot)
MEMS Accelerometer
H-BridgeWiring (AVR ATMega128)
Cheap Lego
Motors
Total Cost: $130 (could be as low as $80)
But there is a problem!!
0
X-X
How do you account for the angular speed
you are going at a given angle?
Gyroscopic sensor,This will measure
Omega, which is angular velocity.
Feed this into your torque!
What about how fast you are going at that angle?
±X /s ±X /s
±X /s = W (Omega)
Torque = angle*gain + angular velocity*gain
Mach 2 (Now were getting somewhere)
Wiring (AVR ATMega128)
Accelerometer
GyroscopicSensor
H-Bridge
Status Lights(Not
necessary but helpful)
Cheap Lego Motors Total Cost: $230 (could be as low as
$180)
More problems!
The readings from the
accelerometer were very noisy!
This caused the bot to jitter like
mad!
Noise and constant assistance needed!Solution: Filter the angle
reading!
But how? and without putting to much load on
the processor?
Complementary Filter
With many possible filters, this is the most efficient way to filter the angle without having to much processing load.
Accelerometer
(Angle)
Gyroscope(Angular Velocity)
Accelerometer
(Angle)
Gyroscope(Angular Velocity)
Low Pass Filter
High Pass Filter
Complementary Filter
Angle = 90%*(Angle + Angular Velocity*dt) + 10%*(Non Filtered Angle)
Clean Angle
High Pass
Constant
Previous Clean Angle
Angular Velocity Reading
from Gyro
Time Rate of
sampling
Low Pass Constant
Raw Angle Reading from Acceleromete
r
This integration converts angular velocity to angle.
The angle noise is very accurate, but it can drift after a
while.
Gives you a general area of where the angle is.
Low PassHigh Pass
One problem left!
Assistance is constantly needed...
The bot may keep itself up for a few seconds but will keep over shooting the 0° mark.
Solution?
PID
Proportional Integral Derivative
PID
Proportional Integral Derivative
P I DProportion
alIntegral Derivative
Proportional changes torque
based on present information,
Directly based on angle error.
Integral changes torque based on past information,
and what has occurred
Derivative changes torque based on future trajectory.
Pterm = angle_error * Pgain;
Everything is error!
How off it is from 0°
Iterm = (Iterm + (angle_error * Igain))
* .9999;
Dterm = (angle_error - old_angle_error) *
Dgain;
0
X-X
±X /s = W (Omega)
Torque = Pterm + Dterm + Iterm + angular velocity*gain
Pterm = angle_error * Pgain;
Iterm = (Iterm + (angle_error * Igain))
* .9999;Dterm = (angle_error -
old_angle_error) * Dgain;
One more thing..
AngVelTerm = angvelocity*gain;
±X /s ±X /s
Mach 3 (Balance at last!)
Total cost: $300Could be as low as:
$250
So now that its balancing!
Lets hook it up to a Wiimote!
Wiimote
Using the Wiring or Arduino we can interface easily with Processing
Why? because they are married!
Using the wrj4P5 and WiiRemoteJ Libraries, communication can be established with the wiimote via bluetooth.
Wiimote gives computer an angle Computer scales and sends value to segwii via USB
Things I hated about this project!
Don’t get me wrong, I loved this project.. I just wish a few things were different!
1) The middle man
I say.. cut the middle man, give the Segwii bluetooth, and write drivers.
Things I hated about this project!
2) Segwii Hardware:- Gyro and Accelerometer need a temperature output- Encoders for the motor, for precise position control
- Better motors, with a properly tuned gearbox- Better batteries
3) The drivers I wrote:- Refining the drivers I wrote for the IMU 5DOF (Gyro and Acc)
- More precision!- Compensate for temperature, and add self calibration
4) The Wii part:- Based on the demo, you can see that the controls are quite
crude, and lot of refining is needed.
All of these need time and money...
Computer Requirements
Segwii GUI is currently available for Mac and Linux.
Hardware code IDE works on any OS.
I am Wii, and so can you!
All the code and hardware is now open source!
Help out, donate, or just learn!
Code and Schematics, and additional information and support can be found here:
http://www.segwii.com
Questions? Email me: [email protected]
DEFCON
Any ideas?
- Annoyance bot?- Goon Robot?- Robot army?
- Robot Server/Control me?
The End