I recently found an interesting use of the many Arduino boards that I have. You can use your Arduino board as a bridge to connect serial devices to the computer, without even writing a sketch. How cool is that? 😉
Before I tell you how you can do it, let me explain about virtual COM ports and how Arduino uses them.
Virtual COM ports
The ATmega328 microcontroller used in the Arduino board supports UART TTL (5V) serial communication. You can connect the microcontroller to the serial port in your computer (with appropriate logic level converters) and can interface with it.
But these days, most computers don’t have a serial port. So the Arduino team when they designed the board, placed another IC to channel this serial communication over USB. In pre-UNO boards this is handled by the FTDI FT232RL IC and in UNO it is handled by ATmega8U2 IC. In your computer, you will have to install corresponding drivers and the device will appear as the virtual COM port.
Holding the processor in RESET mode
The serial to USB(TTL) IC (either FTDI FT232RL or ATmega8U2) is connected to Arduino pins 0 and 1. If we hold the processor in RESET mode, then all its GPIO pins will me in tri-state, effectively removing it from the circuit and you can directly interface the serial to USB IC with your device.
To hold the processor in RESET mode, just connect the RESET pin (which is active-low) with the ground. This will hold the processor in RESET mode.
Interfacing the serial device
Now you can connect the serial device to the Arduino pins 0 and 1. You should however note that the Rx pin (pin 0) goes to the Rx of the device and Tx pin (pin 1) goes to the Tx of the device and not the other way around.
In your computer the device will appear as a Virtual COM port. You can connect to it using programs like screen or hyper terminal.
I didn’t had a serial device handy with me, so I used a another Arduino as a serial device to test this. I wrote a small sketch which was printing something in the Serial every few seconds and then when I opened the virtual COM port using screen, I was able to see its output.
This is a neat trick and might be useful if you have to interface some serial device like a GPS or a Bluetooth module with your computer.
Happy hacking 🙂
Pingback: Use Arduino as an ISP programmer to program non-Arduino AVR microcontrollersHardware Fun | Hardware Fun
Where is the rest of the write-up? Huh?
Not sure what you mean by “rest of the write-up”. Can you let you know specifically what you are looking for?
Appreciate your article.
Im currently trying to connect my atmega32 chip to hyperterminal using the arduino as a usb to ttl converter.Could you guide me as to how to go about doing this.
You completely forgot the “PC” part in the title!
wow, this is brilliant, thank you! Nice trick with the reset pin.
I have a separate ATmega 16 MCU and an Arduino UNO. Can i run a program in my atmega16 and print the values, so that i can see them using arduino’s serial monitor.
Thanks in advance 🙂
You should be able to do it.
Try it out and let me know if you are facing any issues with it.
have you done that, if yes please share it here.
If the Atmega 16 has Arduino bootloader, you can program it(google for how to).
Once done, you can use Software Serial libraries and connect the pins(TX and RX) from the IC to the assigned pins used in the library for TX and RX. and finally view the output from the arduino board’s usb serial.
it goes like this: atmega16- -> Software Serial –>Arduino board –>USB Serial–> Serial monior
Hi there, great work!
How do you configure the baud rate of the serial to USB(TTL) IC which you mentioned is either FTDI FT232RL or ATmega8U2?
My serial device runs on a 500000 baud rate. I need to set up with the serial to USB IC. do you have any idea
Never mind. It seems that software on the PC will set it up. I thought that I need to configure the chip first.
Do you plan on releasing the sketch to the public?
There is no sketch associated with this. So I am not sure which sketch you are referring to.
Nevermind, apparently I didn’t read your post.
Pingback: Using Arduino UNO as a Bridge to Program Another Arduino Board – focusofascatteredmind
I was stumped as to how to wire the DTR pin of the chip I wanted to interface with to the Arduino, since the reset pin was obviously already shorted to GND.
In the end I simply removed the Atmega from my Arduino board and connected the DTR pin to the Arduinos reset pin and it worked perfectly!
Thanks for the article, this is a much nicer solution than using soft serial!
Just wanted to say thanks!
I had been struggling to get my Wemos D1 mini to act as a bridge; the trick being RST -> G!
Hey, I used your method to connect to my router(WR841N) via serial using a arduino as a usb to serial converter. I can see the output from Device but I haven’t been able to send any input to the device.
I have wrote my problem in detail in this post, https://www.reddit.com/r/openwrt/comments/7trfiy/help_with_tplink_wr841nd/
Is there something I am doing wrong?
I just wanted to come here to say this post helped me hack (or modify my approach) to communicate with a satellite radio! I love how simple this solution is and how effective it is!