<< return to Pixycam.com

Pixymon Block Image is NOT Centered in the Display.

I am running the PanTilt sketch provided in the Pixy library on an Arduino Mega. The Pan portion controls a rotating base. Attached to the base is a one foot arm. At the end of the arm I have attached the Pixy camera and a servo to perform the Tilt function. Both the Pan and Tilt work fine. They track the object perfectly. Except…when the object is found and the Pan and Tilt function stop…the Pan portion of the camera is slightly LEFT of the object. The Pixymon viewer seems to have centered the object top to bottom but not left to right. I have tried the following code modification:

  1. I have changed the following statements to:
    panError= X_CENTER - pixy.blocks[0].x;
    tiltError= Y_CENTER - pixy.blocks[0].y; //I know this is reversed.

  2. My setpoint of the screen is (159,99) so I did the following:
    panError = (X_CENTER - pixy.blocks[0].x) + 30;
    tiltError = (Y_CENTER - pixy.blocks[0].y) + 24;

This seemed to help but still does not center the block in the Pixymon viewer.

Does anyone have any ideas on how to fix this or is this a normal bias in the camera since the Pan and Tilt are offset by 12 inches?? Thx, Scott

Hello Scott,
Your approach seems reasonable. You can adjust the apparent center in this way by adding or subtracting a fixed offset until you like how it’s centered.

The lens mount can sometimes introduce a few pixels offset. Does the lens on your Pixy feel loose?

Edward

Hello Edward…

The adjustable lens is very slightly loose/flexible. Is there anything you can suggest to secure the lens?

thx, Scott

Hello Scott,
There is a small lens screw that came in the fastener bag with your Pixy. It’s small and black. You can use it to secure the lens This is the idea:

Although your Pixy’s lens holder and fastener might look different. You insert the fastener into the hole and tighten it such that the lens cannot move or rotate.

Edward