<< return to Pixycam.com

Pixy's communication is blocked by a serial communication on A. Mega

Good Day everyone :slight_smile:
I have succesfully hook up my Pixy2 cam to an Arduino Mega via the 6 pin port and it works fine. Now, I want to implement wifi function to my system so I connected a NodeMCU ESP8266 via serial connection to the Arduino (specifically on pins 50 and 52). When I am testing Arduino with pixy only, it works, but when I connect the NodeMCU it gives me “error no response”. I think it is not because of the code for NodeMCU connection because I also tested it separately (without the Pixy) and it works also. Its just that when they are both connected that pixy would give an error. I am not pro in coding so I can’t understand fully what is written in the documentation about Pixy’s communication. All answers are greatly appreciated. Thanks!

Hello,
What communication mode are you using to talk to the ESP8266 (UART or SPI?)

The 6-pin Pixy-Arduino cable uses the Arduino’s SPI port. It sounds like the ESP8266 might be using SPI port also.

Edward

Hello, I use UART communication.

Hi Jenn,
If you’re using UART between the Arduino and the NodeMCU, I’m not sure why there would be a problem.

I’m guessing the software for the NodeMCU is complex – perhaps it’s changing the interrupt handlers. I’m sorry, but I don’t have an easy answer to this one.

Edward

1 Like

Hello! Sorry for not replying to this thread for a long time and thank you @edge for doing your best to help. Several weeks ago, I have found a solution to my problem and thought I would share here hoping to help others in the future.
The solution that worked for me was writing Serial1.end() [Note: Serial1 is object for nodemcu serial conn.] right before initializing pixy then Adding Serial1.begin(9600) again to establish nodemcu connection.
I still cant pinpoint why it needs to be like that when different communication (SPI) is used by Pixy. I assume it has to do with interrupts or buffer since I am sending JSON through UART communication.

Ps. The code’s algorithm is establishing UART communication with nodemcu because arduino needs to confirm that it is connected to internet before it starts the loop. I end the UART comm. before initializing pixy. Then, I need to begin again UART comm. to send JSON data to nodemcu for data monitoring.

Hi Jenn,
Nice work getting it working. Porting is often a challenge. :slight_smile:

Thanks for sharing your notes!

Edward

1 Like