Required Hardware
- Raspberry Pi 4
- Servo motors (2)
- Jumper wires
- External power supply
Connecting the Servos to the Raspberry Pi 4
For this project, you’ll only need two servo motors and some type of controller. In this case, I decided to connect the servo motors directly to a Raspberry Pi 4. I chose a Pi because it has built-in Wi-Fi connectivity and natively supports the software that I’ll explain in the next section.
Here’s the wiring diagram:

The wiring diagram for a Pi 4 and two servo motors.
As you can see, the wiring is quite simple. You only need to connect the control line of each servo to a GPIO pin that supports hardware PWM (GPIO12 and GPIO13 in this case).
Furthermore, the GND lines need to be tied together. The servos should be powered by an external supply because the Raspberry Pi might not be able to deliver enough current.
The Software Side
The bulk of the work for this build takes place on the software side. The software, running on the Raspberry Pi, does three things:
- Provides a website that you can visit on any modern smartphone
- Handles incoming HTTP requests
- Communicates with the servo motors
The website reads the sensor value of the device and periodically sends the updated data to the Python script.
You could also write a smartphone app that reads the sensor values and transmits them directly to the Raspberry Pi — for example, via Bluetooth. However, I think the solution we’re using is elegant and sufficient for this task. This way, you don’t have to install any software on your smartphone, and this solution is also platform-independent too.