Arduino Forum

Forum 2005-2010 (read only) => General => Exhibition => Topic started by: arduino.poet on Sep 17, 2008, 05:16 pm

Title: Arduino + Lego NXT
Post by: arduino.poet on Sep 17, 2008, 05:16 pm
Hi everyone!

I'm proud to introduce you to... Arduway, a robot made of Arduino and Lego NXT components.
I'm releasing soon a software library to control LEGO NXT motors and a few sensors I have used: it's not as well documented as it could but I think it will still be better than nothing...

(http://img246.imageshack.us/img246/7857/turitwapf6.th.jpg) (http://img246.imageshack.us/my.php?image=turitwapf6.jpg)

A short movie is coming soon as well!
Title: Re: Arduino + Lego NXT
Post by: mikalhart on Sep 17, 2008, 07:38 pm
Outstanding!  Thanks for sharing.  I look forward to the collateral and libraries.

M
Title: Re: Arduino + Lego NXT
Post by: arduino.poet on Sep 18, 2008, 07:19 am
Video: http://www.youtube.com/watch?v=Tw9Jr-SPL0Y
Hope you enjoy  :)
Title: Re: Arduino + Lego NXT
Post by: Grumpy_Mike on Sep 18, 2008, 11:37 am
Now that is impressive well done.  :D

The last 30 seconds of the video is just black, is that right?  :-?
Title: Re: Arduino + Lego NXT
Post by: Syvwlch on Sep 18, 2008, 04:03 pm
Nice! Thanks for sharing :-)
Title: Re: Arduino + Lego NXT
Post by: arduino.poet on Sep 19, 2008, 09:11 am
I'm proud to announce that the library I've created, arduino2lego, is now on Sourceforge:
http://sourceforge.net/projects/a2l/

Since it's not well commented, if you have any questions about hardware/software, just ask and I'll be glad to explain what I've done  ;)


PS: the video is all black at the end... sorry...
Does anyone know how to crop it without losing comments, views?
Title: Re: Arduino + Lego NXT
Post by: TomP on Sep 29, 2008, 02:37 am
I'll bite. How are you measuring the tilt?  A accelerometer, a gyroscope or both?  Or, are you doing it with distance sensors?

Tom
Title: Re: Arduino + Lego NXT
Post by: arduino.poet on Oct 02, 2008, 01:28 am
The tilt is measured by a gyroscope (Epson).
The gyroscope tells angular speed so integration is needed to obtain actual angle.

Datasheet(s):
http://ndap3-net.ebz.epson.co.jp/w/www/PDFS/epdoc_qd.nsf/f5af260ddc5fb8ed49256a9c001d58b2/6c3c798debd98cfe492571f1000ff2dc/$FILE/XV-8100_E082.pdf
http://www.epsontoyocom.co.jp/english/product/Sensor/set01/xv8100cb/index.html
Title: Re: Arduino + Lego NXT
Post by: msx on Oct 02, 2008, 03:24 pm
and how do you correct the drift ?

PS great work!
Title: Re: Arduino + Lego NXT
Post by: arduino.poet on Oct 02, 2008, 07:31 pm
The drift is not evident in the first moments of functioning so it was satisfying enough for our purpose.
I tried anyway to correct it (to make the robot stand up hours and hours) using a band-pass filter (instead of an integrator) but it was not working as well as one would expect.
...Are you aware of any other method?

It would certainly be better not to have to integrate: this would avoid the integration drift.

As a conclusion... if you're thinking of creating your own Arduway think of replacing the gyroscope with a compass that directly returns the angle.
Title: Re: Arduino + Lego NXT
Post by: TomP on Oct 02, 2008, 07:54 pm
Quote
..Are you aware of any other method?


To do it right, it sounds like you need an accelerometer, too.  David Anderson provides a pretty detailed description of how he did this on his nBot web site (http://www.geology.smu.edu/~dpa-www/robo/nbot/)

He explains, "The gyroscope and accelerometer are combined with complementary filters to provide an inertial reference sensor. The ADXL202 accelerometer provides accurate static tilt information, when the robot is not accelerating. The gyroscope can be integrated to provide accurate dynamic tilt information, but the integration tends to drift over time. Combining the two sensors provides a robust inertial measurement."

But, there are apparently a number of different ways to make a balancing robot.  I've heard of at least one person who managed to do it using distance sensors to figure out the tilt based on the distance of the sensor to the ground.  

Title: Re: Arduino + Lego NXT
Post by: arduino.poet on Oct 02, 2008, 09:04 pm
That's interesting!
Very nice idea (and very nice implementation!).

In my opinion an angle sensor can be enough (it certainly is enough in Matlab simulations).... and it is certainly less expensive than two sensors (BTW, I'm saying that because cheapness was one of the aim of the project).

The robot works pretty well even with only a gyroscope... if you start your own project keep in mind that an angle sensor (or maybe gyro + accelerometer) is better.
Title: Re: Arduino + Lego NXT
Post by: DojoDave on Oct 08, 2008, 08:05 am
you've been blogged:

http://arduino.cc/blog/?p=89

/d
Title: Re: Arduino + Lego NXT
Post by: arduino.poet on Oct 08, 2008, 02:15 pm
Thank you very much!  :)  :)  :)
Title: Re: Arduino + Lego NXT
Post by: Qubix on Oct 08, 2008, 10:32 pm
Well done,
Its a really nice project and great platform for control scheme design.

I have one question if you don't mind me picking your brain. How did you do the numerical integration? On the arduino itself? or integrate the signal before the arduino a/d?

If on the arduino what algorithm did you use? and what time step did you use?

Thanks and well done again.

David
Title: Re: Arduino + Lego NXT
Post by: arduino.poet on Oct 09, 2008, 08:36 am
The integration happens inside Arduino.
I preferred not to do hardware integration because I hoped that software could give me more flexibility.

I chose the fastest sampling time I could, which is 4 ms (--> 250 Hz).
I first used the rectangle method for integration but now I've preferred the trapezoid method to minimize the error: what I've found out is that most of the error comes from (1) the sensor and (2) ADC approximation.

Anyone going to replicate this robot should use an angle sensor (maybe I2C based) instead of a gyroscope; integration is bringing avoidable error.
Title: Re: Arduino + Lego NXT
Post by: Qubix on Oct 09, 2008, 01:30 pm
Thanks,

I'm think I'm going to have to do integration for another project. (control of a flexible link). So nice to see its possible with the arduino. :)

David
Title: Re: Arduino + Lego NXT
Post by: kacie on Oct 17, 2008, 07:28 pm
this is awesome.
Title: Re: Arduino + Lego NXT
Post by: odavilar on Oct 26, 2008, 02:52 am
Where can i find how to connect this motors to the arduino? or how it works the protocol used by NXT
Title: Re: Arduino + Lego NXT
Post by: arduino.poet on Oct 26, 2008, 10:57 am
I'm making available my thesis as a free download (CC license) here:
http://trive.dyndns.org/tesi_web.pdf.
(Please report if the link gets broken)

Unfortunately it's in italian (description of NXT connectors is on page 59-60) and it's mostly about the theoretical part of the problem.

What you need to do to drive NXT motors is to:
Title: Re: Arduino + Lego NXT
Post by: walteren on Nov 18, 2008, 11:59 pm
This is exactly what I am planning to do, I am glad I found this as my guide. Thansk for sharing.

And that would be my first robot.  
Title: Re: Arduino + Lego NXT
Post by: hrmehta15 on Dec 21, 2008, 07:21 am
Your link to tesi_web.pdf is broken. Have you published your circuit and other details anywhere else :'(?
Title: Re: Arduino + Lego NXT
Post by: edsimmons on Dec 21, 2008, 12:39 pm
Great project! Why is it not call Segduino!?

You might be interested in the project I am working on at the moment, simply because its using an Accel (3axis) and a gyro.

http://www.eclipseaudioservices.co.uk/extras/helicopter.html
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1229733416

Using Kalman filtering to remove the jitter, and to correct for the drift of the gyro I used the demo code for my sensors and bits from here: http://tom.pycke.be/mav/71/kalman-filtering-of-imu-data

I will be putting the code for the helicopter online soon, but it needs tidying up first.

You should try making one with just one wheel - that would great!
Title: Re: Arduino + Lego NXT
Post by: rayvbr on May 13, 2009, 04:15 pm
Could you give some more information on how exactly you made the connection from Arduino to the NXT motors?
Title: Re: Arduino + Lego NXT
Post by: kev on May 13, 2009, 06:25 pm
how would you connect a servo to arduino?
i tryin to figure that out ever sience march >_>
Title: Re: Arduino + Lego NXT
Post by: paubla on Dec 03, 2009, 12:29 pm
Hi,
great job. I'm new to Arduino and I've got to this from Lego NXT. I think Arduino is much more powerful and flexible than NXT, but I love Lego technich to build, and I already have a good assortment of parts. So I was looking for the way to use Lego elements (motors, sensors...) with Arduino. Your work looks great. I'll try it.
By the way, do you have the schematics of the Power Funcitions motors? Have you connected them to Arduino?
Thanks.
Title: Re: Arduino + Lego NXT
Post by: arduino.poet on Jan 02, 2010, 05:49 pm
Here is a document that might interest who wants to connect an Arduino to a LEGO NXT motor.
http://www.scribd.com/doc/24698262/Rj12-and-Lego-Nxt

Also, my thesis on Arduway has been published on Scribd:
http://www.scribd.com/doc/24546913/Progettazione-e-implementazione-del-sistema-di-controllo-per-un-pendolo-inverso

Hope this helps someone out there, bye!
Happy 2010.
Title: Re: Arduino + Lego NXT
Post by: Josestude on Dec 30, 2010, 10:12 pm
How did you connect the NXT servos to the Arduino?  I've been looking for a pinout of the NXT parts.
Title: Re: Arduino + Lego NXT
Post by: Divyanshu on Dec 31, 2010, 07:26 am
This was Awesome!
I'm new to Arduino, though I'll try to make one of these soon
Kudos!  ;D