<< return to Pixycam.com

Pixy compatibility with arduino due

Hello everybody,

I got pixy working with the arduino uno. But I would like to use the arduino due with pixy because it is much faster (84Mhz) and has two true analogue outputs which is very interesting to put out the X- and Y-position.

The current libraries only works with arduino uno. With the arduino due following problemm occurs:

C:\Users\Cyberdyne\Documents\Arduino\libraries\Pixy/Pixy.h: In member function ‘void LinkSPI::init(uint8_t)’:
C:\Users\Cyberdyne\Documents\Arduino\libraries\Pixy/Pixy.h:39: error: ‘class SPIClass’ has no member named ‘setClockDivider16’

It is clear a small has to be made but I don’t know what. Can anybody help me?

And if anybody would be interested, below you can find a link to a forum where you can find a program to do this with an arduino uno:

http://www.cmucam.org/boards/9/topics/3321

Thanks in advance,
Bart

Hi Bart,

Thanks for pointing this out. I’m looking to purchase a Due soon to resolve this issue. In the meantime, if you have any luck please let us know.

Thanks!

Scott

Hello Scott,

Great to here this. I have been searching for a solution. The problem is that setClockDivider() works differently with the arduino due. You can find information here:

http://arduino.cc/en/Reference/SPISetClockDivider

and

http://arduino.cc/en/Reference/DueExtendedSPI

I was able to change Pixy.h so that it will upload to the arduino due but when I pull up the serial monitor there is nothing to see. So obviously my attempt wasn’t succesfull. My arduino-knowledge doens’t go so far. But since you probably wrote Pixy.h for the arduino uno I assume it will be a walk in the park for you. Looking forward for the solution.

Thanks for the quick answer and keep up the good work,
Bart

Hi Bart,

This is great, thanks! I’m still waiting to get my Due. Sorry for the delay. We hope to get this resolved soon.

We’ll keep you updated.

Scott

Hello Scott,

Thanks for the info. Looking forward to the update.

Greetings,
Bart

Hi, guys, new to all this and i am also stuck with pairing Pixy and my Due board. Any hep will be much appreciated

Hello Michael,

I think the only thing you can do is wait untill Scott Robinson has adapted the pixy.h for the arduino due. The current pixy.h file also works with the arduino mega. So if the lower speed is not the problem you should be able to do everything with the arduino mega. And if you want analogue outputs you can turn a PWM-output to an analogue voltage using an RC-filter. See also this forum for the RC-filter:

http://www.cmucam.org/boards/9/topics/3321

Greetings,
Bart

Thanks for writing back Bart. I am trying the I2C connection with the I2C example and it compiles alright but my serial montor is always blank and i cannot confirm whether the board is receiving any data from the pixy.

Hi Michael,

I just got my Arduino Due in yesterday and I’ve started investigating the problem. Although I haven’t fixed it yet, I’ve found out that something about the SPI.begin() function causes Serial not to work when using the Pixy library. So, your Due is likely receiving data from Pixy, but you just can’t get feedback because Serial is blocked due to a bug in our Pixy Arduino code.

Anyway, I’ll report back once I get this fixed. Thanks for your patience!

Scott

Thanks a lot Scott. I suspected so. I have been trying loads of options (with my very very limited knowledge of programming or what is actually going on). I tried the Uart and I2C examples all with no success of getting data from the pixy. In Uart, the arduino TX and RX led’s do not even blink. I will be trying today with a Mega justto be sure i have not damaged my Pixy I/O (if that is even possible). Will keep trying.

Hello Michael,

I already tried the arduino MEGA ADK and it works. So I assume the arduino MEGA 2560 also works (same chipset). For the arduino due, I also tried all the possibilities but nothing works. And my arduino knowledge is also insufficient :slight_smile: . But I am sure Scott wil be able to get it going. Go Scott go!!! :slight_smile:

Greetings,
Bart

Thanks Bart. Indeed the Mega 2560 worked just well. So i guess it’s down to the Due not being compatible with the current library or the IDE (probably because it is in beta). Will keep trying, hopefully i have a Eureka soon. i have finals coming up so i cannot promise much work till end of month. I will keep a close eye on thus thread though for any updates.

Regards, Michael.

I’ve got the similar issue with my Arduino Due compatible board (Digistump -> DigiX):

@…Pixy.h: In member function ‘void LinkSPI::init(uint8_t)’:
…Pixy.h:39: error: ‘class SPIClass’ has no member named ‘setClockDivider16’@

Can you help ??

Hi MA, it seems to be a general issue. Scott is working on a work around.

thanks, Michael.

Hi guys,

I’ve managed to get a Pixy working with an arduino Due, using I2C.

There is a problem when the library calls Wire.begin(), in PixyI2C.h, which causes the code never to return. You can get around this by commenting out the line, and just calling Wire.begin from the setup function.
After this everything works well.

I assume the same fix will also work for SPI, as long as you also fix the setClockDiv incompatibility, by changing the line SPI.setClockDivider(SPI_CLOCK_DIV16); to SPI.setClockDivider(84);, in the pixy.h file and moving SPI.begin to the setup function. However I have not tested this with SPI, so no guarantee.

regards.

Hi Philip and thanks for sharing, i have just tried your work around but i seem to be doing something wrong as it stays the same. Could you post a code. I am using the example 12C that comes with the pixy.

Hi Michael,

I’ve just added Wire.begin() to the setup function in i2c.ino: http://pastebin.com/5aRuLsWt ,
and commented out the same line from PixyI2C.h: http://pastebin.com/0z3SA0Zu , which is located in the library folder.

mmmmmm that’s strange. I bet did the same thing. Will give it another try. All i get is the Starting… text…Will give it another look.

Thanks Philip.

Philip!! Got it up and running. i was using the wrong I2C ports on the DUE. Apparently I2C works on the 20 and 21 pins. Up and running. Good looking out guys.

Michael.( One happy guy)

Ok, so, i have been working around the pixy and Due and it seems my success with reading data from pixy with i2c is rather random. When i am successful in reading data and push reset on the arduino, i only get the starting Text in serial. Also happens when i restart the arduino even with pixy running.Am i missing something please?