Notifications
Clear all

Arduino Uno com ports

21 Posts
6 Users
0 Likes
4,567 Views
(@dorsay)
Member
Joined: 4 years ago
Posts: 57
Topic starter  

As a newbie to Arduinos, this is driving me round the bend!

I have 2 Arduino Unos, 1 is from a recognised supplier - Elegoo, the other is unbranded.  The Elegoo unit uses com port 3 and 9600 baud.  The unbranded unit uses com port 5 and 115200 baud,  I need them to both be the same, probably com port 3 and 9600 baud.  I'm sure there will an easy answer to this but I can't find it.  Can anyone advise, please?

Thanks

David

David


   
Quote
(@notrum1)
Member
Joined: 4 years ago
Posts: 3
 

what are you plugging your Arduino in to because it that which defines the com port not the Arduinos


   
ReplyQuote
(@dorsay)
Member
Joined: 4 years ago
Posts: 57
Topic starter  

@notrum1

It's the same computer every time. Because they're slightly different boards, I'm making sure that the sketch I've written runs on both boards because I need 2 board to do the task I'm attempting.

David


   
ReplyQuote
(@zeferby)
Member
Joined: 5 years ago
Posts: 355
 

@dorsay

The USB-to-Serial interface chip of your Arduinos are recognised as being different USB peripherals by your computer(OS), so it assigns a different COM port for each.

Eric


   
ReplyQuote
(@dorsay)
Member
Joined: 4 years ago
Posts: 57
Topic starter  

Found it!  Stupid me!  Because the unbranded board wanted to play at 115200, I changed the Serial.begin(9600) to 115200.  Then I fixed that issue and forgot to change it back.  This getting older is a PITA! lol

David


   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@dorsay

Posted by: @dorsay

The Elegoo unit uses com port 3 and 9600 baud.  The unbranded unit uses com port 5 and 115200 baud,  I need them to both be the same

You change the Arduino baud rate to suit in your sketch, and the serial monitor also allows you to change it to suit the sketch and COM port.  You can also change the hardware port directly via Device Manager properties if for example running windows.


   
ReplyQuote
(@dorsay)
Member
Joined: 4 years ago
Posts: 57
Topic starter  

Thanks Eric.  Once I've loaded the sketch on to both boards, I don't need the computer.  They'll get their power from a 9-12v supply.

David


   
ReplyQuote
(@dorsay)
Member
Joined: 4 years ago
Posts: 57
Topic starter  

@frogandtoad

I've seen how you can change the baud rate via the Serial.begin command(?) but are you saying that there's a way to specify in a sketch which com port to use?

David


   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@dorsay

Posted by: @dorsay

I've seen how you can change the baud rate via the Serial.begin command(?) but are you saying that there's a way to specify in a sketch which com port to use?

No, sorry, that's not what I meant.... I was talking about the Serial.begin(9600); command for example, and that in the serial monitor, you can match the baud rate to suit your setting - I should have been more clear.  In the hardware settings under device manager however, you can set the default baud rate of the port too.

Cheers!


   
ReplyQuote
codecage
(@codecage)
Member Admin
Joined: 5 years ago
Posts: 1037
 

@dorsay

Have you gotten the answer you need?

The USB/COM port that your computer uses to talk to the Arduino is totally a function of the computer.  It is not controller by the Arduino at all.  From what I'm gathering from the posts I've read you have two different brand Arduinos that when you plug them in, using the same USB port, you get a different COM port for each Arduino.  This is normal, even if the two are the same brand!  The USB port on the computer receives some information from the USB port on the Arduino and then assigns a COM port to that device.  When you then plug in a different Arduino the computer is going to see 'different' information and will generally assign a different COM port.  What you should see though, is if you just switch back and forth between the two Arduinos is that the assigned ports will remain the same for each Arduino.  Now that can change later down the road depending on what other USB devices have been plugged into your computer.  I hope that is clearer than mud at least! ? 

And if there is no computer connected to the Arduino once you have it programmed and debugged then there is no need to be concerned about the serial port at all.  You just want to be sure you don't have any code that might be waiting on input from the serial port as it will never see it.

SteveG


   
ReplyQuote
(@dorsay)
Member
Joined: 4 years ago
Posts: 57
Topic starter  

@codecage

Yes thanks, I got the answer I needed.  And your explanation is very clear.  I wasn't aware that the computer would assign a different COM port if the units being attached were the same thing but when I saw that happening, I thought - ok.  But the assignment of different bauds rates by the computer was another thing.  I never thought to look for that.

Yes, once programmed and debugged, there will be no computer involved.

Thanks again.

David

 

David


   
ReplyQuote
(@dorsay)
Member
Joined: 4 years ago
Posts: 57
Topic starter  

@codecage

Can you answer another question on this subject?  I've just received 2 new Uno's and these are different to the previous ones.  I understand that when plugging a different Uno into the PC via the USB  the PC will allocated a different Com port as it sees a different device.  But when I try to upload a sketch, it fails telling me that it can't find Com3.  The sketch was originally saved when Com3 was in use.  The new Uno has been allocated Com5.  But why does the sketch want to use a specific Com port?  The sketch in question is the Blink example.

Thanks

David


   
ReplyQuote
(@dorsay)
Member
Joined: 4 years ago
Posts: 57
Topic starter  

@codecage

Of course, now that I've asked the question, the thing works!  I uploaded the Bare Minimum sketch and it loaded.  So I went back to the Blink sketch and it loaded.  What is going on?  I think that'll be a rhetorical question.

David


   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@dorsay

Posted by: @dorsay

I understand that when plugging a different Uno into the PC via the USB  the PC will allocated a different Com port as it sees a different device.  But when I try to upload a sketch, it fails telling me that it can't find Com3. 

Have you selected the appropriate communications port within the Arduino IDE?

image

   
ReplyQuote
(@dorsay)
Member
Joined: 4 years ago
Posts: 57
Topic starter  

@frogandtoad

I only have one so there's no choice available.  Thanks

David


   
ReplyQuote
Page 1 / 2