<< return to Pixycam.com

Use of I2C to set brightness parameter ANd a little clarification on block readback on I2C

Hello,
In order to reliably read color codes such as 121 for colors 1,2,1 in a row I have found the setting of the ‘brightness’ parameter using PixyMon to be required so I can read the color sequence close in with brightness 30 and farther away using brightness 60. This is a common issue with other persons I know using Pixy so to fix the issue I could look for objects using 3 brightness levels and thus see things close all the way to far away. This is a key and critical requirement in my case.

I cannot find if setting type parameters can be set using I2C or not. I am a very experienced I2C user using many devices already on my robots by the way. I do need some sort of spec or maybe a hidden wiki page or something to move forward.

So can parameters be set and then the objects found from that point on use that new brightness value?

I also would be very interested if saturation and some other things could be set too but brightness is the key value I need very badly.

Lastly I have been using Pixy over USB using a complex shared memory scheme but am going to abandon that so am now converting to I2C as that is far more natural for my ROS OS based robotics needs I think.
In your discussions of how to get the blocks using I2C it is never stated but I am thinking that as a Master I address the Pixy using it’s address (default is 0x54 I think it was) and then I do readback and I get the 16-bit words of course in bytes. But do I have to WRITE to something first in the Pixy like an address or anything?

If I am to write config parameters, maybe I have to use an internal secondary address for that (gosh I hope this is possible).

Thank You,
Mark Johnston

Hi Mark,

Unfortunately we do not support setting configurations over I2C. You can do this over USB with “libpixyusb”:https://github.com/charmedlabs/pixy/tree/master/src/host/libpixyusb, however. This feature has been requested a few times by other users, so I’d imagine it’ll be added in the future.

As for using I2C, I’d suggest looking at the “I2C Arduino library”:https://github.com/charmedlabs/pixy/blob/master/src/host/arduino/libraries/Pixy/PixyI2C.h to have a reference to work off of.

Good luck.

Scott

Since my post I have pixy cc objects being read back over I2C using this asynchronous model where one of my calls used my own I2C lib to read then a function to search for cc object blocks in another call and all this is working fine now under ROS (Robot Operating System) on Raspberry Pi B running Raspian (a form of Debian linux)

sorry for my editing of this for those who get emails of these posts … This is post edit 3

I decided to look at the SSP low level reception code just now and that is very nicely commented so it varies as can happen. I am looking at a very recently mentioned gcc close to working repository in a recent post.

I do have SSP on my CPU so I would be fine with use of SSP to talk to Pixy but can ‘brightness’ be set over SSP?
It would be difficult for me to use the rs-232 style serial port as I need that for other things but SSP I could use.

I know the make of the firmware using gcc is semi-close to being figured out and I am very interested in that effort should I have to bungle my way to try and add the setting of brightness myself over I2C or even SSP maybe.

I have hope as I had seen reference to some sort of I2C command input (maybe SSP?) for maybe only the setting of the servo it was called where 0xff00 is sent or something like that as the ‘binary mnumonic’ if you will and is followed by values. Maybe that was SSP and not I2C? If not on SSP either I think I may have to first find the place where some inbound I2C gets detected to be for the setting of servo. I found the low level raw SSP inbound code and that is commented well.

I feel that If I could find that place and work from there I may be able to get my own input for changing of brightness by looking how USB changing of config happens and maybe tap into that once I have set the new brightness. I’ll keep looking.

Any ‘bone you could throw’ to point me to where that servo packet that I think started with 0x00ff or maybe 0xff00 would be in terms of I2C reception (or SSP) would nicely kickstart my efforts.

As a side-note on interactions with PixyMon running and I have no problem with this, just mention for others to know:
I did have much confusion over use of PixyMon from PC seemed to erase my cc signatures and I2C does not respond when PixyMon is active. These things now that I know them are ok as my goal is to run Pixy only over I2C but to do this the need for setting of brightness would help greatly else I have to make my hardware change light intensity but that will be very annoying looking with flickering light levels so that is why I want to change the brightness level totally in Pixy. I feel quite a few of your I2C and serial users will hit this at some point as pixy is highly picky on repeatable light for detection.

Thank You,
Mark Johnston