<< return to Pixycam.com

User Tools

Site Tools


wiki:v2:can_i_use_my_lego_pixy_with_arduino

Can I use my LEGO Pixy2 with Arduino?

You can! You just need to use the “general” version of the firmware, and you need to make (or somehow obtain) a Pixy2 Arduino cable.

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 Pixy2 with LEGO (see Switching back to LEGO below.)

Making an Arduino cable

You need two connectors:

6-pin (Arduino side, for ICSP connector)
http://www.digikey.com/product-detail/en/71600-006LF/609-2841-ND/1302571

10-pin (Pixy2 side, for I/O connector)
http://www.digikey.com/product-detail/en/101-106/ED10500-ND/2794212

and some ribbon cable:

Ribbon Cable - 10 wire (15ft)
https://www.sparkfun.com/products/10647

Ribbon Cable - 10 wire (100ft)
http://www.digikey.com/product-detail/en/cnc-tech/304-28-10-MC-0100F/CN223MC-100-ND/5864952

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 Pixy2 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.

https://youtu.be/sMiRoXY_oZg

Here are some pics that show what our Arduino cable looks like on both ends:

3906926e918e39ebb99a516f782229ed46f95182.jpg
5c7d9dae86b5eda59aecd8a7888021fb125d3777.jpg

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 Pixy2 talking to your Arduino.

Switching back to LEGO

If you want to switch back to using Pixy2 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 Pixy2 LEGO cable.

To switch back to Arduino, just set the Data out port back to Arduino ICSP SPI.

wiki/v2/can_i_use_my_lego_pixy_with_arduino.txt · Last modified: 2019/02/15 22:11 by jfrench