davekrnavek.com
12Feb/101

arduino + nxt sensors

so i figured a decent project would be hooking up some of my lego mindstorms NXT sensors to my arduino microcontroller.  the local dorkbot group is spinning off an arduino group, which has definitely renewed my interest in the platform.

the nxt sensors all use an i2c two-wire interface to communicate with the main microprocessing brick.  there's a wire.h library for the arduino that simplifies most of the i2c communication with devices such as eeproms and other modules.  so, it's definitely possible to get the two communicating -- just a matter of figuring out the proper sequence of calls to make.  i've seen some pages online getting the arduino to talk to the main NXT brick, so this should be hopefully somewhat similar.

first step is hacking a NXT cable (i asked for some spare ones a couple of christmases ago).  the wires are stranded, so i soldered them to some solid-core hookup wire and insulated them.  so i'm able to plug it in to the arduino, at least...

so you can see the arduino sitting on my breadboard, along with another project -- a group of RGB LEDs with a 5941 PWM controller.  the connected part is one of the NXT motors, which also has a built-in rotation sensor.  so one idea is to use three of these to fade the red, green, and blue levels of the LEDs, for a little color mixing.  the NXT also comes with an ultrasonic sensor, a touch sensor (button), a color sensor, and i also picked up a third party 3-axis accelerometer.  so there's lots of interesting possibilities here...

Filed under: NXT, arduino, projects 1 Comment