Using A Second (Software) Serial USB To Debug Your Arduino

For my upcoming project, I wanted to connect my Arduino to a computer and use the serial port, yet somehow debug the code. Obviously, if the serial port was in use, trying to fit in Print() statements would be a bit awkward – so I needed an alternative way to communicate.

For a while, I was wondering if connecting a second Arduino would be the key, or if I’d need a Mega (which has 4 serial ports). But after some research, I found out the Arduino can have more than one serial connection (USB) to a computer, if you used some sort of hardware convertor, and if you used a serial software library to manage the second terminal.

So, after asking around the Arduino forum, I found out that a USB to TTL serial convertor was the name of what I wanted. But there’s various flavors:

  • The Nokia CA-42 cable was popular and cheap, but suffered from timing issues according to one person, and some may (or may not) be incompatible with 5.0v.
  • Another choice was one with the PL2303 chip in it, but being the same chip as was used in the CA-42, it might or might not be a 3.3v version (note that apparently a 5v chip works fine with the 3.3v; it’s the 3.3v versions that can’t play safely with the bigger kids).
  • In the end, the CP2102 chips seemed to be the safest for voltage, so I ordered one off of eBay for under $5.

When it arrived, I took one look and thought “very small” – but despite that, it did the job admirably. Here’s how I got mine to work:

  • First off, I ignored the Arduino. I plugged in the device to a USB port all alone. Windows had no trouble finding a driver online for it, and hooked mine up straight away, connecting me to COM port 6 with my new device.
  • Then, I unplugged and wired up the device by connecting the TXD and RXD pins together. This created what is called a loopback, so whatever is sent out here was ‘looped back’ to the terminal sending it – useful for checking if things are working. Then, I plugged it back in.
  • Because I’m running Windows 7 64bit, I did not have Hyperterminal installed, and didn’t feel like getting it (according to an online search, my choices were: buy a copy, copy it from an XP install, or downloading the last free version – v6.3 – from what looked like some dodgy download sites). So, a little more research, and I found an open source one, Realterm, which was reviewed quite favorably for working with hardware devices.
  • Downloaded it, installed it (twice, as I had to uninstall and install again, since the ActiveX libraries in the install didn’t set up properly the first time around), ran it, and then looked it over. Out of the box it’s just about ready for Arduino work, except: 1) the setting ‘half duplex’ should be on (checkbox in the ‘Display’ tab), and 2) you need to select the port (the ‘Port’ tab – don’t forget to click on the ‘Change’ button after to save it!).

From there, you can do a basic test: as you type, everything is doubled up:

II  ssaaiidd,,  aass  yyoouu  ttyyppee,, eevveerryytthhiinngg  
iiss  ddoouubblleedd  uupp

That’s half duplex – echoing things back to you, and proof the device is receiving.

At this point, you know you’re talking to those two joined pins – now it’s time to talk to the Arduino…

2 thoughts on “Using A Second (Software) Serial USB To Debug Your Arduino

  1. I realise this is an old article but I found it useful. Realtearm and the Arduino library has been updated in recent years.
    I can send from Realterm and it is received in the Arduino Serial window but not the other way around.
    With your settings of half duplex and Realterm as it is today I don’t get the text duplicated in Realterm, just the text I type. I have tried changing the pin settings and anything else I can think of but nothing helps. Any ideas?

  2. I have found a workaround but it’s not ideal. I have COM 5 and COM6. 5 is normally the Arduino USB and 6 is normally the Serial USB attached to my laptop. I have to use the full COM5 port on the Arduino to upload the sketch (although I do know there are other ways like and I do have a USBasp etc). Once I have uploaded the sketch I can change to COM6 and use COM5 in Realterm. With this set up I can send from the Arduino to Realterm. Ideally I want send and receive but I will see if I can work with just send or receive at time.