No announcement yet.

Using Pixy2 camera for object detection

  • Filter
  • Time
  • Show
Clear All
new posts

  • Using Pixy2 camera for object detection

    So, my team's season is over, but we still continue to meet and develop new ideas/concepts for future games. One of these is incorporating the use of a Pixy 2 camera instead of using the phone's camera. The programmers have successfully used the phone's camera for detection (this year and last), but the footprint and placement of a large phone always becomes an issue or concern - enter the Pixy 2. We have done a great deal of research on how to setup the Pixy 2 and have gotten as far as it tracking an object, but this was all done outside of the frame of a legal FTC robot. I am at a loss as to how to wire and program the Pixy 2 in FTC. I am not an engineer of any type, just a teacher with a passion for learning and sharing information. So here are my questions:

    1. How do we actually wire the Pixy 2 to our Rev hub?
    2. How do we use the outputs of the Pixy 2 in our code? (we are using AS)
    3. Can we develop our own pan/tilt system and use the connections on the Pixy 2 to drive the servos?
    4. Would this be legal?

    My goal is to be able to share this information with the other teams in our league, but none of us are engineers, so the descriptions would need to be simple to understand and follow. Also, please keep in mind that we cannot connect to Reddit or GitHub from our programming laptops due to the school's network limitations. Thank you in advance for any guidance or help!

    Good luck to the those teams competing at Worlds!

  • #2
    We recently added a webcam. We originally went with one Logitech model (400 range, I think). We were unable to get it to communicate with the phone.! We went wit a Logitech C920s and it worked very well right off the bat.

    Basically, the phone plugs into a USB hub. It is legal, for this year at least to use a powered USB hub. However, on discussions about powering a USB hub through the Rev hub, a great big warning came up. It requires a custom made wire combining a couple of the standard wires. If the splice is done incorrectly, major damage to the electronics could be caused. We went with an external battery pack, also specifically legal. However, we found that it works just fine without the power.

    The USB port plugs into the phone. The rev hub and webcam both plug into the USB hub. I'm sure there is some configuration required, but our programmer was pleased with how easy this one worked.


    • #3
      My team has never actually wired the Pixy2 to the REV hub, but we did a lot of research on how to accomplish this. From our research it sounds like the most stable method is to get a 10-pin ribbon cable, like this one,, cut off the unneeded wires and solder the rest to an encoder wire, which gets plugged into a level shifter which connects to the wire which plugs into the I2c rev port.

      We never actually got the Pixy2 connected, so I can't give you much advice on programming with it. You will want to use the Lego I2c protocol for communicating with it. I believe that someone wrote some code to communicate with the Pixy2, but I can't remember who or where. Searching Google might give some clues though. I will see if I can dig up some links with some other useful information on wiring or programming the Pixy2.


      • #4
        Thanks for the information. We managed to get it wired, but are unsure of how to retrieve data from the camera to be used in AS. I suppose for now, we will abandon the Pixy2 idea and revert back to the phone for vision tasks. Perhaps we will revisit this over the summer and also include the web cam concept as well just so we have options.