So right now our team is trying to figure out if its possible to wire a Pixy camera to a RoboRio by going through a RIOduino instead of a arduino that way it could be simply plugged into the RoboRio. However we are having trouble in finding a way, if its possible/worth it. I just wanted to ask if anybody has any advice in doing this.
The RIOduino is pretty much an arduino with an MXP header if I recall correctly. Its default behavior is probably to be an i2c slave, which might cause trouble trying to read another device.
You could also hook it directly to the RIO’s i2c, SPI, or USB ports. The downside to this is having to write your own driver code, but you can probably find some code another team has written for this.
I haven’t used the RIOduino before but it does appear to be an Arduino with an MXP header, they even advertise it as such.
Communicating with the Pixy via the SPI interface should work using pretty much just Pixy SPI Arduino example code. It should not interfere with I2C/UART comms with the RoboRIO.
I’ve used the RIODuino before, for controlling LEDs. UART/Serial should work just fine. Not sure about anything else, as I haven’t used those.
For vision this past year we used a regular arduino and a pixy. Pixy into arduino over SPI (ICSP) and then UART to the roboRIO. We actually started out using digital IO, a pin for left, one for right, and one for straight for peg alignment. While it was very primitive, even that worked well enough. UART was more flexible. We just sent over error values (in + pixels for right or - pixels for left) and the Rio pretty much did all of the logic from there with PID.
As far as rioduino, I suspect you can do a similar thing if you are able.to configure the connection to the roboRIO to he over serial. If it’s set up as an I2C slave and can’t be changed, maybe try using UART for the pixy. Check the documentation, as off the top of my head it is possible to connect the pixy to the arduino over UART.
We’ve used the Pixy for 2 seasons now and connected it directly to the RoboRIO both times. In Stronghold we used 1 Pixy and the analog/digital X interface. Last season we used 2 of the Pixy sensors (one gear, one boiler) with both on a single I2C interface to the RoboRIO.
I’m not sure what an intermediate microcontroller does for you.
We also used two Pixys through I2C this past season. The diagrams below show how we wired it.
Here is a link to our GitHub account if you want to see the code used: https://github.com/FRC-Team1746/Steamworks-v1.0
I can point our programming team in this direction if you have any other questions.
As Ken indicated Team 230 used the Pixy the last 2 years without any intervening arduino or other controller. Our C++ code* that facilitated the I2C interface we used last year (2017) can be found here: FRC-team230-2017 / SVN / [r89]
(*Note that this code was based on code posted on CD last year by Team 599).
Our C++ code we used to interface to the analog\digital interface in 2016 is here: FRC-team230-2016 / Code / [r123]
Feel free to contact me if you have any questions.
I am curious here. I bought a Pixy cam to put on a Lego Mindstorm a while back for “coolness” effect for recruiting purpose. I did not realize that it would work well in a FRC context. I could change the firmware load to use it with standards micro-controllers. Is there a color of lighting that provides a better Hue than others? I way get the team to experiment this fall. This would save us the raspberry pi additional hardware.