Projectile Launcher

Final Wiring

The mechanical build is done and the science is covered. Before we upload the final code, we need to connect all three servos to the NodeMCU. Each servo has a specific job and a specific pin.

There are two parts to wiring: power (keeping the servos fed) and data (telling each servo what to do).

Pin Reference

D1

Pan Servo

GPIO 5

Controls left-right aiming

D2

Tilt Servo

GPIO 4

Controls up-down angle

D5

Fire Servo

GPIO 14

Pulls the trigger mechanism

// In the final code, these map to:
const int PAN_PIN  = 5;  // D1 - GPIO 5
const int TILT_PIN = 4;  // D2 - GPIO 4
const int FIRE_PIN = 14; // D5 - GPIO 14
1

Power Wiring

First, connect the power (red) and ground (black) wires from each servo to the breadboard power rails. All three servos share the same 5V supply from the NodeMCU.

Red wire = Power (5V)  •  Black wire = Ground (GND)
Power wiring diagram showing all three servo power and ground connections to the NodeMCU breadboard
2

Data Wiring

Now connect the signal (data) wire from each servo to its designated pin on the NodeMCU. These are the wires that carry the PWM signals telling each servo where to move.

Blue wire to D1 (Pan)
Yellow wire to D2 (Tilt)
Green wire to D5 (Fire)
Data wiring diagram showing Pan servo to D1, Tilt servo to D2, and Fire servo to D5 signal connections

Warning

Double-check every connection before powering on. A misplaced wire can send the wrong signal to the wrong servo, or worse, short the board.