Pixy2 connection to photon

Hello,

I’m trying to connect pixy2 to patricle photon but I had no luck in connecting them together, if anyone managed to connect them please share your discovery.

Thanks

What have you tried?
How do you want to talk to the Pixy2 (UART, SPI, …)?

I only have a Pixy (1) without issue.

hello,
I tried this tutorial, it didn’t work because i have pixy2

then I tried copy/pasting the arduino libraries from pixy2 website to particle ide but it didn’t work
https://pixycam.com/downloads-pixy2/

I want to connect it to get information to the particle cloud, I’m kinda new to this :slight_smile:

The Pixy2 library needs some minor changes.
Try this version

I can’t test it without the hardware.

1 Like

it worked :smiley:

Thanks for your help (Y)

@ScruffR I am not able to access the library, could you please update the link?

Secondly could you please specify what those minor changes are? I am trying to hook pixy2 with Particle Argon

Sorry, I have since removed the project from my repository, maybe @hasanals still got it, but IIRC the changes were really trivial.

I do have a private Pixy2 library on Web IDE but I’d have to check whether this builds as is and then I can make it public but would need someone to test if it actually works as I still haven’t got the Pixy2 hardware to test it myself.

Or you try this library
https://build.particle.io/libs/Camera_Pixy2/1.0.3

@ScruffR Thanks for the quick response. I tried this library earlier however, it adds #include <Camera_Pixy2.h> , which on compiling gives the error: pixy2test.ino:2:26: Camera_Pixy2.h: No such file or directory

Any way around this? I mean i can try to add each of the header files manually, but whats causing this issue?

I can have a look at this some time later.

Thanks @ScruffR

@hasanals Would you be able to share the library?

Can you give this a try?

At the moment the buzzer won’t work since the original implementation is using AVR specific code that I just wasn’t ready to port especially since mesh devices currently don’t expose enough free timers to do the background playing.

Hey @ScruffR,

First of all thank you again for your quick response. I am gonna try this now, however, i was going through the files, and realized Pixy2.h and Pixy2SPI_SS.h are very similar to each, where in the latter file we are explicitly declaring the SS pin? Which of these two would you recommend on using?

Secondly, i was looking at the Pinout for the Argon, and it specifies pin A5 is the SPI_SS. However, looking at the reference document it states the following

Where, the parameter ss is the SPI device slave-select pin to initialize. If no pin is specified, the default pin is SS (A2)

In the case of this library, which of the two pins needs to be used for SS?

Just wanted to update on this, i was able to make it work, ended up using Pixy2SPI_SS.h, and A5 as the SS pin.

With that said, a side question, is it possible to open the Serial Terminal on the Web IDE? Or in the case of Particle Argon, its only possible via VS code?

Since you currently have the sources at hand, you can hardcode any free pin you want. Once you can confirm that the library actually works I can incorporate these changes (including selection of an alternative SPI interface like SPI1) and hopefully reenable buzzer control.

Web IDE unfortunately doesn’t feature a built-in serial terminal but you can use any serial terminal program you like. Doesn’t have to be VS Code.

Hey @ScruffR do you want me to send the files that i modified here?

If you have modified them in a way that allows future users to select the pins freely without need to go into the library you can post the code here or better create a PR on my GitHub repo.

Hi @ScruffR. I hope all is well. I’m starting a Pixy/Photon project and looks like your libraries are not available anymore (link doesn’t work). I found a Pixy2 library but it seems to have issues with references to
lib/Camera_Pixy2/ZumoBuzzer.cpp:5:27: avr/interrupt.h: No such file or directory

Can you point me in the right direction for the proper libraries and examples please?

Thanks!

The post from that post should still work

Thanks. I pulled down the libraries from Github. I’ve never used the desktop IDE but will give it a shot.

Hi @ScruffR - So I figured out how to copy over the libraries into the Cloud IDE and looks like everything is working fine.

The code blow outputs the Signature blocks info to the Serial monitor. Can you help me figure out how to get it to send the info in the array to Particle.Publish?

// If there are detect blocks, print them!
  if (pixy.ccc.numBlocks)
  {
    Serial.print("Detected ");
    Serial.println(pixy.ccc.numBlocks);
    for (i=0; i<pixy.ccc.numBlocks; i++)
    {
      Serial.print("  block ");
      Serial.print(i);
      Serial.print(": ");
      pixy.ccc.blocks[i].print();
      String blockvalue = String(i);

I added this but all I get is the Block number but not any of the data in the array.

      String blockvalue = String(i);
      String data = String::format("{\"Block Data\": \""+blockvalue+"\"");
      Particle.publish("MachineVisionDemo", data, PRIVATE);

I’d like to get all of the data in the array like it shows in the Serial monitor…

Detected 2
block 0: sig: 3 x: 179 y: 47 width: 182 height: 95 index: 77 age: 255
block 1: sig: 3 x: 255 y: 124 width: 30 height: 11 index: 15 age: 255
Detected 3
block 0: sig: 3 x: 175 y: 46 width: 190 height: 92 index: 77 age: 255
block 1: sig: 3 x: 249 y: 126 width: 42 height: 19 index: 15 age: 255
block 2: sig: 3 x: 47 y: 6 width: 26 height: 2 index: 98 age: 0
Detected 3
block 0: sig: 3 x: 204 y: 48 width: 132 height: 97 index: 77 age: 255
block 1: sig: 3 x: 259 y: 120 width: 22 height: 15 index: 15 age: 255
block 2: sig: 3 x: 71 y: 31 width: 26 height: 3 index: 98 age: 1