Various electronic equipments used in any industry
Program on Demand
1. Importing the Adafruit_MotorShield library which is
necessary for running stepper motors. Creating the motor
objects
https://github.com/adafruit/Adafruit_Motor_Shield_V2_Li
brary/blob/master/Adafruit_MotorShield.h
Defining variables
Starts logging the time, starts sending current to the
switch input and measuring whether current leaves the
switch. Starts the valve closed
2. This is a loop, i.e. the Arduino does this continuously while
the pump is running. It reads the pressure, reads the time,
and checks if enough iterations (1000) have passed for it
to take the running average of its last few pressure reads.
If not it keeps iterating
If enough iterations have passed it takes the running
average, resets its iterator (iter and pressureSum) and
starts deciding what to do.
If the voltage is tiny or negative, the circuit is broken, it
does nothing and notifies the user.
If the sliding switch is closed it does nothing and reports
the closure. Since the switch input is set to Input_Pullup,
HIGH means its closed, and LOW means its open. This
creates resistance to environmental perturbations.
If pressure is far above threshold it opens the valve to
release pressure
If pressure is far below threshold it closes valve and takes
a step
3. Mission accomplished! We’re within tolerance
of the set point! First, close the valve
Occasional steps to make sure flow is
maintained. Otherwise no step
Based on experimental data, maps sensor
voltage outputs to actual pressures (data not
reported here)
Heaviside/Unit Step function. Part of
timekeeping algorithm.