Arduino Due/Mega

Arduino Due/Mega by Arduino

Connection Type
USB
Number of servos
48
Audio Support
No
Camera Support
No

The Arduino Mega 2560 is a very powerful EZB microcontroller. The high number of pins and hardware peripherals makes it a multitasking monster. With the high number of ports, you can use 8 ADC, 13 PWM, 21 Digital ports, and 24 Servos at the same time!

ADC Ports

ARC has the ability to select up to 8 ADC ports per EZB. The MEGA has 8 ADC capable ports mapped to the ARC ADC ports starting from ADC0 to ADC7...

(ARC Left, Arduino Right)
  ADC0 = A0,
  ADC1 = A1,
  ADC2 = A2,
  ADC3 = A3,
  ADC4 = A4,
  ADC5 = A5,
  ADC6 = A6,
  ADC7 = A7

PWM Ports

ARC has the ability to select up to 24 PWM ports per EZB. The MEGA has 13 PWM capable ports mapped to the ARC PWM ports starting from D0 to D12...

(ARC Left, Arduino Right)
  D0 = 2,
  D1 = 3,
  D2 = 4,
  D3 = 5,
  D4 = 6,
  D5 = 7,
  D6 = 8,
  D7 = 9,
  D8 = 10,
  D9 = 13,
  D10 = 44,
  D11 = 45,
  D12 = 46

Digital Ports

ARC has the ability to select up to 24 Digital ports per EZB. Digital ports also operate as bit-bang serial/uart (transmit only). The MEGA has 21 Digital capable ports mapped to the ARC Digital ports starting from D0 to D20...

(ARC Left, Arduino Right)
  D0 = 2,
  D1 = 3,
  D2 = 4,
  D3 = 5,
  D4 = 6,
  D5 = 7,
  D6 = 8,
  D7 = 9,
  D8 = 10,
  D9 = 11,
  D10 = 12,
  D11 = 13,
  D12 = 44,
  D13 = 45,
  D14 = 46,
  D15 = 62,
  D16 = 63,
  D17 = 64,
  D18 = 65,
  D19 = 66,
  D20 = 67

Servo Ports

ARC has the ability to select up to 24 Servo ports per EZB. The MEGA has 24 Servo capable ports mapped to the ARC Servo ports starting from D0 to D23...

(ARC Left, Arduino Right)
  D0 = 22,
  D1 = 23,
  D2 = 24,
  D3 = 25,
  D4 = 26,
  D5 = 27,
  D6 = 28,
  D7 = 29,
  D8 = 30,
  D9 = 31,
  D10 = 32,
  D11 = 33,
  D12 = 34,
  D13 = 35,
  D14 = 36,
  D15 = 37,
  D16 = 38,
  D17 = 39,
  D18 = 40,
  D19 = 41,
  D20 = 42,
  D21 = 43,
  D22 = 68,
  D23 = 69,

I/O Port Expansion Board

Because the Arduino is merely a bunch of pins, it is nice to have a break-out shield board that has I/O expansion. This allows easier connecting of servos and sensors to the Mega. The break-out shield we recommend is the KEYESTUDIO Mega Sensor Shield V1 for Arduino Mega R3 Board 2560.



Download Firmware Sourcecode

Related Tutorials

Related Hack Events

Related Questions


ARC Pro

Upgrade to ARC Pro

Stay at the forefront of robot programming innovation with ARC Pro, ensuring your robot is always equipped with the latest advancements.

#1  

@DJ Sures - Any idea on the next release of the Arduino (Mega in my case) firmware that will add support for I2C devices, such as Lidar Lite v3; or even plain old Ultrasonic rangefinders?  (I see the updated release for the Uno: https://synthiam.com/Community/Questions/Arduino-uno-with-a-ultrasound-sensor-ez-builder-control-18812 from November, but not the Mega as its from February)

Also, any thoughts of supporting the Mega APK version, for Bluetooth or WiFi access from the mobile apps?

Netherlands
#2  

No arduino mega in house and i need enought Digital pins, allready ordered one should arrive in a few days.... But i have a Arduino Due laying... It has the same pinout... Will it be compatible?

PRO
Synthiam
#3   — Edited

I think it should be compatible. Give it a shot by putting the firmware on it. I think the due and mega are similar enough to work with the same firmware.

edit: quick google says they’re compatible. The duo will work with the mega firmware.

Netherlands
#4  

Always that fast with a reply.. i almost think you are a bot

Thanks! I will give it a try.. Still waiting till everything is updated on the lattepanda. Making it a workstation/data library for everything ez-b related

PRO
Synthiam
#5  

Beep bleep beep beep beep 1011010011110101000110001 beep. I’m not a bot :)

Netherlands
#6  

hahaha lol xD

I tried it.. but it gives me an error. Seems like this file is not compatible with the Due because it has no avr chip...? or am i wrong User-inserted image

PRO
Synthiam
#7  

The software serial library might not be compatible. Do you require transmitting serial on all digital ports?

Netherlands
#8  

I want to connect. Arround 16 servos Jrk2 motorcontroller, i think that one ineeds serial... Still trying to understand the manual. The smartdrive duo is on rc mode. Then i need something to control the lights in R2's body, but that can be a seperate nano.

#9  

Use you Uno, plus the 16 channel servo driver breakoutboard...works flawless!! :)

Netherlands
#10  

I was in the believe i couldn't use the uno it's pins if i use the servoshield? hmm i have some more studying to do...

PRO
Synthiam
#11  

The Due will work for you. I believe there is a hardware uart that can be used for Serial. To start, use this: Arduino EZB Due.zip

Netherlands
#12  

The script is uploaded succesfully!:D thanks!

#13  

This one is your weapon of choice... https://learn.adafruit.com/16-channel-pwm-servo-driver?view=all

Or if you want it even easier to assemble... https://learn.adafruit.com/adafruit-16-channel-pwm-slash-servo-shield?view=all

PRO
Synthiam
#14  

Updated with the latest firmware and port mapping information

PRO
Synthiam
#15  

Btw. I recommend one of these servo shields for the mega. It’s so much easier to work with than the female header on a vanilla mega.

you can get them from Amazon as well and save on shipping.

KEYESTUDIO Mega Sensor Shield V1 for Arduino Mega R3 Board 2560 https://www.amazon.ca/dp/B0169YXYEY/ref=cm_sw_r_cp_api_glt_i_Q5BQKSMYPX0MHE0GJ8VR

User-inserted image

#16  

@DJ,

I have the exact Arduino Mega Shield and the highest the pins go is to 53.  In you port mapping on this page shows ... Digital ports: D15 = 62, D16 = 63, D17 = 64, D18 = 65, D19 = 66, D20 = 67

Servo Ports: D22 = 68, D23 = 69,

Also, some of the PWM port numbers overlap the Digital ports.  I'm I missing something?

Thank you, merne

PRO
Synthiam
#17  

That’s correct - some overlap. And that shield might only go that high. It wasn’t designed but us so we don’t have control over the design, unfortunately

#18  

Thanks DJ.

i miss the days when you and your team designed the hardware. :(

PRO
Canada
#19  

@merne I'm still designing hardware for EZ-Robot! :D

I'm working on the release schedule at the moment. We hope to have new products consistently rolling out on an ongoing basis.

#20  

Sweet! @ Jeremie. I can’t wait to see what you and your team come up with.  They should be awesome.

I’m going to us the Arduino mega 2560 to run my base motors and ultrasonic sensors for my Inmoov for now.

#21  

I look forward to seeing whats coming soon. I am looking to see is any new sensors will be able to added. I was even looking at possibly adding an arduino as a add-on to the EZB.

#22  

@Jeremie, I have a EZ-Robot HD servo question. Is it OK to ask you here in this forum if I start a new post? I sent a couple questions to them in the near past and got no answers back.

PRO
Canada
#23   — Edited

Hi Dave,

The best course of action would be to contact EZ-Robot directly about hardware related questions. I believe that there was an issue with the Contact Us page on the EZ-Robot website, it’s being corrected.

You can always verify if EZ-Robot has received your correspondence using the Live Chat.

#25  

Hello all.

This might be a dumb question. Can I use the barrel power input and the USB at the same time using the Mega Sensor Shield?

Thanks in advance.

PRO
Synthiam
#26  

That’s actually a good question. I would think the answer is yes. Because barrel jack receptacles have these little switches that open when something is connected. This allows the power to switch from one thing to the barrel jack.

but - because we’re talking about open source I can’t guarantee it’s wired correctly. It’s not often that I see open source or China diy stuff designed correctly.

so uhm my answer is I’m not sure

#27  

@DJ,

Can I use the Ultrasonic sonar (4 wire) SR04' on both digital and servo ports?

Thanks in advance.

PRO
Synthiam
#28  

Digital ports can be used for sr04's. servo ports can only be used for servos.

#29  

Thanks DJ for your answers.

BTY, I looked on several Arduino chat boards. I could not find a definitive answer regarding using the power barrel and USB cable at the same time.  Several people have said they have no problem, others say it burns out the Arduino board.

A few others have said they just disconnected or cut the red power cable on the USB cable and do not have a problem.

i’m going to cut the USB red power Wire and use the power barrel. I want to use battery power and not my tableta USB port for power to run the Arduino mega only for ARC commands.

Thanks again for your answers. cheers

PRO
Synthiam
#30  

You can try something. Plug a barrel jack in. And then check continuity between the usb red wire and the center pin of the barrel jack connector.

#31   — Edited

User-inserted image @DJ,

if I understand you correctly, this is what I did.  I connected the USB to the Arduino and my pcand power to the barrel jack.  I then put my  multimeter lead to the red wire and The other lead to the center of the barrel jack and got a beep.  I think this is what you are asking.

Edited:  I do have two Arduino mega’s so I could try it with and with out the red usb wire cut.  I just don’t want the pc usb powering the Arduino. As I mentioned before, I want the battery to power the Arduino so it does not drain the power of my pc tablet. Thanks.

PRO
Synthiam
#32  

Do you have a plug in the barrel jack when you got the beep?

#33   — Edited

@DJ,

yes and the plug in the barrel jack had 5vdc going to the Arduino mega.

So this time I unplugged power to the barrel jack and only had the USB cable plugged into my Arduino and my PC, no beeps.

So I’m at a loss. I my just cut the red power on the USB cable going to the pc.  I hope to try this tomorrow if I have time to make sure ARC controls the Arduino with ARC firmware.

Thanks again DJ.

#34  

@DJ,

I did fined a copy of the mega firmware I downloaded a few weeks ago, but it does not support Ultrasonic sensors. Is this something you will be adding soon? Thank you. Also what port do I put sabertooth Movement Panel on.

thanks in advance  Cheers

PRO
Synthiam
#35   — Edited
  1. i'll add support for distance sensors for you. It'll be in the next update which I can probably do this weekend

  2. choose whatever port you have the sabertooth connected to. It's up to you - connect it, select it and go :). Use any digital port for bit-bang serial, or use the hardware uart. The option is selectable in the sabertooth Movement Panel configuration screen.

#36  

Thank you DJ. You’re awesome!

@DJ, you always take the time to add  additions to your already awesome software for anyone that asks.  That’s a great thing!

I’m not really sure how to connect the UARt for my sabertooth on the mega on the Arduino but I will look at the documents and try to figure it out.

I do have a question I ask a while ago about the Arduino DEU/Mega.  Both board’s numbers only go as high to 53. Your port numbers go higher.  I’m asking is you have numbers on the layout of the ADC, PWM, digital and analog.  Is this of a future design/product Jeremie and company is working on?

also, here is a link for the  mega sensor Shield V1 link for anybody who what’s info.. https://www.keyestudio.com/products/free-shipping-keyestudio-mega-sensor-shield-v1-for-arduino-mega

Description of the mega shield: Have you met with these troubles? when connecting a couple of sensor modules to MEGA 2560 control board, sometimes power output interfaces are not enough, so need to use the breadboard and the wiring is rather troublesome. Now don’t worry about that. You can use this keyestudio MEGA sensor shield. It is fully compatible with MEGA man 2560 control board, so that you can easily stack the MEGA sensor shield onto the MEGA 2560 control board. The shield comes with digital and analog interfaces in 3PIN (G V S), easy to connect the 3PIN sensor modules. Besides, it comes with communication pins of 2.54mm pin pitch, such as serial and SPI communication. It comes with a reset button and 2 signal indicators as well. Note: for the 3PIN interface, the voltage of Analog pins (labeled V) is 5V; while the voltage of Digital pins (labeled V) is VCC, that is, the voltage input via a blue terminal block, default by jumper connected, connecting the voltage to 5V on the shield.

User-inserted image Thanks again. Cheers

PRO
Synthiam
#37  

If the port numbers go higher than your board, then you won't be able to use those pins. The pwm, servo, and digital ports are assigned to the capabilities of the chip on the mega.

#38  

@DJ,

I understand now,  I need a Arduino Mega 2560 Rev3 to get the high pin outs.  Sorry for being so dense.:( BTY, how is the ultrasonic sensor firmware coming along?

Thanks and Cheers!

PRO
Synthiam
#39  

The firmware is available for download on this page . scroll to the top and click download the latest firmware (sept 2021). However, it requires ARC to be updated. It's something I'm doing today :)

PRO
Synthiam
#40   — Edited

Merne, here is the correct link for sabertooth manual and discussion: https://synthiam.com/Support/Skills/Movement-Panels/Sabertooth-Movement-Panel?id=16039

You will find instructions to configure the robot skill and links to configure the dip switches on the device.

#41  

Does this firmware support I2C?

I see the following in the code

#define CmdI2CWrite           10
#define CmdI2CRead            11

But I can't see anyplace the code below for these two commands.

PRO
Synthiam
#42  

what does it say in the debug window when you connect to it?

#43  

Thanks DJ I see it does not support I2C communications.

I guess I will have to create my own code.

PRO
Synthiam
#44  

Okay - it shouldn't be difficult to add. Can you check any of the other arduino libraries and see if they support i2c? The pin coun won't match but they should load fine. If we find one code with i2c support we can add it.

PRO
Synthiam
#46  

That looks correct. I have no experience with it, though. I2C has never really been good to me in the past haha