Example Code for Potentiometer-Manual Control
Last revision 2026/01/08
This article offers a detailed guide on manually controlling devices with a potentiometer, including hardware setup, wiring instructions, and example code, making it an indispensable resource for DIY electronics enthusiasts.
Hardware Preparation
- Gravity Potentiometer module or potentiometer element with wires soldered.
- PWM driver board (DRI0050)
- Motor or LED strip
- Screwdriver
- Power source(Voltage: 5~24V, power>2A Select the suitable power according to the devcie you used)
Wiring Diagram
- Gravity Potentiometer Module: Use Gravity 3PIN sensor cable to connect (pay attention to wire order).
- Potentiometer Element: Solder wires, connect middle pin (wiper) to port "A", other pins to power/ground. Dial switch to Analog IN side.

The diagram on the left is the connection for potentiometer element. You have to solder wires for the potentiometer first and then attach the wires to the binding post. The right diagram shows how to connect a real potentiometer to the driver board. Normally the middle pin of a potentiometer is the wiper that gives us the variable of resistance value, and should be connected to port "A". Find the right wiper on your potentiometer before connecting.
Available potentiometer vlaue: 4.7K~470K

Was this article helpful?
