September 2017
Intermediate to advanced
206 pages
4h 34m
English
Now we can change our PID controller simulation using a real application. We use soil moisture to decide whether to pump water. The output of the measurement is used as feedback input for the PID controller.
If the PID output is a positive value, then we turn on the watering system. Otherwise, we stop it. This may not be a good approach but is a good way to show how PID controllers work. Soil moisture data is obtained from the Arduino through a wireless network.
Let's write this program:
import matplotlib matplotlib.use('Agg') import PID import time import matplotlib.pyplot as plt import numpy as np from scipy.interpolate import spline P = 1.4 I = 1 D = 0.001 pid = PID.PID(P, I, D) pid.SetPoint ...Read now
Unlock full access