Hi all,
I've an idea for a project in my garden. Every so often I discover the water level in my pond has dropped way more than it should have - usually because a waterfall jams and causes the water to overflow outside or a pipe comes loose and water gets pumped to the outside.. not good! I figured building something to monitor the water level would be fun. I'm a software developer so I'll hopefully have no issues with coding it but I've zero experience with creating my own circuits. I write apps that interface with custom built hardware over Bluetooth with my job but that's as close as I get :).
I've spent quite a few days reading into how to solve this and come to the conclusion I'm likely best mounting an Arduino with an ultrasonic sensor above the pond. Every ~30 minutes or so it can poll the rough water height and use wireless to send the data off to ThingSpeak/my own API somewhere which would then trigger alerts to email/text/push or whatever I choose if it gets below a certain value. Assuming it works I may look to expand it later to switch a 240V relay (UK mains) so I can turn the pump on/off when the water level gets too low.
I've come up with the following components I'll need and have spent far more time than I should have putting together a circuit; I tried to keep it neat!
I plan to power this from mains voltage rather than batteries but I figured I'd try and save energy where possible and make it more challenging so I've added two NPN transistors to let me cut the power to both the ultrasonic sensor/temperature sensor and wireless module individually. I read you should add a resistor to the gates so I have.
The ESP8266 uses 3.3V rather than the Arduino's 5V. The built-in 3.3V of the Arduino apparently can't provide enough current so I've used the 5V line with 3.3V regulator to bring the voltage down. Similarly, the TX pin of the Arduino needs to be shifted down to 3.3V for the ESP8266 so I came across a trick of using a voltage divider to do this. Voltage to ESP RX = 5V * (2KΩ/(2KΩ+1KΩ)) = 3.33V.
How horrendously wrong do this look? I'm mostly unsure of whether I've picked the correct resistor values or not and if it's going to go up in smoke the moment I power it on.
- Arduino Uno R3
- HC-SR04 (datasheet) - ultrasonic distance sensor [I'll probably use a waterproof variant]
- ESP8266 (datasheet) - wireless module [I'll probably use the ESP07 varirant with an external antenna]
- TMP36 (datasheet) - temperature sensor [I don't really need one, but why not]
Breadboard:
(click for larger image)
Schematic:
(click for larger image)
Thank you!