This is my first Arduino project. The project objective is to remotely monitor the water flow in the irrigation system at my home. I intend to develop the project in 2 phases.
The first phase will be to display the results to a hard wired LED for the purpose of verifying the operation of the monitoring system.
The second phase consists of replacing the LED display with a WiFi module and uploading the output in a continuous stream to a TBD website.
I am now requesting a critique of the hardware setup and the sketch for Phase 1. I have already run the sketch through the Arduino ‘sanity’ verification.
The hardware consists of the following:
External power cable for Uno
Geniten Hall-effect water flow sensor
Diymall 4-pin .96 two-color oled display
Connections are as follows:
Jumpers from Uno to a 5V bus and to a 3.3V bus
Sensor power connecttion to 5V bus
Sensor data connect to Uno pin D2
Display power connect to 3.3V bus
Display SDA connect to Uno pin A4
Display SCL connect to Uno pin A5
Measures the flow rate of water flowing through a 3/4-inch PVC pipe using a DIGITEN Hall effect sensor and displaying results on a 0.96-inch Diymall 4-pin Oled display.
The sensor output is in the form of the duration in milliseconds of a square wave pulse and the relationship to the water flowrate is:
F = 4.8 * Q ( in liters per minute)
int pin = 2;
unsigned long duration;
#define OLED_RESET 4
//initialize with the I2C addr 0x3C (128x64)
// clear the display before start
duration = pulseIn(pin, HIGH);
//Pulse duration in microseconds
dursec = duration / 1000000;
//Pulse duration in seconds
pulsefreq = 1 / dursec;
//Pulse frequency in Hz
flolitr = (pulsefreq * 60 / 4.8);
//Flow rate in Liters/hour
flogal = flolitr * .26417;
//Flow rate in Gallons/hour
flocuft = flolitr * .035315;
//Flow rate in cu ft/hour
//size of the text
//print “Gal/hr” in oled
// Wait one second