Robotics‎ > ‎

Arduino and NXT Sensors

NXT sensor cable pinouts


Arduino pinouts

Analog Sensors

Similar to our project

NXT Ultrasonic I2C sensor

Arduino and NXT Ultrasonic Sensor

Infrared-Ultrasonic Beacons -

From Lego Mindstorms NXT Hacker's guide
page 116
Equipped with its own microconroller, the NXT ultrasonic sensor is able to accurately measure the distance between itself and an object that is in its path.  It has an emitter and receiver.
The emitter generates an ultrasonic sound that is "chirped" from a piezo crystal microphone-like element.  This chirp has a fequency of 40 kHz and a sound level of 110 dB when measured at 30 cm.  Once this sound wave reaches an object, it is reflected back to the sensor.  This reflection is called an echo. Once this echo has been detected, the onboard microcontroller calculates the amount of time that has elapsed between the initial chipr and the reception of the return echo.   

Emissions ranging from single chirps to time-delayed "bursts" of chirps can be programmed into the Brick.  The spacings of these bursts can be controlled between 80 msec and 2.5 s.  The default burst rate is 10 - 15 bursts per second. 

A deflection of approx. -10 to +10 cm either side of the sensor's centerline will rpoduce valid measurements.  Degradation of distances greater than 78 cm.


Digital Sensors - I2C

Arduino and the I2C bus

Using the NXT to interface with I2C

 Arduino Duemilanove, Uno or100% compatible board, you will be using pins A4 for SDA (data) and A5 for SCL (clock).  So, from the NXT cable, pin 5 from the NXT cable plugs into A5 on the Arduino and pin 6 from the NXT cable plugs into A4 on the Arduino.

Arduino and I2C

Two possibilities to use a motion detector with the Arduino:
  1. Connect the Vernier motion detector to the Arduino.   Figure out how to use I2C to read from the motion detector.  Here's a starting point in which an Arduino is getting compass heading readings through I2C:
  2. Connect a ping ultrasonic range finder to the Arduino.  Here's a video from Sparkfun:
    1. Here's some info on hooking up the ping ($25.95):
    2. For wireless capability, check here:   Arduino and Wireless  There are two options, the XBee (expensive, and you need to buy the XBee that would attach to the arduino and another board for the computer.  Or, you can try the much cheaper option of a transmission receiver pair ($5) from:   Here's a video of someone using it for their nunchuck controlled robot:
    3. How do we interface to either of these options using Matlab?  Does the XBee interface as a serial port?  Does the receiver?

Intro to using the I2C bus:

Some info from a forum for one arduino sending data to another over I2C:

Using the I2C bus with an accelerometer:

Here's an arduino connected to a Radio Shack ($10) motion detector.  It doesn't detect distance, just motion.

I2C right from computer (Mac OS - yay!):