Hello everyone,
I would like to ask for your support on this topic:
BACKGROUND
I have a Pixy CMUcam5 sensor (Information about Pixy CMUcam5) wired to an Arduino-based PLC named Controllino MAXI (Information about Controllino).
My wiring is like this:
Pixy SPI and power pins are connected to a small protoboard which supplies the power to Pixy (measured 5.25V from my 5V power supply), and takes the SPI pins (SCK, MISO, MOSI) to the corresponding pins in the Controllino pin header. The Controllino is powered by a different, 12V power supply (measured 12.15V).
The GND pins in both power supplies are connected to each other.
I’m using the “hello world” example from the Pixy library:
#include <SPI.h>
#include <Pixy.h>
Pixy pixy;
void setup()
{
Serial.begin(9600);
Serial.print("Starting...\n");
pixy.init();
}
void loop()
{
static int i = 0;
int j;
uint16_t blocks;
char buf[32];
blocks = pixy.getBlocks();
if (blocks)
{
i++;
if (i%50==0)
{
sprintf(buf, "Detected %d:\n", blocks);
Serial.print(buf);
for (j=0; j<blocks; j++)
{
sprintf(buf, " block %d: ", j);
Serial.print(buf);
pixy.blocks[j].print();
}
}
}
}
PROBLEM
Sometimes the Pixy will not send any blocks to the Controllino, and the Serial Monitor will only read “Starting…” and no blocks. I’ve checked that the reason for this is that blocks never changes from 0, although Pixy shows through its LED indicator that it is actually detecting objects.
If this problem appears, it will never work even when restarting the Controllino and the Pixy several times.
The problem is sometimes solved by uploading the program again to the Controllino. If this happens, the Pixy will communicate correctly with Controllino most of the time (the error still happens sometimes when turning off/on the system, but it is fixed by turning on/off again).
The issue sometimes appears again if the program is uploaded to the Controllino again.
ADDITIONAL DETAILS
-
This issue NEVER happens if I replace the Controllino with a USB-powered Arduino MEGA (1280). Pixy will ALWAYS send blocks to Arduino regardless of how many times I turn on/off or re-upload the program.
-
This issue doesn’t happen as often if I keep the 12V power supply off and power the Controllino via USB instead, but it does happen sometimes.
-
In all of these situations I used the same cable, same connections, same protoboard, and in the connection to the Arduino MEGA (1280) I used the same pins for the communication (50, 51, 52), not the ICSP header.
-
When testing with Arduino MEGA (1280) I select that board in the IDE and the port information only shows “COM8”.
-
When testing with Controllino MAXI, I select Controllino MAXI board in the IDE, and the port information says “COM9 (Arduino MEGA 1280 or 2560)”. I think this is kind of strange, but I don’t know if it has anything to do with the issue.
Thank you in advance for your support. If you need additional details I’ll be happy to provide them.