I have a datalogger project with an Arduino Nano Every, and the Arduinos work great and stable.
The problem is, now I have to build 40-80 of these loggers.
And every one creates its own unique virtual COM port.
It quickly gets quite messy in the device manager.
How does Windows distinguish between all those Everys?
Is there a serial number in the SAMD11 firmware?
Is there a way to equalize the Everys?
So that every Every is recognized as a single (common) Every and NOT as a unique Every?
I think you could add an unique ID in each Every code and than write a custom software for PC side, that wil request that ID from the board while connecting.
The other option is to change USB descriptors of the boards, make them unique. But in any way you will need a custom PC soft to distinguish one board from the other.
I don't think you can connect all those COM ports, not only because I don't even know if Windows (are we talking about that?) can actually handle them, but above all because I find it difficult to have such a "web" of USB cables (are all these Arduinos close to the PC?). So, not knowing what so many Arduinos are for, I think the best solution would be to create WiFi connections instead of USB cables.
For example, using the small and inexpensive Wemos D1 mini instead of the Every, they would all send data to the PC (for example, via UDP packets, in which, among other things, you can encode the device ID followed by the data).
I don't know if you still have time to change this in your project (out of curiosity, which one is it?)
@b707
The goal is, that the users (students) don’t have to install a custom software on their devices na d that the individual Arduinos should NOT be recognized as different devices.
I think you misunderstood me.
The 40-80 loggers WONT be connected all at the same time.
They will be connected one after the other.
plug in one logger
check it’s status
plug out
walk to the next logger
repeat
So it would be handy, if each logger (one after another) would use the same virtual COM port as the others.
Those loggers will distributed in the field, hidden underground, running on batteries.
(I managed to reduce the idle current to 4.5µA and with idle times between 99.8% and 99.95%)
So running WiFi wont work because any form of radio communication eats battery life…fast!
I could set up a Lora WAN network, which would need a local base station, which itself would probably be stolen within a week.
Also Lora WAN is much more complicated to implement than a COM port and an off the shelf terminal program.
The problem is solved very simply: select one port and assign it to the first device. When connecting to another device, the port number will change, but you assign it the selected port again, and this must be done with all 80 devices. The USB connection port on the computer must be the same. The problem also occurs with other devices, for example, the STM32F401.
I would have thought that if you are buying a relatively large number number of Arduino boards, you might qualify for support from Arduino or the seller.
Doesn't Arduino sell educational packs of multiple units? The problem must have cropped up before.
How do other educational establishments, assuming it's a school or college, tackle it?
Is there a possibility to prevent this on from the Arduino side?
Just because I don’t want to assign 80 COM port for EACH students device for EACH year.
The focus of the field course should be
"The use of decentralized low-cost data loggers in environmental sciences"
and not
"How do I assign the same COM port to different USB devices?"
Please provide a detailed description of what exactly is being done to check the status.
I ask for this information because is is possible that the best solution will be to adjust that system to be able to handle arbitrary port numbers.
In that context, there is no problem to tackle. The user simply selects the serial port produced by the board from the menu in Arduino IDE/Arduino Cloud Editor/etc. In that usage, it doesn't matter if the operating system happens to assign the device COM2 or COM22, the process is the same regardless.
The Arduino used is an Arduino Nano Every.
Ordered as a six pack via Digikey.
Every time I plugged in a virgin Nano Every it was recognized as a new device and a new, unique virtual COM port was created. (COM16 as example)
Serial communication (via an off the shelf terminal prog) and programming is only possible with that unique COM port. (COM16)
When this (now used) Nano Every was plugged in again later (on the same computer) it will be recognized as the same COM16 as before.
I use the Arduino IDE 2.3.5 on one computer and IDE 2.3.6 on another.
The behavior (each individual Nano Every creates it’s own unique COM port) was observed on three different computers with six Arduino Nano Every from a single Multipack.
I have never used an Every, but the COM port for any other Arduino or WeMos D1 I have worked on depends on the specific USB port I plugged the board into, not the specific board it is connected to.
In any case, if this is the behavior you experience with Every, as far as I know Windows has a maximum limit of 256 COM ports that can be defined, so you could have 40-80 cards defined and get the job done.
To return to your request, I don't know how the assigned COM port can be somehow changed programmatically on the Windows side, so the PC program used to collect the data could simply scan the current COM ports: "enumerate" the available COM ports and simply implement a small protocol to ask the connected board to send its "ID" (e.g. send the string "I?" to which the board responds with "In" where "n" is a byte with its ID, but of course it all depends on the current protocol, to be extended only with a similar command).
The goal is to prevent to having a special, custom made PC program.
The loggers are configured and managed by simple terminal programs (which usually don’t support 256 COM ports themselves)
The users(students) will have many different devices with many different operating systems. (laptops, i-Books, cellphones, tablets etc.) I won't be able to provide custom made software for each platform.
I even wouldn’t be able to create a custom program for my computers (Win10&Win 11) because I’m not a PC programmer.
Yeah, and my question was:
Is there a method to modify my Arduino Nano Everys in a way that Windows think that all the Everys I use are the same board.
You should create a custom program and use that instead of the "off the shelf terminal prog". This custom program will automatically identify which serial port is the Nano Every.
You can create the program in whatever language you prefer. If you don't have a specific preference, I would suggest Python, since this is well suited for quickly and easily creating this type of application.
As an alternative, I would suggest writing it in Go. One of Arduino's lead developers created a nice Go module for working with serial ports:
This is the first time you mentioned programming. Are you programming the boards in bulk? If so, I recommend using the AVRDUDE programming tool directly. This is the same tool Arduino IDE uses to upload sketches to the board.
In addition to being more efficient, using AVRDUDE will solve the problem of needing to specify the port number when uploading. The reason is that a very useful feature has been added AVRDUDE version 7.3, which allows you to specify the USB VID/PID pair of the port instead of the serial port number. All Nano Every boards produce the same VID/PID pair, so this means the same avrdude command will work for each flashing operation.
To identify the port of the Nano Every, you will use the --port usb:0x2341:0x0058 flag in your avrdude command instead of the flag like -PCOM16 that is used by Arduino IDE.
If the USB to serial chip is not known to avrdude, it can be specified using the hexadecimal USB vendor ID, hexadecimal product ID [...] e.g., usb:0x2341:0x0043
You must also add the --reconnect flag to the command, which will put the Nano Every board into the "boot mode" that allows uploads. Reference:
Opens the serial port at 1200 baud and immediately closes it, waits 400 ms for each -r on the command line and then establishes communication with the programmer. This is commonly known as a "1200 bps touch", and is used to trigger programming mode for certain boards like Arduino Leonardo, Arduino Micro/Pro Micro and the Arduino Nano Every.
I'll provide instructions you can follow to do that:
A. Install AVRDUDE
You already have an installation of AVRDUDE on your computer, which is used by Arduino IDE. However, the version of AVRDUDE used by the "Arduino megaAVR Boards" platform that adds support for the Nano Every to Arduino IDE is 6.3.0, whereas the features we need were added in AVRDUDE version 7.3. So the copy of AVRDUDE you already have will not be suitable for this application. For this reason, you must install a more recent version of AVRDUDE.
Click the "avrdude-v8.1-windows-mingw-x64.zip" link under the "Assets" section of the page.
Your web browser will start a download.
Extract the downloaded file to any convenient location on your computer.
B. Compile Sketch Binary
When you perform an upload using Arduino IDE, it compiles your sketch code into a program binary file. It is that binary file that is actually written to the Nano Every board.
AVRDUDE is a tool for writing binary program files to microcontrollers. Unlike Arduino IDE, it doesn't have any capability to compile source code. So you must produce the binary file in preparation to use it with AVRDUDE. This is actually a good system when you are uploading the same program to many boards because you only need to perform the compilation process a single time, instead of having to unnecessarily repeat it for each board.
Open your sketch in Arduino IDE.
Select Sketch > Export Compiled Binary from the Arduino IDE menus.
Arduino IDE will start a compilation.
Wait for the compilation to finish successfully.
Select Sketch > Show Sketch Folder from the Arduino IDE menus.
The sketch's folder will open in Windows File Explorer.
Navigate to the build\arduino.megaavr.nona4809 subfolder of the sketch folder.
Right click on the file with the name that has the following format:
<sketch name>.ino.hex
(where <sketch name> is the name of the sketch e.g., MySketch.ino.bin)
Select "Copy as path" from the context menu that opened.
Navigate to the folder where you installed AVRDUDE.
In the folder listing of the Arduino IDE installation folder, hold the Shift key while clicking the right hand button on the mouse.
A context menu will open
Select "Open PowerShell window here" from the menu.
Windows PowerShell will now open with the current directory set to the Arduino IDE installation folder.
Connect the Nano Every board to your computer with a USB cable.
Type the following command in the PowerShell window:
$Env:SKETCH_BINARY_PATH=<binary path>
Replace the <binary path> placeholder in the command with the path of the sketch binary you copied at step 7 of the "B. Compile Sketch Binary" procedure above.
Press the Enter key.
Paste the following command in the PowerShell window:
The sketch program binary should now be uploaded to the Nano Every board that is connected to your computer.
To program additional boards, you only need to disconnect the current board from the computer, connect the new board, then run the command from step 9 again. You don't need to repeat any of the other instructions. You can repeat the previous command in PowerShell by pressing the ↑, then the Enter key.
The whole goal is NOT to create a custom program.
Because there are too many user(students) involved with too many different platforms to support.
Me having to learn PC/Mac/IOS/Android etc. programming would negate any benefits in using an established, commonly used platform like Arduino.
The programming part is not the issue here, I program one, clean up the unused ports, and program the next one.
This is a one time task. No problem here.
The problem is that the users have to change the used COM port in their chosen Terminal program for each time they plug in the next Arduino.