Notifications
Clear all

View serial monitors on two Arduino IDEs simultaneously using ONE computer!

9 Posts
6 Users
7 Likes
2,961 Views
itsCaseyDambit
(@itscaseydambit)
Member
Joined: 4 years ago
Posts: 40
Topic starter  

There's no need to have two computers to view the Serial monitor outputs from two separate UNO boards. You only need to run two separate instances of the Arduino IDE simultaneously, and the problem is solved.

Here's the doc I wrote on the topic...

Forward: If you are familiar with simultaneously running two or more instances of the Arduino IDE to program two or more microcontrollers using two or more COM ports, then save your time and be gone!  This file is not for you; otherwise, smoke ‘em if ya’ got ‘em.  Let’s get smarter…

Objective:  We will use one computer to compile and upload two RadioHead example sketches into two UNO boards using two Arduino IDEs and two COM ports. When we open the serial monitor on each IDE (both IDEs running on one computer and one serial monitor), we can watch two nRF24s passionately chat their little hearts out.  I’ve even compiled and uploaded two sketches simultaneously. It’s easier than it sounds.

REF: DroneBot Workshop video tutorial -

“The nRF24L01 – Wireless Joystick for Arduino Robot Car with nRF24L01,”

image

Purpose: In this video, Bill uses TWO computers to monitor the sketch-serial-outputs from two UNO boards.  In this narrative, I will respectfully attempt to explain how to monitor the sketch-serial-outputs from two UNO boards using two instances of the Arduino IDE on two COM ports, all attaching two UNO boards using two USB cables into one computer.

image

Environment: My laptop is running on a Windows 10 x-64 based platform, but UBUNTU will do this trick, too.  Obviously, two unused USB ports (female plugs) on the computer and two A-B type male/male USB cables are required to plug into the two UNO boards; the OS running on the computer is irrelevant.

We are using two RadioHead example sketch files:

    1) nrf24_reliable_datagram_client.ino   (we will call it -CLIENT)

    2) nrf24_reliable_datagram_server.ino  (we will call it -SERVER)

image

Let’s kick this pig!

This narrative assumes that both RadioHead example sketch files have been downloaded, updated as needed (as per Bill’s instructions on the video), and both sketches have been compiled with no errors, so that they can both be cleanly uploaded into the two UNO boards. Have the Arduino IDE open, and close any open sketches on the IDE other than the -CLIENT sketch.

It is important to perform the upcoming steps in order, and steps cannot be skipped.  You must decide which UNO board will be the client, and which will be the server.  I use the closest UNO board to me (I’m old), and I call it the client. Use one of the two USB cables and plug the client UNO board (#1) into one of the two open USB ports on your computer (I pick the nearest port plug - as said, I’m old).

image

At this stage, we have the computer in serial communication with the client UNO board (#1), and your computer has picked the port number – let’s call it COM3; your computer may call it something different.  Compile and upload the -CLIENT sketch into the client UNO board through COM3, and when finished uploading, unplug the USB cable from the UNO board (see note at bottom later).  I leave the first cable plugged into the computer (but not the UNO board) to remind me which of the two USB ports on the computer is already being used by COM3.

Next, you need to open a NEW INSTANCE (a second copy) of the Arduino IDE.  Go to the toolbar at the bottom of the screen (or wherever your open-program tabs sit), right click the Arduino IDE tab, and left click “Arduino IDE” from the pop-up menu.  You should now have two instances of the Arduino IDE running, and this is where things can get a little tricky (and, I won’t be screaming, just emphasizing a point).

image

When the second Arduino IDE opens, the sketch that opens with the second IDE JUST MIGHT BE THE SAME SKETCH that is open in the first IDE, or it may be some other sketch.  We need to open the -SERVER sketch with the second IDE, and IMMEDIATELY AFTER opening the -SERVER sketch with the second IDE, CLOSE WHATEVER SKETCH INITIALLY OPENED with the second IDE, always leaving the first IDE alone.  If the second IDE opened with the -SERVER sketch, GREAT!  Leave things as-is. 

We now have two instances of the Arduino IDE open; the first IDE with the -CLIENT sketch, and the second IDE with the -SERVER sketch - there should be no other sketches open.  This is where understanding which IDE is communicating on which COM port becomes REALLY IMPORTANT.

image

Now, using the second USB cable, plug the server UNO board (#2) into the second USB port on the computer.  The computer has picked the port number – let’s call it COM4; your computer may call it something different.  Before you compile and upload the -SERVER sketch, be certain the correct COM port is being used by the second Arduino IDE.

From the top of the screen on the second IDE, click Tools/Port and select COM4.  Compile and upload the -SERVER sketch into the server UNO board (#2) through COM4.  Leave the USB cable attached.

image

Provided that everything went well, plug the first USB cable back into the client UNO board (#1).  Once the first cable is reattached, go to the first IDE, click Tools/Port and select COM3 (if it’s not already on COM3). All that is left to do is open the serial monitor on each of the IDEs!

image

We now have the -CLIENT and -SERVER sketches each running on their own instance of the Arduino IDE.  If each of the sketches communicates with the serial monitor on the computer, we’ve accomplished our mission.  If the nRF24 modules are not communicating with one another, that’s the next step in troubleshooting, and that’s on you to fix, oh mighty coder!

image

I hope this little chat has helped you in some manner to better understand the COM port connections from your computer to the UNO boards you are programming.  It is as easy as running two IDEs to view two serial monitors using two COM ports on one laptop…simple.

Take care!

No animals were harmed in the making of this file.

Note: from my experiences, if the first USB cable is left connected to the client UNO board (#1) AFTER the -CLIENT sketch has been uploaded, serial communication between the client UNO board and the IDE’s serial monitor have begun on COM3 and will continue.

Sometimes, on the FIRST attempt ONLY, when I try to upload the -SERVER sketch into the server UNO board (#2) on COM4 while there is chatting on COM3, the upload will fail, and avr-dude locks up while it’s running repetitive attempts to upload the sketch.

Things can get ugly, and the IDE might lock up, which means a computer reboot may be needed.  I think that this is caused by the chat on COM3 with the IDE the first time around.  YOUR computer, OS, or IDE may not have an issue with this problem. It’s a craps shoot. Good luck.  Meanwhile…

I’ve found it useful to simply disconnect COM3 the FIRST time I’m uploading the -SERVER sketch through COM4.  After the -SERVER sketch is successfully uploaded through COM4, I reconnect COM3, and everything works fine.

Compile and upload sketches to two UNOs using two IDEs with two COM ports on one computer.  Open the serial monitors on each IDE with one IDE on COM3 and the other IDE on COM4, and you can watch the two nRF24s chat.  As I said, I’ve even compiled and uploaded two sketches simultaneously.

One more thing: if you are running two IDEs simultaneously, and both IDEs are editing the same sketch, the IDEs aren’t going to like that idea (it’s a bad idea to begin with).

Please do not prolong having two copies of the same sketch open in two separate IDE editors.  Especially do not “save” the same sketch from two separate IDE editors.  Bad idea.  Bad, bad, bad.  Bad.

Enjoy!


   
Inst-Tech reacted
Quote
(@starnovice)
Member
Joined: 5 years ago
Posts: 110
 

I have 2 nano boards and the problem with them is that they both insist on using the same COM port,  If one is already plugged in I get a message that the COM port is busy.  I can run a Mega and a nano with no problem.

Pat Wicker (Portland, OR, USA)


   
ReplyQuote
itsCaseyDambit
(@itscaseydambit)
Member
Joined: 4 years ago
Posts: 40
Topic starter  

@starnovice

Hmmm. Are you running two IDEs simultaneously? One for each nano? I wouldn't think there would be a problem choosing a COM port to communicate with a microcontroller.

I know so little about your nano situation that I will only be pitching spitballs, but, could it be there's a bootloader burned into the nano that's directing the actions to go to the one (and only) COM port?

Best of luck on that one. Please do let me know of any answers you find, being as I have a bunch of nanos just aching to be toyed with.


   
Inst-Tech reacted
ReplyQuote
(@starnovice)
Member
Joined: 5 years ago
Posts: 110
 

@itscaseydambit Yeah two separate IDE's.  But even before I start an IDE the device manager shows that they are both trying to use the same COM port.

Pat Wicker (Portland, OR, USA)


   
ReplyQuote
itsCaseyDambit
(@itscaseydambit)
Member
Joined: 4 years ago
Posts: 40
Topic starter  

Device manager...such an ugly term.

I hate things that control things that I would prefer to control - except I'm too involved with learning other stuff right now to go into the device-manager level of MS. Some day, it will probably be necessary; meanwhile...lol. 🧐 


   
ReplyQuote
Don
 Don
(@donpk)
Member
Joined: 2 years ago
Posts: 22
 

@starnovice I've been using an alternative to the standard Arduino IDE. It's called Programino V2. It's much more configurable and has many more features than the Arduino IDE, including its V2. Among those features is the capability of using two separate Serial Monitors in a single instance of the IDE. I find this particularly useful when working with two different transceiver boards. I have transmitter in one serial monitor and the receiver in the other monitor. No need for two different instances of the IDE

The screenshot shows Programino with two Serial Monitors open. At the bottom of each Serial Monitor you can see two different Arduino boards on two difference serial ports with two different baud rates. One little feature I like is the "always on top" option on each monitor so if you click on either monitor, the other doesn't disappear.

 

Programino Screenshot   Two Serial Monitors

   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2504
 

@donpk 

Thanks for letting us know about this alternative.

Too bad it's for Windows only 🙁

Anything seems possible when you don't know what you're talking about.


   
huckOhio and Inst-Tech reacted
ReplyQuote
(@yurkshirelad)
Member
Joined: 3 years ago
Posts: 493
 
Posted by: @starnovice

I have 2 nano boards and the problem with them is that they both insist on using the same COM port,  If one is already plugged in I get a message that the COM port is busy.  I can run a Mega and a nano with no problem.

I wonder is this is because you're not running 2 separate instances of the IDE. There's There's subtle difference, which has caused me similar problems in the past. You might have two IDE windows open, but if they're in the same instance, they'll share configuration (I.e. COM port).


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6662
 

@donpk Sounds interesting, any plans to support the *nix community (RasPi, Apple OSX, Linux)

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote