You can use the USB to serial adapter which is built into your Arduino without modifying the hardware, cutting traces, adding parts, nor removing chips. Just make a sketch which:
- does nothing at all with the serial port
- pulses a pin low for a few microseconds in the setup function
Like this:
void setup()
{
pinMode(13, OUTPUT);
pinMode(2, OUTPUT);
digitalWrite(2, HIGH); // pulse to send reset
delay(1);
digitalWrite(2, LOW);
delayMicroseconds(8);
digitalWrite(2, HIGH);
}
void loop()
{
digitalWrite(13, LOW);
delay(500);
digitalWrite(13, HIGH);
delay(500);
}
This is a modified blink sketch. It does almost nothing, just shows you a blinking LED so you can tell the Arduino works. It does nothing with the serial port. Whenever it is restarted, it pulses pin 2 low for a few microseconds.
Upload this sketch to your Arduino via the menu File, Upload Using Programmer. This will remove the bootloader when it uploads the sketch. You can always put the bootloader back at some point later if you want it. There are numerous good articles on the web regarding using another Arduino as an ISP programmer, or if you have a dedicated ISP programmer, use it. You want to remove the bootloader in order to keep the Arduino from trying to bootload or otherwise do anything with the serial pins when it is reset.
Once the sketch is loaded on your Arduino, it becomes a USB to serial adapter or serial programmer with automatic reset, ready for you to enjoy. Connect the serial programmer to the target Arduino or chip:
- TX on serial programmer to TX on target Arduino or chip
- RX on serial programmer to RX on target Arduino or chip
- 5V on serial programmer to 5V on target Arduino or chip
- GND on serial programmer to GND on target Arduino or chip
- Pin 2 on serial programmer to RST on target Arduino or chip
Select the target Arduino or chip in the menu Tools, Board.
Select the serial programmer's USB port in the menu Tools, Port.
Write and upload a sketch. The RX and TX LEDs will flicker on your serial programmer, but what is actually being programmed is the target Arduino or chip.
Notes:
- The target Arduino or chip must have a serial bootloader on it in order to accept sketches using a serial programmer. If you don't have a bootloader on it, you will need to burn a bootloader on it with an ISP programmer first.
- In the procedure above I am telling you to connect TX to TX and connect RX to RX. This may seem contrary to what you know about serial, but don't worry. Think about it and look at the UNO or other Arduino board schematics. The TX pin of the USB to serial adapter chip (CH340G, ATmega8U2, FT232RL, or whatever), is the RX pin on the Arduino, and the RX pin of the USB chip is the TX pin of the Arduino.
- I just used this method to turn an Arduino Nano into a serial programmer and then I programmed an Arduino Pro Mini.
- A Leonardo or Pro Micro or other ATmega32U4-based Arduino can't be used as a serial programmer using this method because it doesn't have a separate USB-to-serial adapter on-board. To use one of those boards, see: Using the Leonardo as USB to serial converter. | PeterVH