Connecting MegaPi and Arduino?

Is it possible to merge normal Arduino code and MegaPi code?

My classmates made a project where we primarily use Arduino code but we’re going to use the clamp from the ultimate 2.0 but we already have a code for the wheels and ultrasonic sensor using ArduinoUNO. Now the goal is that we have to connect the coding from the ultrasonic sensor to the clamp so it can pick up something and drop it after it turns around.

So like
Ultrasonic sensor senses an obstacle (typically trash)
DC motors stop and clamp arm goes down to pick up trash
Clamp picks up trash, turns around, and places trash in basket
Clamp goes back to initial position and repeats cycle

Was also meaning to ask, is it possible to make conditions for a DC motor since we’re gonna be using the turntable that was meant for the 3D motion capture bot.

I know this sounds confusing and I honestly am confused too because my classmates insist on doing this rather than go purely on MegaPi because we already blew so much money on Arduino products when they planned without me.

1 Like

Please explain what a MegaPi is. Please explain what an ultimate 2.0 is. Links to products, datasheets and everything else that can be relevant.

We might be able to look it up on the web and very maybe find the same things as what you have; but there is a good chance that we find the wrong stuff.

1 Like

Apologies on the oversight.

MegaPi is basically a control board that comes with the Ultimate 2.0 kit manufactured by Makeblock. It's designed for beginners in robotics using block based code but it does and can run with Arduino code.

My problem here is if it's possible to maybe connect the ArduinoUNO and MegaPi so the two parts can cooperate (ultrasonic sensor on the ArduinoUNO and the clamp from Ultimate 2.0).

Thanks for the links. Blowing money at Arduino is normal :slight_smile: But I would stick with the MegaPi only. Communication between two boards adds an additional layer of complexity that might give you grey hairs.

You can two boards; the communication can be (from easy to complicated)

  1. Serial; the MegaPi has Rx2/Tx2 broken out. You can connect that to the Uno, using SoftwareSerial on pins different from 0 and 1 (keeping your debugging options open) or pins 0 and 1. Be aware that SoftwareSerial claims all pin change interrupts so it might conflict with other things that require interrupts on the Uno.
  2. I2C; you will have to decide who will be the master and who will be the slave.
  3. SPI; again you will have to decide who will be the master and who will be the slave.

You will need to clearly define the functions of each board.
You will need to design some form of protocol / command set for the communication between the two boards.

1 Like

Noted. I'll see if I can do it. I might have to dig around for a base on the code since I'm still fairly new to Arduino ;v;

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