Sub topic 4
Connecting Your Board Over USB
Prerequisites: You should have the Arduino IDE installed, a supported Arduino board such as an Uno, and a USB cable that carries data. You should also know that a program is a list of instructions that a computer can send to a device.
USB connects the Arduino board to your computer in two useful ways:
- It supplies power to the board.
- It carries data between the board and the computer.
The data connection lets the Arduino IDE send a compiled sketch to the board. It can also carry messages from the board to the computer for the Serial Monitor.
Choose the correct USB cable
A USB cable can provide power without carrying data. A charge-only cable may light the board's power indicator, but the IDE will not see a usable connection through it.
Use a cable that is known to transfer data. The connector depends on your board:
- Many Uno boards use USB-B, the larger square connector.
- Some newer boards use Micro-USB or USB-C.
- Some boards use a USB connector built into the board and do not need a separate USB-to-serial adapter.
Do not force a connector. The plug should fit easily and sit firmly.
Connect the board
- Close any application that might already be using the board's serial connection.
- Connect the USB cable to the board.
- Connect the other end directly to the computer when possible.
- Wait a few seconds for the operating system to detect the board.
A board's power LED usually turns on when it receives power. That LED only confirms that electricity is reaching the board. It does not prove that the cable carries data or that an upload will work.
Some boards also have a transmit or receive indicator. These LEDs may blink when the IDE communicates with the board, but their behavior varies by board and upload method.
Understand what the computer detects
When detection succeeds, the operating system creates a serial device for the board. The Arduino IDE can use that device to upload sketches and exchange serial text.
The device name differs by operating system and board:
| System | Typical device name |
|---|---|
| Windows | A COM port such as COM3 |
| macOS | A device beginning with `/dev/cu.` |
| Linux | A device such as `/dev/ttyACM0` or `/dev/ttyUSB0` |
The exact name can change when you unplug and reconnect the board or use a different USB socket. Record the board's current port only after the cable is connected. The next step is to select that port in the IDE.
If no new device appears, check the connection in this order:
- Confirm that the power LED is on.
- Try another known-good data cable.
- Try another USB socket.
- Connect without a hub or adapter.
- Close and reopen the Arduino IDE.
- Check whether the board needs a driver or board package.
Some third-party boards use a USB-to-serial chip that may need an operating-system driver. A missing driver can produce power without producing a usable serial device.
Avoid competing connections
Only one program should normally control the board's serial connection at a time. Close another Serial Monitor, terminal program, or debugging tool before uploading. If another program has the port open, the IDE may report that the port is busy or fail to start the upload.
Keep the board connected during later verification and upload steps. If the USB cable is removed during an upload, the transfer can stop and leave the board running its previous sketch or waiting for a new one.
Exercise
The board's power LED turns on, but no new serial device appears. What should you test first?
Show answer
Test with a known-good USB data cable. A charge-only cable can power the board while carrying no data.