Mega 2560 to MKR wifi1010 communication

Hello, very new here, and trying to learn.

I have a mega 2560 controlling a green house. All of the functions work as expected. In trying to implement cloud visibility, I chose a MKR wifi1010 to make the connection (because I had it). I am communicating between the two boards via serial connection. My expectation was to be able to print on serial 3 of the mega and receive on serial 1 of the MKR. Knowing little to nothing about the viability of this option or if there is a preferred option is of course causing me issues.

First, is there a better option and if so what is it?
Second, if this is the preferred option, then how do I complete the task. I can of course share the sketches, but I just wasn't sure if I was even going about this the right way. Any insight would be appreciated.

My recommendation is to start by creating a simple set of sketches that only serve to verify that communication between the two boards is working. You can adapt the sketch you find in Arduino IDE at File > Examples > 04.Communication > SerialPassthrough for this purpose. Keep these on hand to use for troubleshooting purposes later if you experience potentially communication-related problems during the development of your production sketches.

You must be aware that the Mega 2560 has 5 V logic levels and the MKR WiFi 1010 has 3.3 V logic levels. This means that if you connect the TX pin of the Mega directly to the RX pin on the MKR WiFi 1010, you will be subjecting the pin on the MKR WiFi 1010 to 5 V, which is above its maximum rating and could do permanent physical damage to the board. For this reason, you should use a logic level converter between the boards.

There's no problem doing the data transfer the way you describe, but you must do as @ptillisch suggests and change the voltage on the Tx from the Mega to the Rx of the MKR!010, either with a voltage level changer or a voltage divider. Going the other way should be okay. In addition to the example already suggested you might also find this helpful:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.