<< return to Pixycam.com

Interfacing Pixy to Lego NXT

I want to connect the Pixy to a Lego NXT brick via I2C and I have a few questions.

The “Hooking up Pixy to a Microcontroller like an Arduino”:http://www.cmucam.org/projects/cmucam5/wiki/Hooking_up_Pixy_to_a_Microcontroller_like_an_Arduino wiki page indicates that the SDA and SCL lines from the Pixy have 4.7k pullup resistors (R14 and R15) to the 5V line. “Pixy’s schematic”:http://cmucam.org/documents/26 however shows these as 1k resistors. The “1.3 BOM spreadsheet”:http://cmucam.org/documents/32 also lists R14 and R15 as 1k resistors but the URL to Digikey is for 4.7k parts. I cannot read the resistor values from the Pixy. Could you please clarify what they are?

The NXT outputs 4 to 4.3 volts for sensors and recommends pulling the SDA and SCL lines up with 82k resistors (though I have read recommendations for 43k resistors if the device the NXT is communicating with only uses 3.3V power supply). With the Pixy already pulling the SDA and SCL lines up to 5V with much smaller resistors than recommended for the NXT, the NXT will have to draw a lot more current to bring the I2C lines low. Would you have any recommendations on how to interface the NXT to the Pixy?

Thanks for your help.

Regards
Dan

hmmm, sorry about the resistor confusion-- they are actually 10k each (R14, R15). (the schematic values are correct otherwise!)

NXT support would be great! I remember looking at it a while back. I wasn’t sure what language was the “de-facto” language for implementing a Pixy API. I’m interested in anyone’s thoughts!

thanks!

Thanks for the update Rich.

I am looking to use java on the NXT with the “leJOS”:http://www.lejos.org/ firmware. leJOS has an I2CSensor class to read from generic I2C capable sensors. Eventually I’d like to make a Pixy specific sensor class.

I have also the project to use my pixy with a NXT Lego Mindstorms. I want to use an Arduino in order interface NXT with the pixy because:

  • The 10k resistors seem not be compatible with NXT and I don’t want to unsolder them (47K recommended for NXT)
  • The serial protocol require to always pooling the pixy and i2C of NXT is not very fast, I doubt that NXT can read more than 2 or 3 objects per frames

I choose to use an Arduino between pixy an NXT because:

  • Pixy was powered by arduino (less wires in the robot :slight_smile: )
  • Pixy API existing for arduino and examples of communication between NXT and Arduino existing
  • Arduino will organize data for the NXT, I want to create a protocol where NXT can tell by a register for exemple the bigger object of signature “n”

I’ve planned to do this for september, I’m not a great programmer but I can publish my source code if people are interested.

Hi Detriche,

I plan to interface the NXT to the Pixy using an I2C buffer (NXP’s P82B96).

You are right about the Lego’s NXT firmware I2C being very slow. It runs at only 9600 b/s which at best equates to about 75 objects/s (2 bytes request + 14 bytes response per object).

With leJOS, you can push the I2C bus to about 125 kb/s which should give about 976 objects/s. Still well below the theoretical 6000+ objects/s that the SPI interface can support, but it’s good enough.

Let us know how you go with interfacing the NXT to the Arduino. It sounds like a good approach.

Regards
Dan

Just some thoughts—

Desoldering the resistors is fairly easy. You can heat up one pad with a soldering iron and wait for the resistor to heat up. It will eventually heat up the other pad and the resistor will come off.

If we can get it working without having to put an Arduino in the middle, or a buffer, that would be a big advantage. We’ll possibly remove the resistors in future builds (and/or replace them with NXT compatible values).

The low data rate isn’t much of an issue. Most people just want to track a few objects. The thousands of objects/sec throughput pixy is capable of is overkill!

thanks!

I use RobotC and i2c speeds are the same than LeJos. Thanks for the calculation at 125Kbps, 20objs/s is enough for most applications. Your idea of I2C buffer is great, probably better than my Arduino :wink: The only benefit of the arduino is to discharge the I2C line if there is other sensor in the same line. I will continue with my idea but now I consider trying with an I2C buffer in order to reduce the complexity of the system.

I’m a little afraid by desoldering resistances, I fear to burn an other component like the CPU by heat conductivity with my very bad and used soldering iron.

I know this thread is a bit old, but I’m wondering if anyone got it to work with leJOS and would be willing to share his code.