## martes, 4 de enero de 2011

### NXT Two Wheels Keys

The two-wheeled inverted pendulum (Two Wheels) is a variant of the typical engineering problem of inverted pendulum on a moving truck. In this version introduces new control variables associated with the two axes of rotation that has the new system, as well as moments of inertia of the motors.

The solution implemented with LEGO MINDSTORMS NXT known for his tremendous mechanical simplicity. Any provision of two motors and wheels on the LEGO kit applies to stabilize an inverted pendulum. In fact, the NXT Tribot (three-wheeled robot base) can also be used as TwoWheels

As noted, I have used in this case for a TwoWheels Tribot

This was my first version of the inverted pendulum:

Really the key component in this solution is a device called GyroSensor HiTechnics.

The HiTechnics GyroSensor is a component designed for LEGO NXT compatible with the I2C serial communications interface that provides a measure of the speed of rotation on an axis. In our case, NXT TwoWheels the GyroSensor lets us know the speed of rotation in units of degrees per second, ranging from 0 to 1024, returning a value close to 512 at rest.

The following chart shows GyroSensor response to a swing, square wave.

The following table shows the integral of the previous graph:

The first experience before facing the pendulum should be invested directly characterize the sensor and perform some previous practice of measuring tilt, where we learn to make two key exercises: Bias Estimation and Numerical integration.

The numerical integration is the process by which we estimate the absolute position of our inverted pendulum, from the speed (with a bit of memory recall that dx / dt is the rate, and conversely the integral of velocity, is the position. According to this principle we should integrate GyroSensor measurement or by a method RungeKutta or by first-order linear integration, which in our case will suffice.

The Bias factor is the reference measurement (theoretically 512), we estimate, because its exact value is unknown, since it depends on manufacturing processes and further varies with temperature. Its value therefore must be upheld at all times.

When we have the integral position value and the value of bias, we can determine the absolute position in degrees of inclination of the platform, as the difference between the Integral and Bias.

Although it seems a bit complicated, making a simple practice of "standard mail" with a single engine means the dynamics quickly. (This is to make a small program that keeps a beam level with GyroSensor solidarity, which always keep it horizontal but revolve with the platform).

And from there, once dominated the extent of GyroSensor the problem of stabilizing the inverted pendulum can be addressed using a dual classic PID controller (Proportional-Integral-Derivative) the first PID to the tilt and the second PID control TwoWheels our position if we do not want to go running around the house until it crashed against a wall.

Position control is easily solved by changing the reference desired position Xo of our PID position. The first experience can be solved by a timer thread that reference this position moves at constant speed, but more interesting is controlled via Bluetooth that reference.

Bluetooth communication is very easy to program, since both the LEGO NXT and the PC communication port implementing a standard COM series and from there, simply send a little message every time we wish to increase or decrease the reference position.

Basically this is the mental guide we must follow to understand the development of our TwoWheels.

I hope you enjoy this project as much as me.

Other Projects: aquí.
Other Blogs: http://ballbotexcel.blogspot.com/  http://nxtballbot.blogspot.com/

#### 3 comentarios:

1. NXT Two Wheels Keys is a great blog,it is very useful. Thanks for it!!

Wheel balancers

1. I agree for it. :-)