How to Program Arduino Mega 2560 Core?

Introduction: How to Program Arduino Mega 2560 Core?

About: I'm an electronics engineering undergraduate who love to tinker around with microcontrollers other electronic stuff.

I found this great small form factor Arduino mega board on ebay. It's a smaller version of Arduino mega 2560 and it's apparently called Arduino mega core...
There was one problem though! It doesn't include usb connectivity and there isn't a lot of information available online too..
So i need to figure out how to program the board and use it to shrink down some of my projects which requires Arduino mega...
I don't own an ftdi module and couldn't order one due to covid19 lockdown...and also it is unnecessarily expensive here in India..
What i do own is a ch340g usb to serial converter...
A great ftdi alternative and this chip(ch340) is very common in Arduino clones and many esp8266 boards...
A little bit of an hack was required to get it working...
Writing this instructable so if someone wants to use the same board for their projects....


I ALSO TRIED USING ANOTHER CHEAP USB TO SERIAL MODULE CALLD PL2303 (You might see it somewhere in the images in later steps) BUT NEVER GOT IT WORKING ...

I hope it helps

Supplies

-Arduino mega 2560 core
- ch340g usb to serial converter
- soldering iron
-dupont hookup wires (5 male to female)

Step 1: Install the Drivers

Ch340g drivers doesn't come pre installed on windows. Linux machines doesn't require any driver for that chip (i love linux, we all do)
But since it's fairly common chip, getting drivers is super easy...
Just google " ch340 drivers" and download from the first link that pops up...
After installing the drivers, your windows system will be able to see and communicate with the device.
Here's the link (https://sparks.gogo.co.nz/assets/_site_/downloads/CH34x_Install_Windows_v3_4.zip)

Step 2: The HACK

to be able to program the board using ch340, i needed to perform a small hack on the ch340 module.
For programming, one need to connect the board as follows (left side of the arrow is usb to serial module and right side is the mega 2560 board)

Rx pin. > Tx pin or Arduino
Tx pin. > Rx
Vcc(5v) > vcc pin
Gnd. > ground pin
Dtr > dtr pin

But there are some problems with ch340 module:
1. Rx and Tx pin silk screen is printed reversed.
2. There is no dtr breakout pin on the board.
To solve problem number 1, i simply reverses the rx and tx connections so...
Rx > Rx of Arduino mega core
Tx> Tx of Arduino mega core
(This might or might not be an issue with you, it might be a manufacturer specific thing)
To solve problem number 2 i had to cut the female end of a DuPont hookup wire and solder it to the dtr pin on the chip itself (PIN NUMBER 13 of ch340 chip)
AND then i was able to connect the other end to the dtr pin of the Arduino and done!
Now you'll be able to communicate and upload the program the board without any problems!

Step 3: Testing

I tested the contraption by uploading good old HELLO WORLD! Of microcontrollers i.e. the blink sketch!
Connect the USB and the board as described in the above step.
If you installed the drivers correctly (system restart might be required) windows will detect the module without any issues.
NO DRIVERS REQUIRED FOR LINUX (UBUNTU)
Open Arduino IDE (arduino.cc)
Open blink example sketch by going to files>examples>basics>blink
Go to tools>com port> (select thr com port, in my case it's com3)
FOR LINUX (UBUNTU) COM PORT MIGHT SHOW UP AS, in my case, /dev/ttyUSB0 OR SOMETHING LIKE THAT!
(in case you see multiple ports in Linux and confused, open terminal and type "sudo lsusb" command and hit enter to find out which one is ch340)
Then go to tools>boards> select Arduino mega or mega 2560

click on upload button at the top left corner(circular one with the arrow)
And if everything is done correctly, code will be uploaded on the board with a message "done uploading" in Arduino IDE and the onboard LED should start flashing!

First Time Author Contest

Participated in the
First Time Author Contest

Be the First to Share

    Recommendations

    • Metal Contest

      Metal Contest
    • Summer Fun: Student Design Challenge

      Summer Fun: Student Design Challenge
    • Maps Challenge

      Maps Challenge

    Comments

    0
    Elaina M
    Elaina M

    1 year ago

    Congratulations on sharing your first instructable :)