Terms of service
Brokking
 
 
.net
Let's keep it simple
 

 
   Home
   Projects
 

   Articles
 

   Donation
         
 
 
 
 

 
Brokking.net - Video: JB-Serial Monitor - the advanced serial monitor tool

JB-Serial Monitor - the advanced serial monitor tool

Hello and welcome to another one of my videos.

When you are working with Arduino you probably used this button allot. It opens the serial monitor that helps you to check the serial output of your program. Or it can help you to find any bugs your program.

The working of the serial monitor is very simple. When a byte is received via the serial port of your computer it will print the corresponding ASCII character of the byte value.

As you can see, the serial monitor of the Arduino Beta version 2.0 does not yet have the same font size as the main program. So for this video I will use the Arduino version 1.8.

This ASCII table shows the various values and the corresponding characters. So basically any received byte with a decimal value between 33 and 126 will display a readable character.

As you can see here the decimal value of the character ‘a’ is 97.

If I now write a very simple program and type Serial.write(97), the Arduino will send a single byte with the decimal value of 97.

For practical reasons I will add a 1 second delay and upload the program.

And as expected the serial monitor displays all a’s.

Now let’s also have a quick look at the oscilloscope that I connected to the TX output of the Arduino.

In short, it all works as expected.

However sometimes I run into problems when I need to handle some non ASCII characters.

So let’s have a look at this simple program. It writes the raw counter byte value to the serial port and increments the counter variable during every loop.

When I upload this program and open the serial monitor I will get an output that looks like this. Not very useful. Now I could change Serial write to Serial print and add DEC to it. This way I can at least check if the counter variable increments correctly.

Let’s upload the new program and check the serial output.

Ok now the output is readable. However, what is send via the serial port is not the actual counter value but a character representation of it. And when the value reaches 10 it will actually send 2 bytes instead of the desired one byte. And three bytes when the value reaches 100.

Despite the fact that this is a very simple example it clearly shows the limitations of the serial monitor. Anything that is not a printable ASCII character will result in a small square.

First let me restore the example program so it uses Serial.write again.

To solve this problem I started working on my own serial monitor that has -at least for me- some useful extra functions. Now without a doubt there are other serial monitors available on the internet that will do the same as my own program, but for me it was the challenge to build my own serial monitor.

This will also make it possible to share it with my viewers for free. So if you are interested in using this program I will put a link in the description.

Ok, let’s start the JB-Serial monitor and go to the setup tab. here I can select the correct settings for the serial port. Like speed....... number of data bits...... stop bits...... and finally parity. For my own projects these are the parameters that I must be able to change.

I can also set the default directory for the log files. But more on that later.

So let’s get over to the Data tab and press connect. When selected normal, the output is the same as with the Arduino serial monitor. But if I select decimal it shows the decimal representation of the received byte.

Ok, let’s clear data the field for now.

So, every second a byte is received. When I go to the setup tab I can enter an inactivity time after witch an new line and carriage return is automatically generated. For this example I will set it to 500 milliseconds and select activate.

Now every byte is automatically written on a new line. This way I don’t have to figure out what bytes are part of the last transmission.

And I can do the same for the binary output.

And also for the Hexadecimal output.

When I want to save this information to a file I can set the desired log file directory in the setup tab. Check the direct save checkbox and click the start log button.

The program will now store all the data in the data tab to a file that is date and time identified. When the indicator is red it means it is still writing the data to the file. This might happen when you have a lot of received data.

When I uncheck the direct save checkbox I can manual set a name for the log file.

Ok, this makes sense so far. Now let’s take an USB to serial converter and create a TX to RX feedback.

Again I can select the correct com port, the desired baud rate an click connect.

When I now go to the send tab I can select the desired input method. So let’s choose binary. Here you can see an example of the input format.

I will now create a line from one to five in binary format.

And on the data tab I will set the received data to decimal.

Let’s click connect and click the send button. In the data tab you can see the decimal value of one till five. So the data is correctly received.

Another function is the send every milliseconds line. This will make it possible to send the input with a set interval. For example, if I select 1 second and click activate the data is send every second.

And to get every output on a single line I can simply activate the NL CR function like this.

So for me this serial monitor has some useful features that I use form my own project. If you want to try it out you can download it for free on my website. Al always I’ll put a link in the description.

I also added an update function that informs you if a new version is available. This is the first version and I might update it in the future. If you don’t like the update check you can simply uncheck the “check for updates” checkbox and it is completely disabled.

So that’s it for now. Please let me know in the comment’s below if there is anything that you would like me to add to this program. Maybe I will add it in the future.

And that’s it for this video. Thank you for watching and don’t forget to hit the like button if you think the JB-Serial Monitor program is useful.