Help with linking an Arduino Mega to Zumo 32U4

Hello everybody!

Let me tell you a bit about my project. I want to build a big structure on top of the Zumo 324U to which I will hook up quite a number of sensors and actuators. It will look ridiculous for sure. Because of the large number of sensors, I will need to hook up an Arduino Mega to these which will act as a middle man between all of sensor results and the Zumo. I’ve looked at the pin layout of the Zumo324U and decided that for my use case, getting rid of the LCD to use the RX and TX pins to send data back and forth between the arduino and the zumo is my best option.

As to wiring the arduino mega to the zumo32U4, I hooked up the arduino RX to the mega TX and vice-versa, while also hooking up the arduino ground pin to the zumo ground pin. This should take care of the exchange of information between them from the hardware side.

Now, as to the coding, this is where I encounter issues since I am not very experienced with either Arduino or Zumo. From my understanding, I need to program these two boards separately which is fine. But I am not sure how to proceed with the communication between them. To send data from the arduino I think I need to use Serial.write(), but I am not sure how to read it from the Zumo side or how to send data to Arduino.

If anybody has tried this before and has any snippets of code that I could look at I would be eternally grateful.

Thank you!

Hello.

It seems like you made a typo in the first half of this sentence. I think you meant to type that you’re connecting your Arduino Mega’s RX and TX pin to the Zumo 32U4’s TX and RX pin, respectively.

To read incoming serial data from the Arduino Mega with the Zumo 32U4, you would use one of the read functions (e.g. Serial1.read()) in the Arduino’s Serial library. For writing back to the Arduino Mega from the Zumo, you would use Serial1.write(). You should probably look at the documentation for the Serial library on the Arduino website to get familiar with the functions available to you and perhaps a better understanding on how communication between the Arduino board and other devices work. Some of the functions’ pages contain some code examples that can help you get started. Also, you can do an Internet search for examples on how to do serial communication between two Arduinos, since the Zumo 32U4 is an Arduino-compatible board.

By the way, you might consider using the Romi and Romi 32U4 Control Board to get more space to add and control all your other devices (e.g. sensors and actuators).

- Amanda