<< return to Pixycam.com

Control Pixy2 with Arduino (API)

Hi,
in advance thank you for the Pixy2-development!
I want to control the Pixy2 via an Arduino and would like to do the following directly (in stead of through PixyMon).

  • set/ learn a signature (at a specific signature value/ spot ie 1, even if it replaces a signature)
  • set/ learn a colorcode (also at a specific value/spot ie 6)
  • control white balace
    Which commands do I need for these?

In addition, I read that the init() command has an optional argument. Do you have any documentation about it?
Thnx, Sydney

Hello Sydney,

  • set/ learn a signature (at a specific signature value/ spot ie 1, even if it replaces a signature)
  • set/ learn a colorcode (also at a specific value/spot ie 6)
  • control white balace
    Which commands do I need for these?

These commands are not supported through the serial interfaces (sorry). Setting signatures usually requires the user to apply their expertise to get a good “lock” on the object, which is why we haven’t added a “set signature” command.

Can you describe what you are trying to do? – perhaps we can help think of a solution.

Controlling white balance is interesting – what do you want to control? The red and blue gains directly? or the white balance mode?

The optional arg to init can be used to set the i2c address if you’re using i2c. I don’t think it currently has any other use.

Edward

Hello Edward,

thanks for your reply. I am trying to wash my solar panels, but the robot cannot go ‘over the edge’. I have noticed that sun/ shade/ clouds etc interfere with the detection. (Camera brightness has an impact on the hue, unfortunately.) So I would like the robot to overwrite one signature before it starts, setting the current signature of the solar panel (I know the starting position.) If that does not work, I want to use color coded markers, but again I need to be sure I can detect them during the washing process.
I am not sure what the white balance can do for me, but I am trying to get a (default/ start) state in which I eliminate the environmental (especially the light) changes.
Thanks, Sydney

Hello Sydney,
Wow, that’s a pretty cool application! Sunlight can be challenging because it can be harsh and create a wide range of brightness depending upon the angle it’s hitting an object. Are you using markers for localization of the robot? What do the markers look like?

Edward

Hi Edward,

you already helped me here : How pixy's color tracking removes the effects of lighting changes

The saturation of a channel is a good indication for the amount of sunlight. I ‘only’ need to detect the edge. I also know the time of washing (in the early morning, to prevent too harsh light). I will use the getRGB() and setBrightness() to determine the exact starting time. I will depend it on the amount of light. This way I do not need to overwrite the signature, but can set it once manually. Well at least I am going to test it this way first. If it is not possible I might start using markers. I was thinking of using Lego-blocks.

For future projects it could be handy if a setSignature() function would be available.

Another question, off-topic, do you have a ‘fish-eye’ lens for the Pixy2? It would be helpful if you have 120° lens.

Anyway, thanks for your help!
Sydney

1 Like

Hi Sydney,
I’ll add your request to our list of proposed features.

The Pixy2 lens is fixed and unreplaceable (sorry).

Edward