<< return to Pixycam.com

Pixy I2C Interface Beagle Bone

Hello

I’m trying to interact with my pixy cam which is trained to detect red objects over the i2c bus of the Beagle Bone Black. For this purpose, I’m using the smbus package and everything looks fine according to my logic analyzer.

Right now I am dealing with two major Problems.

  1. The servo motor on the pixy doesn’t react to every pan and tilt position I’m sending to the Pixy. According to the wiki I just have to send an 6 byte word which contains an sync word and the pan and tilt positions like this

0xff00 00 00 00 00 for setting both positions to zero

0xff00 03 E8 03 E8 for setting both positions to 10000

But he’s ignoring most of the positions I am sending to him and remains in the previous positions.

  1. According the wiki my pixy will output its detected values in its own “Object block format” which starts which a Sync Word starting with 0xaa55 for a normal object or 0xaa56 for a Color object. But the bytes I receive if the Master asks for bytes from the slave doesn’t start with the sync Byte. The Sync Byte appears after an random number of Bytes followed by the Data.

kevin meier wrote:

  1. The servo motor on the pixy doesn’t react to every pan and tilt position I’m sending to the Pixy. According to the wiki I just have to send an 6 byte word which contains an sync word and the pan and tilt positions like this

Note that Pixy will only process one servo move command per frame. A frame takes 20 milliseconds, so if you constantly sending servo commands, most of the commands will be ignored. This might explain what you are seeing. If you aren’t waiting for frame data between servo moves, try sleeping for 20 milliseconds.

  1. According the wiki my pixy will output its detected values in its own “Object block format” which starts which a Sync Word starting with 0xaa55 for a normal object or 0xaa56 for a Color object. But the bytes I receive if the Master asks for bytes from the slave doesn’t start with the sync Byte. The Sync Byte appears after an random number of Bytes followed by the Data.

In general, you are correct. You should expect to see the sync word first. What does the data after the sync word look like though? Does it look like valid block data? Let me know what you find.

Edward

Thanks for your answer

In general, you are correct. You should expect to see the sync word first. What does the data after the sync word look like though? Does it look like valid block data? Let me know what you find.

I receive something like this after the master requests Data from the slave by writing 0xE8 (the Pixy I2c Adress) and one 0x00 Byte.

0x0B 0x19 0x00 0x00 0x55 0xAA 0x55 0xAA followed by the valid block data.

Note that Pixy will only process one servo move command per frame. A frame takes 20 milliseconds, so if you constantly sending servo commands, most of the commands will be ignored. This might explain what you are seeing. If you aren’t waiting for frame data between servo moves, try sleeping for 20 milliseconds.

This is not the Problem there is a Delay of 100ms between two writing processes.

Hello Kevin,
Let’s get the data received from Pixy over i2c working first before we tackle any problems you are having with servo commands. So try this: do not write anything to the i2c port and look at what Pixy sends. You should receive sync words followed by valid block data. If you do not, there is something wrong with the framing of the data.

As a side note, have you considered using USB to talk to Pixy using your Beaglebone?

Edward

Let’s get the data received from Pixy over i2c working first before we tackle any problems you are having with servo commands. So try this: do not write anything to the i2c port and look at what Pixy sends. You should receive sync words followed by valid block data. If you do not, there is something wrong with the framing of the data.

The master has to write the adress of the pixy to the bus to recieve the output Data. Even if I tell the pixy just to detect one object per Frame he stops starting with the sync word after a few seconds if I always request 16 Bytes every 100 ms.

I will try to use the USB Lib.

Hi Kevin,
Sorry for the troubles. Sometimes getting communications working from scratch like you are doing can be challenging. Agreed about the addressing, you will need to use the correct address, but you i2c controller should deal with this. Note that if you are always asking for 16 bytes, you may not always get 16 bytes under all circumstances. You should try requesting smaller data chunks.

Edward

Hi Kevin,
Sorry for the troubles. Sometimes getting communications working from scratch like you are doing can be challenging. Agreed about the addressing, you will need to use the correct address, but you i2c controller should deal with this. Note that if you are always asking for 16 bytes, you may not always get 16 bytes under all circumstances. You should try requesting smaller data chunks.

Edward