Introduction: Smart Pump Controller
The Smart Pump Controller was designed to help manage the life of the pump and fill the water tanks through autonomous operation managed by an Arduino nano at its heart. The Blue-tooth module allows for remote monitoring and control of various settings of the pump. During drought or summer seasons, it may be possible to adjust the run time of the pump and stop intervals so there is ample time for water to rise at the source such as in bore-wells and draw out water at intervals. This also ensures that the pump will not work for more than specified time period so as to avoid burnouts and overheating of pump. The smart pump controller allows all these parameters to be adjusted and monitored remotely using Blue-tooth. The tanks are connected in parallel and one of the tanks will have the ultrasonic sensor mounted on the cap so as to ensure that the water is pumped to a specified depth, and stops the pump once it is full. This ensures that the water does not get wasted or keep running such as when connected to a standard timer device alone.
- Arduino Nano
- Ultrasonic Sensor
- 1 Channel Relay
- Blue-tooth Module (HC-05/06)
- Resistors for voltage divider (1k & 2k ohm).
- Power source (I use an additional UPS to counter power outages and unpredictable voltage fluctuations)
- Ribbon cable/4 wire cable(Measure the distance from tank to the pump room or fixed weather resistant enclosure for keeping the controller unit dry)
- Breadboard and general purpose circuit board
- PCB enclosure (small box to host the controller unit)
- Metal scissors to cut the circuit board to size to fit within the PCB enclosure.
- Soldering iron and stand.
- Smart-phone with Blue-tooth terminal app.
Step 1: Assembly Instructions
The Arduino controller will be connected with the Blue-tooth module using the standard TX (Pin 1), and modified RX(Pin 2). If RX-0 pin is used there will be a conflict in recognizing the Arduino while connecting via USB port in windows, so we use Pin 2 instead. The RX of Arduino is connected to TX of BT module and TX of Arduino will be connected to the RX of the BT module with a voltage divider to reduce power to 3.3v. Pin 3 is used for trigger of the Ultrasonic module, and Pin 4 for Echo of ultrasonic module. Pin 10 will be used as the relay trigger. The power and ground for all three modules are connected to the Arduino 5v pin and ground pin.
Note: Do not work with Arduino or its components while the power is turned on or when connected to the PC as some devices are prone to damage if pins are not wired properly. The power output on a nano is limited, having a single LED attached to test the relay output and by connecting the same to the 5v power source of the nano failed to activate the relay, power usage must be carefully monitored or the whole unit may become unresponsive.
Step 2: Voltage Divider for Step Down of 5V to 3.3V
The RX of the BT module will require a voltage divider to step down the voltage from 5v to 3.3v. (RX0 pin is not used instead we use D2 pin configured as RX in the program for avoiding conflicts)
- 5v input x R1/(R1+R2)
- 5v x 2000 / (1000+2000)
- 10000/3000 = 3.3v
The 5v supplied to the relay is also stepped down to the RX pin of the BT. A 1k ohm resistor is connected to the TX pin of the Arduino and 2k ohm resistor is connected with the GND pin of the relay which feeds off from the 5v and GND output from the Arduino Nano. The voltage is stepped down from 5v to 3.3 at the other RX end which connects both the resistors and the RX pin.The TX of the BT module is connected directly to the RX of Arduino module as it accepts 3v-5v as input.
Step 3: Test With Source.
Ensure that all key variables are declared on global scope. Static inner variables can lead to memory leaks in Arduino nano and should be avoided. Write intention revealing names, and use single responsibility pattern, having only one task executed per function. Reading the inner temperature and voltage are key features only available in AtMega382 chip-sets and may not work with others.
- DON - Debug On (Starts printing serial messages to BT terminals)
- DOF - Debug Off (Stops printing status messages)
- PON - Pump is switched on and starts the pumping cycle.
- POF - Stops the pump till it is manually started again.
- STR2700000 ( Keeps the pump on for 45 min ) 45min x 60 seconds x 1000Us.
- STP3600000 ( Keeps the pump off for 1 hour) 60min x 60 sec x 1000 Us.
- DEP - Returns the current tank depth to show animated tank level.
- DEP10 - Resets the max fill depth to 10cms from the sensor placement.
- PNG3000 - Resets loop interval to 3 second interval
Note: Do not use delay() function, it corrupts the program and also interrupts the timer hence a program with 10 second delay may also extend to 20 seconds and having multiple delays can cause the program to to produce unexpected results. Using the millis() to calculate the time lapsed is a better approach.
Step 4: Replace Relay Pins
The single channel relay has pins facing upward they needs some careful de-soldering. Having the pins facing downward will allow the relay to be mounted on the circuit board and soldered. Without the right tools this can be difficult task but by concentrating the heat on the head on the pins alone could help push them out without much effort.
Step 5: Transfer From Breadboard to Circuit Board
The soldering task may difficult so it is advisable to take breaks. Having a pointed soldering iron tip may help you to achieve better results. Once soldered it is difficult to remove the connections so drawing the points on board first may help to reduce any errors. After soldering it is advisable to test the whole unit before proceeding to the real world testing phase where you may connect it to the real pump. The power line should be connected to the middle input of the relay, and the low/high switch toggles output between the left and right toggle. Connect the pump to the line out on the left.
Step 6: Affix the Ultrasonic Sensor
The ultrasonic sensor must face directly above the water. Here it is mounted on a polypropylene water tank, but you can also mount the same on top of any tank as long as the sensor is mounted to face the water directly. Please use silicon glue to affix the sensor and it is recommended to tape it in place till the silicon is cured, and do not use the silicon gun with standard acetone curing as it can destroy your circuits.
Step 7: Mount the Circuit Board
The final step involves mounting the enclosure preferably within a few meters of the pump. Remember to tape the screw head which is used to secure the enclosure to the walls. Connect the D3, D4 (trigger, with VCC and ground) for the ultrasonic sensor which is soldered on the board it is recommended to use a female pin out from the soldered end points so it can be removed at any time for any fixes or updates. The ribbon cable connected to the ultrasonic sensor will be connected with 4 male pins which connects to the pin-outs from the circuit boards. Finally connect the pump when it is in switched off position.
Note: Always ensure that the pump is off when working with the circuits, improper use could lead to fatal injuries or death.
Test the controller before closing the enclosure use a smart phone with any BT Terminal to check the output and set debug on to verify that it is working as expected. Finally close the enclosure and identify key areas from where the controller is reachable so as not to physically approach the pump controller every time and connect remotely through Blue-tooth instead.
We have a be nice policy.
Please be positive and constructive.