As I was doing some debugging in the serial console with my Arduino Uno R3, something occurred to me… The serial console is absolutely invaluable for debugging, yet in my first Arduino post (Getting started with Arduino) I did not even mention it at all.
If you’re using the Arduino Uno or Duemilanove for example, the serial console is fairly straight forward as you just use the same USB cable you use to program with. These boards differ from the Pro Mini as they already have a Serial to USB converter on board.
However, when working with the much more affordable Pro Mini, there is no built in Serial to USB, so things get a little more interesting.
First things first, lets create a simple sketch that will setup the serial console with Arduino, and send a message to the serial console
//Set the baud rate to 9600 for communication
//Send a message to the serial console
Serial.println("Hello, this is a message!");
//Wait for a few seconds so the console isnt overloaded
Next, you’ll need to get your hands on a couple of things.
- USB to TTL Adapter
- Set of 4 female to female “dupont” cables
Both of these can be found on eBay for dirt cheap if you don’t already have them.
The Arduino as well as the USB adapter should have their pin out silk screened on to their boards, and should look like this
Depending on which Pro Mini you have, you’ll want to wire them together using the correct voltage (3.3v or 5.0v are both available on the USB TTL adapter). In my case I have a 5v Arduino Pro Mini, so I will tie VCC to 5.0v, and GND to GND. If you have the 3.3v version of the Pro Mini, then you need to tie VCC with 3.3v instead. The data wires need to “cross-over”, so the RX connects to TX, and TX to RX. This way, when the Arduino is transmitting the USB TTL adapter is receiving, and vise versa. All said and done, you should have something that looks like this.
Still with me? Awesome! Now plug everything in and upload your sketch to your Arduino using your USBasp programmer, (hopefully you’re using Codebender) select your com port/speed and click “Open Serial Monitor”. With any amount of luck, you should see some text printing in your serial console!