Skip to content

Arduino Tip – Better Serial Debug

NanoOnBBWithAdapterFTDI Here you see the same photo from my review of the Nano. In that post I mention talking about the adapter board in the upper right of the picture later.. This is later…

By keeping a separate dedicated Debug serial connection you avoid the pain of having to keep closing and reopening your Debug terminal. Other benefits include having a VT100 Style terminal so you can build a nice view on your application. Controlling text color, X/Y position, flashing etc..

In the picture above you see the Arduino Nano connected to USB as you would normally have it.  This is fine but we can do a lot better.  The serial terminal built into the IDE is convenient  but closes each time you program. You have to reopen it to see your data.

I prefer to use Putty or other terminal application for Debug data. Putty and other have VT100 emulation so you can position text, color it etc.. Of course you can use Putty now, just open it on the serial port of the Arduino. But you have to remember to close the terminal program before you program. The programming process will fail and you might have to restart both the IDE and the terminal program to recover. Once the port is open in one program, it’s not available in the other.

The solution is to hood up a dedicated serial port for debugging. I connect a second serial interface, using an FTDI cable to the TX line of my Arduino. This interface does not go away when I program, it’s always there. I use Putty as the serial terminal which has the nice VT100 style emulation so I can use those features in debugging.

One limitation with this method is that you should not directly connect the TXD from the FTDI to the RXD, serial input, of the Arduino as that would interfere with programming over USB. It’s fine to listen to the serial traffic during programming, but the TX out from the FTDI will collide with the TX out from the USB interface.  You do see a bunch of trash on the terminal during programming so you might want to put in a clear screen code in your opening serial connection to clear that.  Nice that you can with the VT100 features.

If you are using a bigger Arduino chip like a Due you can use a separate serial port for TX and RX data, or you might try a software serial option…

So back to the adapter shown.. This is just a shortcut adapter I made to make it easy to connect my debug serial to the bread board. The adapter features a connection to the standard FTDI serial cable at top, and plugs into the breadboard along the pins on the Nano where TX and RX 0 are. It makes it easy for me to move between projects and provides a solid connection.

The PCB is one of my solderless breadboard proto adapterssolderless breadboard proto adapters I made to sell though Curious Inventor a few years ago. Nothing really ever happened with that but I may start selling it and the other adapters at Tindie someday. I have more of these then I could ever use here in my shop so  I could sell.

Posted in Arduino, Development Tools, Hacks, Ideas, Microcontroller, Parts, Projects, Tips, Workshop Tips.