Sub topic 4
Connecting your board over USB
This chapter covers the physical and electrical link between your computer and an Arduino board. It assumes you can install software on your operating system and that you already know what a microcontroller board is. You should also have the Arduino IDE installed. Selecting the board and port in the IDE comes in the next two chapters. Here the goal is to get the computer to see the board at all.
What the USB connection does
One USB cable does three jobs for a typical Uno-class board:
- Power. The USB port supplies 5 V, which powers the board and any light loads on it.
- Programming. The IDE sends your compiled program to the board through the cable.
- Serial communication. While your sketch runs, it can exchange text and bytes with the computer over the same cable.
The computer does not talk to the main microcontroller directly on every board. Many boards have a second chip that converts USB signals into the serial signals the microcontroller understands. Which chip your board has decides which driver your computer needs and how the board shows up in the port list.
Know which USB interface your board has
Boards fall into three common groups.
| Group | Examples | USB handling | What the OS sees |
|---|---|---|---|
| Separate USB-to-serial chip | Uno R3 (ATmega16U2), Mega 2560, many clones (CH340, CP2102, FT232) | A helper chip converts USB to serial | A virtual serial port from the helper chip's driver |
| Native USB on the main chip | Leonardo, Micro, Zero, Nano 33 IoT, Uno R4 | The microcontroller speaks USB itself | A virtual serial port created by the sketch or bootloader |
| Dedicated USB-serial adapter | Pro Mini with an external FTDI adapter | You supply the adapter | A virtual serial port from the adapter |
The difference matters in two ways:
- Boards with a separate chip keep a stable port even when your sketch crashes, because the helper chip stays alive.
- Native USB boards present their port from the running program. If a sketch stops USB from working, the port can disappear. A bootloader mode, covered below, brings it back.
You can find your board's type in its documentation. On clones, look at the small chip near the USB connector. A marking such as CH340 or CP2102 tells you which driver you may need.
Choose a cable that carries data
The most common cause of "my board does not show up" is a cable that carries power only. These cables are often packed with batteries, fans, and LED strips. They charge devices but have no data wires.
Check the cable before you spend time on drivers:
- Try the cable with a phone or another device that transfers files. If the computer does not see that device, the cable has no data lines.
- Prefer a short cable from a known source. Long, thin cables can drop voltage and cause random disconnects.
- Match the connector to your board. An Uno R3 uses USB-B, a Nano uses Mini-USB or Micro-USB depending on the version, and many newer boards use USB-C.
Plug in and read the signs
Connect the board directly to a USB port on the computer. Hubs are fine once everything works, but an unpowered hub can starve a board and make it reset repeatedly.
Then check these signs:
- The power LED. Most boards have an LED labeled ON or PWR. It should light as soon as the cable is connected. If it does not, the board is not receiving power.
- The built-in LED. A new Uno often runs a factory Blink sketch, so the LED marked L may flash. This shows that the microcontroller is running, but it says nothing about the data connection.
- The TX and RX LEDs. These flicker when data moves over the serial link. You will see them blink during an upload.
Drivers by operating system
A driver is software that lets the operating system talk to a particular piece of hardware. The Arduino IDE installer includes drivers for official boards on Windows. On macOS and Linux, official boards usually work without extra steps.
Windows
Official boards install automatically when you accept the driver prompts during the IDE installation. Windows then lists the board under Ports (COM & LPT) in Device Manager, with a name such as Arduino Uno (COM3).
Clone boards that use a CH340 or CP2102 chip may show up as an unknown device with a yellow warning icon. Install the driver from the chip vendor, then reconnect the board.
macOS
Official boards work with the drivers built into the system. The port appears as /dev/cu.usbmodemXXXX for native or ATmega16U2 boards. Boards with other chips appear as /dev/cu.usbserial-XXXX or /dev/cu.wchusbserialXXXX. Third-party chips such as CH340 may need a vendor driver. On recent macOS versions, a driver can require approval under System Settings > Privacy & Security before it loads.
Linux
The kernel includes drivers for most chips. Two things commonly go wrong:
- The port appears as
/dev/ttyACM0or/dev/ttyUSB0, and your user account lacks permission to open it. - A background service, such as the modem manager, briefly grabs the port and interferes with uploads.
The permission fix is to add your user to the group that owns the device. On Debian and Ubuntu that group is dialout. On Arch it is uucp.
sudo usermod -a -G dialout $USERLog out and back in for the change to take effect. A reboot also works.
Confirm that the computer sees the board
Check at the operating system level first. If the OS does not see the board, the IDE cannot either.
- Windows: Open Device Manager and expand Ports (COM & LPT). Unplug and replug the board and watch an entry appear and disappear.
- macOS: Run
ls /dev/cu.*in a terminal before and after plugging in the board. The new entry is your board. - Linux: Run
ls /dev/ttyACM* /dev/ttyUSB*ordmesg | tailright after plugging in. The kernel log names the device and any error.
The before-and-after comparison is the most reliable method, because it identifies the board by what changed.
Bootloader mode and the reset button
A bootloader is a small program stored on the board that receives new sketches over the cable and writes them to memory. The IDE normally starts it by toggling a reset signal automatically.
On boards with separate USB chips, this happens without your help. On native USB boards, the IDE asks the running sketch to reset the board, which requires the sketch to still be working. If a sketch has hung or disabled USB, that request fails and the port may vanish.
The fix is to enter bootloader mode by hand. On many boards you double-tap the reset button quickly. The board then shows a new port for a few seconds, and often a pulsing LED. Start the upload while that port is available. The exact gesture differs between boards, so check your board's documentation.
Power considerations
USB ports provide a limited current. A standard USB 2.0 port supplies up to 500 mA, and the board itself uses a small part of that. Problems appear when you attach motors, servos, or long LED strips to the 5 V pin and draw more than the port can give. Symptoms include the board resetting, the port disappearing, or the computer showing a "device has exceeded power limits" message.
During setup you have no external parts attached, so this does not matter yet. Later, power high-current loads from a separate supply and connect the grounds together.
Also avoid powering the board from USB and another source such as a barrel jack at the same time unless you know your board's power circuit handles it. Official Uno boards switch sources automatically. Some clones and other boards do not.
Common problems at this stage
| Symptom | Likely cause | What to do |
|---|---|---|
| No power LED | Bad cable, dead port, or damaged board | Try another cable and port |
| Power LED on, no new port in the OS | Charge-only cable | Swap in a confirmed data cable |
| Unknown device on Windows | Missing driver for a clone chip | Install the chip vendor's driver |
| Port exists, but permission is denied on Linux | User not in the serial group | Add yourself to `dialout` or `uucp`, then log in again |
| Port disappears and reappears | Loose connector or weak hub | Plug in directly and reseat the cable |
| Native USB board has no port after a faulty sketch | Sketch disabled USB | Double-tap reset to enter bootloader mode |
Putting it together
Follow this sequence whenever you connect a board:
- Pick a cable you know carries data.
- Plug the board directly into the computer.
- Check that the power LED lights.
- Compare the OS port list before and after plugging in.
- If no new port appears, change the cable, then the port, then install a driver.
- Only after the OS sees the board, move on to the IDE settings.
This order separates hardware faults from software settings. Most upload failures that look like IDE problems turn out to be cable or driver problems.
Exercise
You plug in an Uno clone. The power LED lights, but Device Manager shows no new entry under Ports and no unknown device appears when you unplug and replug. What is the most likely cause, and what should you do first?
Show answer
The most likely cause is a charge-only USB cable that has no data wires. The power LED lights because power flows over the cable, but the computer receives no data signal, so nothing is detected. Replace the cable with one you know carries data, such as one that transfers files from a phone. Drivers are the next thing to check, but a missing driver normally produces an unknown device entry, which you did not see.
Exercise
On Linux, ls /dev/ttyACM* shows /dev/ttyACM0 after you plug in an Uno, but the IDE reports a permission error when you upload. What command fixes this on Ubuntu, and what must you do afterward?
Show answer
Run sudo usermod -a -G dialout $USER to add your user to the group that owns the serial device. Then log out and back in, or reboot, so that your session picks up the new group membership.
Exercise
A Leonardo stops showing a port after you upload a sketch that misuses the USB code. How can you recover it?
Show answer
Native USB boards create their port from the running sketch, so a faulty sketch can remove it. Double-tap the reset button to enter bootloader mode. The board then exposes a port for a few seconds. Select that port and start an upload of a working sketch during that window.