Here is the guy with the Swiss accent again
In some of my videos I mentioned, that I used Putty for debugging of my Arduino or ESP projects.
Some viewers asked how this is done. This is the reason for this short video.
We all are aware of the very useful Serial Monitor function of our Arduino IDE.
It helps us during debugging by printing some messages or values on the screen.
For most cases this is sufficient.
The Serial Monitor connects through the USB cable to a chip on all Arduinos
These chips transform the USB to serial signals.
These chips are always connected to RX and TX, or RX0 and TX0 pins.
Sometimes you need an additional serial connection
and sometimes you also want to monitor the second serial connection.
For these situations I'll show you how this can be done.
Let us assume, that we want to connect a GPS module to an Arduino or an ESP
If you use an Arduino Mega, this is absolutely no problem,
because the Mega has 4 serial connections, you connect the GPS module to Serial1
Like that you still can use your Serial Monitor on Serial0 or Serial.
If you want to use a Uno, we only have 1 serial connection available.
Fortunately we have a possibility to create a so-called SoftwareSerial on two other pins using already available library.
Now, we can connect the GPS to the SoftwareSerial and we have the same situation as with the Mega.
Just pay attention, SoftwareSerial is only rated up to a speed of 57600 bps.
What do we have to do, if we want to monitor these connections in parallel:
We can use a simple USB to Serial adapter.
sometimes called FTDI adapters.
These devices come in different shapes and sizes and have the same function as the chip on the Arduinos.
If you use one of these, the most important decision is the voltage.
If your processor board is 3.3V, as the ESP8266 or some of the newer Arduino boards,
you need an adapter which is capable to provide this voltage.
A 5V adapter can destroy your microcontroller.
This is only important if you want to connect the RX pin of your microcontroller.
These FTDI adapters are also connected via a USB cable to your PC.
To connect them to your microcontroller, you connect the RX pin to the TX pin and vice-versa.
In addition, you have to connect ground.
In most of the cases, we only want to use this adapter to monitor and not to enter data -
then, we can omit one connection.
But how can we see what happens on the second serial connection.
Serial Monitor is only capable to show use one line
and usually we keep it on Serial, because the upload is also done through this connection.
So we need a second Serial Monitor.
For that purpose, I usually use PuTTY, because it is simple and free.
You can download it from putty.org and it does not need to be installed -
just click on the file and you'll see this window.
I will not explain the different possibilites of this tool.
There are other videos which do that.
I just concentrate on debugging Arduinos or ESPs.
Let's now return to the USB to Serial adapter.
If we connect it the first time to our PC,
it installs its driver and we find the connection in Device Manager under Ports (COM & LPT).
Pay attention, if you already have connected an Arduino or a NodeMCU board connected to your computer.
Then you find this connection also in Device Manager and you have to find out which is which.
This can be done by disconnecting and reconnecting one of the two devices.
Now we know our port, which is COM[number].
Attention! This port can change even with the same adapter,
if you reconnect it or if you boot your computer,
so always check before you start.
For our purpose, we only need to choose Serial connection and enter the COM port number from before.
Speed 9600 is usually okay for monitoring.
If we press "Connect", we get a new window.
Now, we can go on to our Arduino or ESP board and write a small sketch.
Because the ESP boards are slightly different, I used a NodeMCU board for my demonstration.
The ESP8266 modules have 2 serial connections.
Serial1, however, only has one usable pin.
Fortunately, this is the TX1 pin.
So, we do need SoftwareSerial if we only want to monitor.
On the NodeMCU board TX1 is on D4 and we connect D4 to RX of the USB to Serial connector.
The sketch is very simple, we print "Hello World" to Serial and Serial1.
To do that, we have to begin both of serials in our setup.
The speeds have to match the respective monitor, but can be different.
And here we are - we see the messages on both channels.
You even can two USB to Serial adapters, if you need to monitor two traffic directions.
This could be the case for a Nextion display,
where you see then the command from the display and the answer of the Arduino.
I hope this video was useful or at least interesting for you. Bye!