Can I use my LEGO Pixy with Arduino?¶
You can! You just need to use the "general" version of the firmware, and you need to get an Arduino cable. We hope to have these available for sale separately soon, but in the meantime you can make one.
Changing the firmware¶
You need to download the latest "general" firmware here (it's the version that isn't the LEGO version) and follow the firmware upload instructions here. Don't worry -- it's pretty easy. And you'll still be able to use your Pixy with LEGO (see Switching back to LEGO below.)
Making an Arduino cable¶
You need two connectors:
6-pin (Arduino side, for ICSP connector)
10-pin (Pixy side, for I/O connector)
and some ribbon cable:
Ribbon Cable - 10 wire (15ft)
Ribbon Cable - 10 wire (100ft)
The connectors can be purchased through other electronics suppliers (Mouser, Element14, etc.) Pretty much any 6 and 10-pin IDC crimp, 0.1" spacing connector will work, but the polarized versions of these connectors are good, particularly for the 10-pin connector, to make sure you plug into your Pixy with the correct polarity. The cable crimps easily, no tools necessary, and you can make the cable the length you want. Although, the longer the more likelihood for noise, but 2 ft or less should be fine. You just want to make sure that you crimp with pin 1 going to the red wire on both ends. The only (somewhat) confusing thing is that one connector is 10 pins and the other is 6 pins. When crimping to the 10-pin connector, just make sure you shift the cable over such that pin 1 (red) lines up with the pin 1 of the connector (indicated with the triangle). So you'll have 4 "uncrimped" pins on the 10-pin connector, but pin 1 is still pin 1... It's pretty straightforward, really.
This video provides some more details on crimping your own cables (ignore the fact that it's for Raspberry Pi.) Also, since you are only crimping 6 and 10-pin connectors, you probably won't need a vice. Just use a hard flat object to press against the backing of the connector to get it seated completely.
Here are some pics that show what our Arduino cable looks like on both ends:
Testing it out¶
The general firmware uses the Arduino ICSP SPI communication mode by default, which is what you want, so there should be no need to adjust the interface mode. Just follow the instructions here regarding how to get your Pixy talking to your Arduino.
Switching back to LEGO¶
If you want to switch back to using Pixy with LEGO Mindstorms, you do not need to change back to the LEGO firmware (yay!) You just need to set the Data out port to LEGO I2C in the Interface Tab in PixyMon. Note - this tab is only available if you are running the stock (non-LEGO) firmware on your Pixy.
And, of course, switch back to using the LEGO cable.
To switch back to Arduino, just set the Data out port back to Arduino ICSP SPI.