Program Arduino via USB to Serial RS232 Converter with and without DTR Pin

| |

What make this Arduino  popular among Electronics hobbyists and enthusiast? Of course they are compact with so many input and output pins, digital and analog input and output support, support for various serial communication protocol etc. but all this things are supported by various other microcontroller boards.


Why not make a PCB for your Project?

Making a PCB for your DIY project is not hard nowadays. PCB helps to get rid of all messy wires and stuff and gives your project an awesome look. And it’s cool to make your own PCB for your project right?

I use Altium Designer to draw the circuit and design the PCB. It is a powerful tool that can be used to design and create your own PCBs for your project as well as complex and multiplayer PCBs for industrial use. Here is the link to the Altium trial version. So make sure you check it out.


But, the real reason why Arduino is  on top of all other microcontroller boards is its ease of use. They are tiny compact and it can be easily programmed using a normal PC via its USB port.

Almost  all the Arduino boards like UNO, nano, MKR series can be programmed by connecting it to the USB port of a PC.

But there are some boards which cannot be program directly using USB due to the lack of USB port on the Arduino board. For example Arduino pro mini and lilypad. For boards like that, you will need a USB to Serial to upload code.

In this post I will explain everything you need to know about arduino programming, uploading and different logic levels that are involved in the program uploading.

Here I will show you how you can upload any code to any Arduino board using Arduino IDE and USB to Serial converter.

Let us start with the basics.

Arduino Behind the Scenes

“Arduino is a micro controller” this statement is technically incorrect. Arduino is a platform/board, which has a micro controller in it. Arduino boards uses a series of micro controllers that are made by a company called ATMEL. All the pins of micro controller IC are connected to the board which makes it easier for us to access the GPIO pins and program the IC.

How do you upload code to the arduino?

Of course you might be knowing how it works.

– Write the Code

– Choose the right Board and port

– Click on upload

Now let us dig deeper and see what is happening behind the scenes.

The code is written in type of C/C++ and when you click on the upload button, the code is compiled and converted to hex format. It is this hex file that is uploaded to the microcontroller IC.

USB to Serial Converter

In most of the boards, there is another chip, that acts as an intermediate between the PC and the main microcontroller IC. This chip is what lets you connect your USB cable to the Arduino board and helps the ATMEGA IC to communicate with the PC via USB.

This is the chip that helps you upload your program to the microcontroller. Once the code is uploaded, this chip will help the Arduino board to send messages back and forth between the Arduino and the PC.

Arduino Boards without built in USB circuitry

There are boards like Arduino Pro Mini and Lilypad that are really small and less costly that don’t have the IC that facilitates the communication between the Arduino Board and the USB. So in order to program we will have to use another external circuit that will stand in between the PC and the microcontroller and help us to communicate back and forth between them.

USB To RS232 PL2303 TTL Converter Adapter

This is a compact circuit that will help us to translate the communication between PC and the microcontroller IC. The USB to RS232 chipset based TTL provides you an easy and convenient way to connect your RS232 TTL Devices such as Arduino boards to your PC via the USB port.

usb to ttl serial converter

Here, we will be using this adapter that will stand in between the PC and the microcontroller IC.

There are two variants of this available; the one with the DTR pin and one without DTR.

usb to ttl serial converter
usb to ttl serial converter without dtr

What is DTR Pin in Arduino?

Data Terminal Ready (DTR) is simply a control signal in RS232 serial communication, transmitted from data terminal equipment (DTE), like a PC, to data communications equipment (DCE), for example a modem, which will be used to indicate that the terminal is ready for communications and the modem can now initiate a communication channel.

AutoReset is a feature, which enables us to upload the compiled sketch to the Microcontroller without pressing the reset switch. The way it works is by sending a reset signal (GND) to the reset pin using the DTR signal on the RS-232 interface.

So if the USB To RS232 PL2303 TTL Converter Adapter does not have a DTR pin, we will have to manually reset the Arduino Board in order to upload the code. This will freeze the execution of the currently uploaded code and waits for the USB To RS232 PL2303 TTL Converter Adapter to send the new code.

Now we know what all things to keep in mind to program Arduino pro mini. Lets get started.

Tutorial

Step 1 – The Connections

As mentioned, there are two types of USB To RS232 PL2303 TTL Converter Adapter. The one with DTR and one without DTR pin.

Follow the connections as mentioned below

For the One With DTR

Arduino —- USB To RS232 PL2303 TTL

5V—-VCC

Gnd—-Gnd

Tx—-Rx

Rx—-Tx

DTR-DTR

Without DTR

5V—-VCC

Gnd—-Gnd

Tx—-Rx

Rx—-Tx

Thats it. Now its time to upload the code

Step 2 – Connect it to PC

Now you can connect the adapter to your PC.

Once the its is connected, you should be able to see the adapter in the Device Manager. Take a note of the COM port.

Fire up the Arduino and go to Tools -> Port

There you should see the COM port which is linked to the Adapter. Select that port.

Now Go to Tools -> Board and Select “Arduino Pro or Pro Mini”

Step 3 – The Code

Copy the below code to the Arduino IDE.

void setup() 
{
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}

This is a simple sketch which is used to blink the inbuilt LED once a second.

Step 4 – Code Upload

For the USB to Serial Adapter with DTR

Simply click on Upload button and the code will be compiled and uploaded to the Arduino Pro Mini without any interaction. The DTR will automatically reset the board for the upload.

For the USB to Serial Adapter without DTR

For the adapters without DTR the process is a bit different.

Once you click on the upload button, the code will be compiled and at that time the status bar on the bottom will be changed to “Compiling”. At that time, press and hold the reset button the Arduino Pro Mini. Once the code is compiled, the status will be changed to uploading. Now release the reset button and the code will be uploaded in no time. Easy as that!!

Once the upload is completed, the code will start to run. That is how we upload a code to an Arduino board especially Arduino Pro Mini with no USB port using a USB to Serial RS232 PL2303 TTL Adapter with or without a DTR pin.

Want to build more projects? Checkout Our Project Vault.


Learn Arduino the Easy Way

Are you new to Arduino? Do you want to improve your skills in Arduino programming? You are in the right place. We have a complete beginner-level tutorial for Arduino which covers everything from scratch. In this free Arduino Tutorial for Beginners guide, we will be taking a look at Introduction to Arduino platform, getting started with Arduino IDE, different types of Arduino boards, and a lot of DIY projects using Arduino. Check it Out!

arduino tutorial for beginners
Arduino Tutorial for Beginners

Lets start learning Arduino



Awesome Arduino Projects you DONT WANNA MISS!

Here is a list of the creative Arduino Projects implementing newer sensors and boards, which can be followed easily and are really interesting to implement. Even if you are a beginner and just started learning Arduino-based projects, following these tutorials will be easy. All of the below Arduino-based projects are well-explained step by step, with detailed tutorials on how to get started from scratch.

A Kid about to Program Digispark with DigiKeyboard Commands

DigiSpark as HID Keyboard – Complete DigiKeyboard Commands Explained

Digispark HID Keyboard functionality fully explained with step by step tutorial, examples and complete DigiKeyboard…
Read More
Building a Smart Home using Arduino UNO

Building a Home Automation using Arduino and Arduino IOT Cloud | Arduino IOT Projects

Build your very own home automation system using an Arduino Board, Arduino IoT Cloud, and…
Read More
Arduino UNO R4 Minina Specifications and Pin Mapping

We Have the New Arduino UNO R4 Minima | Everything You Need to Know

Everything you need to know about Arduino UNO R4 Minima – Specifications, Release Date, Projects…
Read More

Let’s Use Arduino To Take Charge Of The Bittle| Petoi Bittle The Arduino Programmable Robot

Hey, guys welcome back. How about making a DIY Arduino robot dog? What if the…

Read More

DIY Motion Triggered Halloween Prop using Arduino/Digispark | Halloween Project 2022

DIY Motion Sensor Trigger for your Halloween Prop – Complete Step by Step Instructions to…
Read More

Control your Home Devices using Arduino and your Favorite Personal Assistant!

Introduction In the previous video, we build an Alexa-controlled Door Locking System. So many people…

Read More

Give me more Awesome Projects!


Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *