Pages

August 11, 2012

Hacking the Lego NXT - Part 3


After my slight diversion post of The Old, the New, the Data and a wonderful two weeks with my grandparents, I figured I should update you on my progress with my NXT venture, but before I begin, I would like to point towards a site called MarkPond, a bookmarking service that Alex Forey, a fellow pupil, created within two weeks and hosts the whole thing on two Raspberry Pis. To be honest, I have had one much longer than him, but I was too lazy to do anything with it as of yet. If you have any ideas, please let me know!

Ultrasonic Sensor


The ultrasonic rangefinder
This was an interesting sensor to crack! From my experience working with ultrasonic range finders, I assumed that, as with the SRF05, one sends a pulse to one pin and then waits for the return pulse from another pin, with the delay between telling you how far away the object is. That was until I had a look at the LegoHardware Development Kit, detailing an I2C protocol for the sensor. I had heard of I2C before and knew that it was one of the standard ways one would chain multiple devices on two lines, the clock and data, SCL and SDA respectively.

Because I had no idea how to work with, or indeed wire up, I2C connections, I read up on the I2C protocol, and learned that one had to use pull-up resistors on the SCL and SDA lines. I also looked at the documentation Arduino had on it and found that Arduino's come with SCL and SDA lines, not requiring a digital or analog output, and a really handy library with which to communicate to devices on the lines. There was no need to learn about changing the clock speed or stuff like that.