Sub topic 6
Selecting your board
This chapter covers the Tools > Board setting in the Arduino IDE: what it controls, how to set it, and what goes wrong when it doesn't match your hardware. It assumes you have installed the IDE and know your way around its main areas. If your board needs an extra package, for example an ESP32 or a Nano Every, install it with the Boards Manager first (the previous chapter). You don't need to have chosen a serial port yet. That is the next chapter.
Why the board setting matters
A sketch is C++ source text. The computer you write it on is not the computer that runs it. Before the code can run on your Arduino, the IDE has to turn it into machine instructions for the microcontroller's processor. Different boards use different processors, so one source file needs different output for each.
The board you select tells the IDE four things:
- Which compiler toolchain to use. An Uno uses an 8-bit AVR chip (ATmega328P). An Uno R4 uses a 32-bit Arm Cortex-M4 chip. The IDE calls a different compiler for each.
- Which core to build against. A core is the layer of code that implements functions such as
digitalWrite()anddelay()for a given chip family. The same function names work on every board, but the code behind them differs. - Which pin definitions to use. Names such as
LED_BUILTINandA0map to different physical pins on different boards. These come from a "variant" file that belongs to the board. - How to upload. Each board has an upload tool, a protocol, a speed, and memory limits (flash size and RAM size).
The board setting therefore changes the build. It does not change how the IDE finds the board over USB. That is the job of the port setting.
Naming: boards, cores, and packages
Three terms appear in the IDE and in documentation, and they are easy to mix up.
| Term | Meaning | Example |
|---|---|---|
| Board | One specific product or variant you pick from the menu | Arduino Uno |
| Core | The code that implements the Arduino functions for one chip family | `arduino:avr` |
| Board package | The installable bundle that contains a core, toolchain, and a list of boards | Arduino AVR Boards |
The Arduino AVR Boards package ships with the IDE, so the Uno, Nano, Mega 2560, Leonardo, and Mini are available straight away. Newer boards such as the Uno R4, Nano 33 BLE, and Nano ESP32 come in other packages. If a board is missing from the menu, its package is not installed.
Selecting the board
The Arduino IDE 2.x has two ways to select a board. Both set the same value.
Method 1: the board selector in the toolbar
- Connect your board over USB.
- Click the drop-down in the toolbar, next to the Verify and Upload buttons. It shows the currently selected board and port, or "Select Board" if none is chosen.
- If the IDE has detected your board, it appears in the list with its port. Click that entry. This sets the board and the port in one step.
- If your board is not listed, choose Select other board and port.... Type part of the board name in the search box, click the match, then pick a port from the list on the right and click OK.
Method 2: the Tools menu
- Open Tools > Board.
- Open the group for your board family, for example Arduino AVR Boards.
- Click the exact board name, for example Arduino Uno.
On Arduino IDE 1.8.x, only the Tools menu method exists.
Confirm the selection
The selected board is shown in the toolbar selector. It is also shown at the bottom right of the window in the status bar. Check it before every first upload on a new project, especially if you work with more than one kind of board. The IDE remembers the board you used last, not the board that is plugged in now.
Reading your board's name
Look at the printed text on the PCB (the circuit board) itself. Official boards print the model name, for example "Arduino UNO R3" or "ARDUINO NANO". Match it against the menu as follows:
- Uno R3 (the common 2012-era board with a large removable chip): select Arduino Uno, from the AVR Boards package.
- Uno R4 Minima or Uno R4 WiFi: select the matching entry under Arduino UNO R4 Boards. The R4 is not the same as the R3, and the R3 setting will not build correctly for it.
- Nano (classic): select Arduino Nano. This one has an extra setting, described next.
- Mega 2560: select Arduino Mega or Mega 2560. This also has a processor setting.
- Clones and third-party boards: these usually follow the design of an official board. A board sold as an "Uno clone" generally works with Arduino Uno. Boards with other processors, such as ESP32 or ESP8266 boards, need the package from their maker and a specific entry from it.
Extra options under Tools
Some boards have more than one hardware variant under one menu name. When that happens, extra items appear in the Tools menu, below Board. They are set per board and the IDE remembers them.
| Board | Extra option | Why it matters |
|---|---|---|
| Arduino Nano (classic) | Processor: ATmega328P or ATmega328P (Old Bootloader) | Older Nano boards and many clones use a bootloader that uploads at a different speed. The wrong choice fails with a sync error. |
| Arduino Mega or Mega 2560 | Processor: ATmega2560 or ATmega1280 | The two chips have different memory sizes. |
| ESP32 boards | Partition scheme, upload speed, flash size | Controls how flash memory is divided and how fast the upload runs. |
If you chose the right board but uploads fail with "not in sync", the processor option is one of the first things to check. The Nano is the common case: switch to ATmega328P (Old Bootloader) and try again.
Seeing what the selection did
The board setting shows up in the build output. Open File > Preferences and tick Show verbose output during: compilation to see more. Then press Verify with a sketch open. The output includes the name of the compiler for the chosen core and the board's identifier, called the fully qualified board name (FQBN).
The FQBN has the form vendor:architecture:board. Some boards also append options.
| FQBN | Board |
|---|---|
| `arduino:avr:uno` | Arduino Uno |
| `arduino:avr:nano:cpu=atmega328old` | Arduino Nano, old bootloader |
| `arduino:renesas_uno:unor4wifi` | Arduino Uno R4 WiFi |
The same string is used by the Arduino command-line tool. If you later automate builds, you pass it with arduino-cli compile --fqbn arduino:avr:uno.
To see how the board setting changes a build, try this small sketch. It prints the board's flash and RAM information indirectly, by using macros the core defines for the selected board.
void setup() {
Serial.begin(9600);
while (!Serial) {
; // Wait for the serial connection on boards with native USB
}
#if defined(ARDUINO_AVR_UNO)
Serial.println("Built for: Arduino Uno");
#elif defined(ARDUINO_AVR_NANO)
Serial.println("Built for: Arduino Nano");
#elif defined(ARDUINO_UNOR4_WIFI)
Serial.println("Built for: Arduino Uno R4 WiFi");
#elif defined(ARDUINO_UNOR4_MINIMA)
Serial.println("Built for: Arduino Uno R4 Minima");
#else
Serial.println("Built for: another board");
#endif
Serial.print("LED_BUILTIN is pin ");
Serial.println(LED_BUILTIN);
Serial.print("sizeof(int) is ");
Serial.println(sizeof(int));
}
void loop() {
}Each ARDUINO_... name is defined by the compiler flags the selected board supplies. The line sizeof(int) prints 2 on an Uno (an 8-bit chip) and 4 on an Uno R4 (a 32-bit chip). The same source gives different results because the board setting changed the compiler. You will use the Serial Monitor to read this output in a later chapter, so you can come back and run this sketch then.
What happens when the board is wrong
A wrong board choice does not damage the hardware. The usual outcomes are errors or a program that misbehaves, and they depend on how far apart the two boards are.
| Mismatch | Typical result |
|---|---|
| Board from a package that is not installed | The board is missing from the menu. Install the package. |
| Different architecture (for example Uno selected, R4 connected) | Upload fails, often with a protocol error or a message that the device is not responding. |
| Same architecture, different board (for example Mega selected, Uno connected) | The sketch may compile and upload, but pins and memory limits differ, so behaviour can be wrong. |
| Wrong Nano bootloader option | Upload fails with `avrdude: stk500_getsync(): not in sync`. |
| Sketch uses a feature the selected board lacks | Compile error, for example a function or library marked as unsupported for this architecture. |
Working with several boards
When you switch between boards, the board and port settings stay with the IDE, not with the sketch. Opening a sketch does not change them. A reasonable routine is:
- Plug in the board you intend to use.
- Look at the toolbar selector and confirm the name and port.
- If you have more than one board connected, make sure the selected port belongs to the board you chose.
- Press Verify. A build that compiles for the wrong board will often fail early, and that failure is a useful signal.
Verify compiles only. It does not touch the hardware, so you can run it as many times as you like while you check the setting.
Summary of the key points
- The board setting selects the toolchain, core, pin names, and upload method for the build.
- Board packages provide boards. Install the package first if your board is not listed.
- Match the name printed on the board, and check extra options such as the Nano processor.
- The board setting and the port setting are separate. Both must be right for an upload to work.
Exercise
You connect a classic Arduino Nano clone. The IDE shows Board: Arduino Nano. Uploading fails with "avrdude: stk500_getsync(): not in sync: resp=0x00". The USB cable works and the port is listed. What setting do you change first, and why?
Show answer
Change Tools > Processor to "ATmega328P (Old Bootloader)". Many Nano clones and older Nano boards ship with a bootloader that communicates at a different speed than the one the default option expects. The upload tool cannot synchronise with the bootloader at the wrong speed, which produces the "not in sync" error. The board name, cable, and port are already correct, so the processor option is the most likely cause.
Exercise
A sketch compiled for "Arduino Uno" prints sizeof(int) as 2. After you switch the board to "Arduino UNO R4 Minima" and rebuild, it prints 4. What explains the difference?
Show answer
The Uno uses an 8-bit AVR processor, where int is 16 bits (2 bytes). The Uno R4 uses a 32-bit Arm processor, where int is 32 bits (4 bytes). Selecting a different board makes the IDE use a different compiler and core for a different architecture, so the same source produces different type sizes.