USB to Serial / TTL Adapter to Program ATmega328p (w/out DTR Pin!)

28,715

13

9

Introduction: USB to Serial / TTL Adapter to Program ATmega328p (w/out DTR Pin!)

About: fb @ geeameal

This will help you upload code to an atmega328p for your standalone arduino project using USB to serial / TTL adapter!

Step 1:

First let’s see if the adapter’s working.

Plug in the adapter >> Open Arduino IDE >> Select the proper COM port >> Open Serial Monitor >> then type in “Hello World”, it should print “Hello World” in the monitor, if not something is wrong

(SKIP THE NEXT STEP IF YOUR ADAPTER IS PROPERLY WORKING)

Step 2: Fixing the Adapter's Driver

Device Manager >> Ports (COM & LPT)

If there is a yellow triangle next to “Prolific USB-to-Serial Comm Port”, that means correct driver version is not installed.

(Click this for more info)

Uninstall your existing driver (Control Panel >> Uninstall a program)

Download driver

Then install and done!

Do step 1 again to see if the adapter is now working

Step 3: Make the Necessary Wirings

For atmega328p on a breadboard, make the following connections (also, add an LED in series with a 100 ohm resistor on atmega328p pin 19/digital pin 13 for testing later)

Parts:

1. Pushbutton (normally open)

2. 1 10kohm resistor

3. 2 22pF ceramic capacitors

4. Atmega328p

5. 16 MHz crystal oscillator

Step 4: Atmega328p Pinout

Step 5: Uploading Codes

For uploading code:

1. First make the following connections with the USB to Serial/TTL Adapter

USB to Serial/TTL Adapter >>>Atmega328p

5V >>> 5V rail

GND >>> GND rail

TXD >>> Pin 2 / RX pin

RXD >>> Pin 3 / TX pin

2. Open Arduino IDE >> File >> Examples >> Basics >> Blink

3. Press the pushbutton >> Hit upload

4. Keep on pressing if it says “Compiling sketch…”

5. Release the button as soon as it says “Uploading…”

6. Done!

1 Person Made This Project!

Recommendations

  • Photography Challenge

    Photography Challenge
  • New Year, New Skill Student Design Challenge

    New Year, New Skill Student Design Challenge
  • Knitting and Crochet Speed Challenge

    Knitting and Crochet Speed Challenge

9 Comments

0
umar arshad
umar arshad

3 months ago

How to program atmega328 without bootloader using usb to ttl converter ch340

0
techsavage
techsavage

6 months ago

Did not work at first, but got it to work. It's kinda try 1 or 2 times to upload. I use platformio on vscode btw. Create an arduino project for the ATmega328p or use terminal/cmd-line:
run command: "cd ~/Desktop && mkdir mrflasher && cd mrflasher && pio init -b ATmega328P && code ."
(If cmd does not work, install platformio command line tools)
Anyway, my platform.ini file:
[env:ATmega328P]
platform = atmelavr
board = ATmega328P
framework = arduino
next:
Include <Arduino.h> in at the top of your project where setup and loop are. paste your code underneath.
At the bottom left of vscode you see a check-mark and an arrow to the right. If you want, press the check-mark to compile, or just press the arrow to upload. (only works if you got the platformio extension). Anyway, after pressing upload:
You'll see a message like:
"Auto-detected: /dev/cu.usbserial-0001"
and immediately (half a second idk) you'll see something like:
"Uploading .pio/build/ATmega328P/firmware.hex"
When you see that last message, push the button asap for exactly 4 seconds (I timed it on my end) then release. It will take a second and gives you a success message. However, my code was just beginning a serial at 115200 and writing "second" every second, Idk yet if it works when I upload my finished code or I found a solution for it. Good luck.

0
Mdirfan
Mdirfan

1 year ago

its not working
error msg is
avrdude: stk500_getaync() atemp10 0f 10:not in sync: reap=0*20

0
vector.a.5824
vector.a.5824

Question 2 years ago on Step 5

There is no way that we have to use the button find another way please

0
kartikksingghhh
kartikksingghhh

2 years ago

Not working.
Error :- programmer is not responding

0
AjmalS7
AjmalS7

3 years ago

Sir its not working

0
Sba_NYFT
Sba_NYFT

Reply 3 years ago

It cannot work easily, because this USB to Serial converter doesn't have the DTR pin. You have to push the reset button just before the compiling ends, and release it just after the "Uploading..." message appears. Not so comfortable, IMHO.
Instead, you can buy a CP2104 USB to Serial converter, connect pins as explained above and the DTR pin to the reset pin of the ATMega328. In this way the reset comes directly from Arduino IDE.