<< return to Pixycam.com

Multiple pixies over I2C, only one working at a time

hi,

I’m trying to connect two Pixy2’s over I2C, using an Arduino 2560 and power over USB (laptop). They are configured on different addresses. Everything seems to be working, except I can only get blocks from one of them per ‘session’ (==the first that has any blocks). After this, I have to reset the arduino, and only then it’s possible to get blocks from the other… if that one is first this time. And so on.

In loop(), I’m basically just using the i2c example code, copy-pasted for a second pixy, at 0x55.

Could this be a power issue? Or should I add pull-ups (not clear)? Or could it be something else? :stuck_out_tongue:

Thanks a million for any pointers!
Mark.

Hello,
The SDA and SCL signals have weak pullups (~80kohms). You should add 2.2K pullups to both signals. This may not be the issue, but the weak pullups can cause some odd behavior.

Edward

Thanks! Added the pull-ups, but they don’t seem to make a difference… :stuck_out_tongue:

Probably not an issue, but I’m reading 4.2 volt on the high side of the pullups, which I thought should be closer to 5 volt (frustrated software guy :P).

Mark

hm, when I change the baudrate from 19200 to 115200, it seems to work! (not sure why it was on 19200 in the first place…). does that make any sense? :stuck_out_tongue:

thanks, cheers,
mark.

The baud rate is for UART serial, so it doesn’t make much sense. For I2C, the host processor (Arduino) supplies the clock signal, so there’s no baud rate (bitrate) to configure on the Pixy side for I2C. You can, however, configure the bitrate on the Arduino side.

https://www.arduino.cc/reference/en/language/functions/communication/wire/setclock/

Edward

okay, thanks! I must have been doing something stupid then :stuck_out_tongue: everything is now working correctly (possibly bceause of the pull-ups :P). I have however switched to using ni2c, since I need loop() to be super fast and I couldn’t get to 1000 steps per second with the pixy2/wire libs… and I need more steps than that.