PID controller demo
This project is no longer developed. A 2.0 version in collaboration with Bas Pijls and based on a XIAO ESP32-C3 is located here
From PID controller - Wikipedia: A proportional–integral–derivative controller (PID controller or three-term controller) is a control loop mechanism employing feedback that is widely used in industrial control systems and a variety of other applications requiring continuously modulated control. A PID controller continuously calculates an error value e(t) as the difference between a desired setpoint (SP) and a measured process variable (PV) and applies a correction based on proportional, integral, and derivative terms (denoted P, I, and D respectively), hence the name.
This demo device will balance a ping-pong ball in the middle of the see-saw. It uses a distance sensor to measures the distance between the ball and a known location. This results in an error from the desired distance. It uses a servo motor to tip the see-saw to the left or to the right, so gravity will move the ball closer to the desired location.
This repository contains all design files if you plan to build it yourself.
This project started with a side-remark of Saco Heijboer , one of Waag’s FabAcademy 2022 students. He would like to learn more about PID controllers, so I decided to incorporate it into my course material.
$$ f(t) = K_{p} \cdot error_{(t)} $$
$$ f(t) = K_{i} \cdot \int_{0}^{t}error_{(t)},dt $$
$$ f(t) = K_{d} \cdot \frac{derror_{(t)}}{dt} $$
$$ f(t) = K_{p} \cdot error_{(t)} + K_{i} \cdot \int_{0}^{t}error_{(t)}, d t + K_{d} \cdot \frac{derror_{(t)}}{d t} $$
The demo device can be made with all techniques available at a FabAcademy node. Apart from the sensor, also all components are in the stock inventory.
quantity | description | details |
---|---|---|
1 | multiplex 3mm | 300 x 400 mm |
1 | PLA filament | XXX g |
3 | potmeter 10k Ohm | 10 kOhm |
4 | lever switch | STPT |
1 | Arduino | Uno |
1 | Servo motor | MG905 |
1 | Distance sensor | GP2Y0A41SK0F |
2 | jack plug 3.5 mm chassis | 3-way female |
2 | jack plug 3.5 mm | 3-way male |
1 | wire AWG26 red-white-black | 3-way 750 mm |
1 | wire AWG26 red-orange-brown | 3-way 750 mm |
1 | misc. wire | 1 m |
quantity | description | design file | remarks |
---|---|---|---|
1 | Laser-cut cabinet | http | |
2 | guide rails | http | |
1 | endstop w/ sensor | http | |
1 | endstop w/o sensor | http | |
1 | guide hinge | http | |
1 | support hinge | http | |
1 | support | http | |
1 | motor |
The source code can be found here: