<< return to Pixycam.com

Get x & y coordinates of object

I just buy a Pixy CMUcam5 and learnt how to recognise object and then follow it, through PixyMon software.
I want to know that how do I get x & y axis coordinate of recognised object.

Hello Fahad,
Do you have an Arduino? Probably the easiest way to talk to Pixy when you are first getting started is to run the hello_world example. There is more information here:

http://cmucam.org/projects/cmucam5/wiki/Hooking_up_Pixy_to_a_Microcontroller_(like_an_Arduino)

If you’re not using an Arduino, let us know what platform you are using, so we can offer the best option for you.

Edward

I will use Arduino later, currently I want to get recognised image information through serial communication on my laptop (Windows 7).
Can you please guide on how do I do that.
Thank You
Fahad

Hello Fahad,
Talking to Pixy through a serial port on your laptop is going to be difficult because the serial (COM port) uses +/- 5V signalling, which Pixy doesn’t use. Pixy uses 0-3.3V signalling.

Do you want to just test things?

Edward

Hello Edward,
I also want to achieve transportation through a serial port.
There are two problems: 1.Since I already have PixyMon, can I directly save the position data into a txt folder? 2.If I use some circuit to change the signal voltage, can i achieve this and how?
Thank you so much!

David

Hello David,
PixyMon doesn’t save the position data currently, but you could modify PixyMon to do so (as an option.)

You could use a level converter, something like this:

Edward

Hello Edward,

I am currently using an arduino uno and I wish to get the x-coordinate of line (for line following robot). What code should I use?

At the moment, I have saved an object using the pixyMon and then using the hello-world code, I have tried to extract the x coordinate by stating: pixy.blocks[1].x

However, the hello-world code when run, it is unable to identify my object and pixy.Getblocks() is always zero.

Please help

Thanks,
Anand

Hello Anand,
If you are running PixyMon, while Pixy is hooked up to your Arduino, make sure that you are in default (click on the Home icon).

There is more information in the link below. Look at #4:

http://cmucam.org/projects/cmucam5/wiki/My_Arduino_isn’t_receiving_data_from_Pixy

Edward

Hello Anand,
If you are running PixyMon, while Pixy is hooked up to your Arduino, make sure that you are in default (click on the Home icon).

There is more information in the link below. Look at #4:

http://cmucam.org/projects/cmucam5/wiki/My_Arduino_isn’t_receiving_data_from_Pixy

Edward

Dear Edward,

I am afraid even after closing the pixymon tab and only running the arduino and pixy, I am still unable to obtain the x or y coordinate. Also, I am unable to print the width of the block through the arduino. The code I used:

Serial.println(pixy.blocks[1].x);
Serial.println(pixy.blocks[1].y);
Serial.println(pixy.blocks[1].width);
Serial.println(pixy.blocks[1].height);

None seem to work.

Please help

Anand

1 Like

Hello Anand,
It’s probably best to use the hello_world Arduino program unmodified until you get things working. You might download the arduino library again to make sure you are using an unmodified/working version.

Did you go though all of the steps in this debugging guide?

http://cmucam.org/projects/cmucam5/wiki/My_Arduino_isn’t_receiving_data_from_Pixy

What model Arduino are you using?

Edward