Arduino Nano and ESP32 pins: which one to use for each part
Which pins to avoid on the Arduino Nano and the ESP32, where to connect servos, joysticks, the ultrasonic sensor and the buzzer, and the reasoning behind each choice in the suggested wiring table for the robot arm.

In the block coding IDE, every card asks which pin the part is wired to. That freedom is a good thing, but not every pin works for everything. This article lists what to avoid on each board and explains the wiring table we suggest for the robot arm.
Arduino Nano: what to avoid
- D0 and D1. They're the serial port connected to USB. Using them interferes with uploading the program and with the serial monitor.
- A6 and A7 as digital pins. These two only read analog. They work for a joystick axis, not for a button or a servo.
- D13 as an input. The onboard LED is connected to it and pulls the reading. As an output, it's fine.
And two library side effects:
- The Servo library disables PWM (analogWrite) on pins 9 and 10. Servos still work on any pin, including those two.
- The tone() function interferes with PWM on pins 3 and 11 while it plays.
ESP32: what to avoid
The numbers below apply to the classic ESP32 with the WROOM-32 module, the one on the most common DevKit boards.
- GPIO 6 to 11. They're connected to the flash memory. Using them crashes the board.
- GPIO 34 to 39. Input only, with no internal pull-up. Good for a joystick, useless for a servo, a buzzer or a button without an external resistor.
- Boot pins: 0, 2, 5, 12 and 15. Their level at power-up decides how the board starts. Pin 12 in particular sets the flash voltage: if it's pulled high at boot, the board may not start.
- ADC2 with Wi-Fi. The ADC2 pins (0, 2, 4, 12 to 15 and 25 to 27) can't read analog while Wi-Fi is on. For analog readings, use ADC1: GPIO 32 to 39.
- GPIO 1 and 3. They're the USB serial port, like D0 and D1 on the Nano.
On variants such as the ESP32-S3 the list is different. The IDE shows only the valid pins for the board you choose.
The suggested table, explained
| Part | Nano | ESP32 |
|---|---|---|
| Base servo | D3 | GPIO 13 |
| Shoulder servo | D5 | GPIO 25 |
| Elbow servo | D6 | GPIO 26 |
| Gripper servo | D9 | GPIO 27 |
| Joystick 1 (X, Y, button) | A0, A1, D2 | GPIO 32, 33, 21 |
| Joystick 2 (X, Y, button) | A2, A3, D4 | GPIO 34, 35, 22 |
| Ultrasonic (Trig, Echo) | D7, D8 | GPIO 18, 19 |
| Buzzer | D10 | GPIO 23 |
Servos. On the Nano, any digital pin would do; the ones chosen sit together on the header. On the ESP32, GPIO 13, 25, 26 and 27 are ordinary outputs, away from the boot pins. The fact that 25 to 27 belong to ADC2 doesn't matter: a servo doesn't read analog.
Joysticks. On the Nano, the axes go to A0 through A3, and the buttons to D2 and D4, with the internal pull-up. On the ESP32, the four axes go to ADC1 (32 to 35), which reads with Wi-Fi on, and the buttons go to 21 and 22, which have an internal pull-up. GPIO 34 and 35 have no pull-up, which is why they get the axes.
Ultrasonic. Two ordinary digital pins. On the ESP32, Echo goes through a voltage divider (1 kΩ and 2 kΩ), because the module outputs 5 V.
Buzzer. On the Nano, tone() works on any digital pin, and D10 is the one left free next to the others. On the ESP32, GPIO 23 is an output with no restrictions.
Three rules for any board
- Common GND. The servo power supply, the board and the sensors share the same GND.
- Pin voltage. On the ESP32, never feed 5 V into a pin.
- Write down the wiring. A photo of the build next to the table saves hours of searching.
To see the table alongside the IDE, open the block coding IDE page.