Accelerometer Sensor and I2C Mystery

I have done more testing with the “ACCL-Nx-3g3x” accelerometer part from Mindsensors. My goal was to obtain the X and Y axis values from the sensor over Bluetooth using Lego NXT Direct Commands, and then link those values to pitch and roll gauges on a PC Dashboard.

First, I looked up what Lego NXT Direct Commands were needed to read the sensor's values over I2C. I checked the Mindsensors datasheet to determine what I2C command codes and memory addresses to use. Reading single axis registers worked well, however, when I started polling the sensor at 40ms intervals, NXT was timing out. It appears the NXT uses a software driven I2C, and there were some issues with glitches being introduced. I can confirm this has been fixed in Lego NXT's version 1.04 firmware released a couple of weeks ago. Downloading and installing the new NXT firmware fixed the problem for me, so anyone building home-brew I2C sensors should try the upgrade!

The colors and other properties can be edited, but here are the pitch and roll gauges I ended up with and included in the sample roboDNA Lego NXT dashboard:


Comments

Anonymous said…
Very cool!! I just got my NXT for Christmas and found this blog. I've got too much reading to catch up on! Where can I get this software and what does it cost? I've built a couple of robots and would like to create some gauges for feedback. I'm not expert programmer so is this hard to learn?
CAn a gauge tell me feedback on the ultrasonic sensor?

Kurt
Lou Morris said…
Good present! It's not too difficult to setup, but maybe so for someone who has not checked out Lego NXT's Direct Commands. Some users have had a tough time getting their Bluetooth drivers setup. You can check out robodna.com and send me an email if you need help.
Anonymous said…
Lou, interesting stuff. I also have two ACCL-Nx-3g3x. There is a mindsensors forum at http://groups.yahoo.com/group/mindsensors
which includes additional information and sample code (written in NBC)

Currently (on firmware 1.04) I am still getting occasionally severe bus hangs when reading acceleration data, which is a bit odd.

I've also written some PID control stuff that makes use of the accelerometers. Maybe it would interest you.
Manolo said…
Hi everybody. I need to read accelerometer values. I'm using HiThechnic Accelerometer, but i can't obtain the right values. I'm using Ubuntu 7.10 and nxtlibc to communicate with Lego NXT. Some suggestions?

Popular Posts