Page 1 of 2

Self balancing motor bike

Posted: 14 Apr 2013, 18:36
by nxtstep1950
Hello everybody,
Short presentation : Since 4 years, I am an enthusiast builder of Lego Technic bricks for the frame and MindStorms components for the artificial intelligence. Amongst various relevant réalisations, I have Rex, a GPS/compas driven off-road car and a "SegWay" design from HiTechnic.

For now, I would like to experiment a self balancing bike based on the design of JTM Mutsaerts (University of Delft - NL).
Project name is NXTBike-GS. Video : http://www.youtube.com/watch?v=o7nSQ2ycGX4

The hardware is ready, but I lack a lot on the adequate mathematical rules for finding the balancing équations and sensor filters to apply to get my bike standing up (drive and steer). A few programs I saw were far too complex to understand for me and to implement correctly (MatLab, LabView,SimuLink,NXTosek, Robot_C, ...)

My questions are :
As far as you know, are there any ressources written in NXT-G V2.0 available (open source) for realizing my self balancing motor bike ?
Are there any good technical references that could help me writing the application ?
Are there any distinguished Member that has build such a self balancing motor bike and would accept to share some knowledge ?

I thank you in advance for any advises.
Thank you & best regards

Re: Self balancing motor bike

Posted: 14 Apr 2013, 20:20
by HaWe
I would try using a PID controller.
p, i, d surely must be found empirically, a complete mathematical model for this self-balancing bike is beyond everything I can imagine for the moment.
But I actually don't know if there is a PID controller already written in NXT-G.
And if you'd try to build something by your own: consider that this is a University project as it appears to be.

Re: Self balancing motor bike

Posted: 14 Apr 2013, 22:43
by mcsummation
HiTechnic has a PID block for NXT-G. Look at http://www.hitechnic.com/downloadnew.php?category=13, most of the way down the page. Look for "HiTechnic Motor PID Block".

Re: Self balancing motor bike

Posted: 15 Apr 2013, 08:41
by HaWe
The only PID block I can find at Hitechnic's website is a motor PID block. This is probably a motor-speed controller related to motor encoder targets.
But in the case of the TOP question a PID controller for motor speed related to gyro or accelerometer data would be needed - that is supposed to be something quite different (CMIIW).

In fact, the mathematical approach would be more like in the HT balancing segway robot based on gyro data.

Re: Self balancing motor bike

Posted: 15 Apr 2013, 15:02
by hassenplug
nxtstep1950 wrote: The hardware is ready, but I lack a lot on the adequate mathematical rules for finding the balancing équations and sensor filters to apply to get my bike standing up (drive and steer). A few programs I saw were far too complex to understand for me and to implement correctly (MatLab, LabView,SimuLink,NXTosek, Robot_C, ...)

My questions are :
...
Are there any distinguished Member that has build such a self balancing motor bike and would accept to share some knowledge ?
If I read this correctly, you would like someone to share the knowledge about self-balancing, and all the stuff you've see so far has been too complex to understand.

Given that, I would suggest you attempt something simpler to start with. Given that you have a "SegWay", you should be able to use the same concepts for a bike. If you don't understand the math rules, you should try to understand that better, before moving on.

If you have any questions, I'm sure there are several people who could help.

Steve

Re: Self balancing motor bike

Posted: 15 Apr 2013, 22:41
by mcsummation
nxtstep1950 wrote:Are there any distinguished Member that has build such a self balancing motor bike and would accept to share some knowledge ?
I just got my NXT brick freed up from a previous project. I do not have all the parts to build the bike (the tires, maybe some other parts) so I will need to order them. When I get it built, I will work with you to get it programmed in NXT-G v2. We can then share the code with other people. (It will be several days before I can get the parts.)

Is this OK?

Re: Self balancing motor bike

Posted: 17 Apr 2013, 16:25
by nxtstep1950
First, let me say "Thank you" for the inputs provided up to now. I'll take them in account.

@ mcsummation :
This is OK, and I 'll be happy to share discussions and NXT-G codes about this very challenging but exciting project at the happyness of all MindStorms project builders.

As suggested by the site "http://bicycle.tudelft.nl/schwab/Bicycle/" itself, here you can download the design (NXTbike-GS Design.pdf) and the building instructions (NXTbike_GS_Building_Instructions.pdf).
Credits to : TU Delft (NL) - Mr Schwab & Mr. JTM Mutsaerts.

http://bicycle.tudelft.nl/schwab/Bicycle/
http://www.mathworks.com/matlabcentral/ ... ange/27694
http://bicycle.tudelft.nl/schwab/Bicycl ... Design.pdf
http://en.wikipedia.org/wiki/Bicycle_an ... e_dynamics

As suggested, one may examine as well the NXT-G codes provided by HiTechnic for the HTWay (SegWay alike)
URL : http://www.hitechnic.com/blog/gyro-sensor/htway/
SegWay is a TradeMark

Best regards

Re: Self balancing motor bike

Posted: 19 Apr 2013, 23:31
by mcsummation
I was looking at the wheels/tires that are used in the bike. What size does it say on the tire? Is it 81.6 x 15? The BrickLink reference is http://www.bricklink.com/catalogItemInv.asp?P=2903c01.

Re: Self balancing motor bike

Posted: 20 Apr 2013, 07:42
by nxtstep1950
Hi,
The Lego inventory list shows N° 290301 for the wheels and n°4563182 for the tires.
So, I think, It looks good.

;) Rgds

Re: Self balancing motor bike

Posted: 20 Apr 2013, 18:35
by nxtstep1950
For our coordination, my model shows the following data :

Gravity of acceleration : g = 9,81 m/sec2
Mass of Wheel : 0,03 kg
Radius of Wheel : 0,040 m
Total weight : 0,710 kg
Weight on front Wheel : 0,230 kg
Weight on rear Wheel : 0,480 kg
L-base : 0,240 m
L-trail : 0,01 m
Head_angle = 70 deg
V= 0,6 m/sec (I suppose)

Changes from model :
I have put a LiPo battery on the NXT brick
I have put the gyro sensor in the middle of the body instead of on the side

;) Rgds