Go Down

### Topic: Need help with simple code for driving a motor and monitoring a "water sensor?" (Read 548 times)previous topic - next topic

#### michael18284

Hi guys, I'm very new to Arduino and I'm looking for some help or someone to hopefully spit out a few lines of code for me.  I have C and matlab training, but its been about 7 years since I've done any programming.  I know what I'm looking to accomplish is very simple, I just don't have the time to read through a bunch of tutorials and spend a few nights trying to figure out exactly how to write the code for this.

Background:  My GF's is a teacher of a special Ed class who started an organic garden to raise money for classroom materials, b/c our education systems suck.  I've been tasked with creating an automatic watering system to make sure her garden doesn't die from lack of water.  As cheap as possible.

The Plan:  There will be 2X 55gal drums that will collect rain water from the school's gutters. I'll run a cheap garden hose between the bottom of both drums to keep the water levels even, with a "T" fitting between them going to a 12V RV water pump that draws up to 4 amps.  I need 2 portions of code, one basically wasting a day's worth of time then turning on the water pump for 10mins a day.  I was thinking it could just count to what ever number was calculated by the Arduino's clock rate and 85800secs/day, which = 23hrs and 50mins.  It would then flip on the pump and count to what ever number was calculated with the Arduino's clock rate and 600secs which =10mins.  Seems simple enough.  I will be using the output from the Arduino to a transistor to a relay to the motor.  The entire system will be powered by a 12V deep cycle battery and a trickle charge solar panel.  I realize I will probably have to adapt the 12V to whatever this bad boy needs, I'll use a voltage regulator.  The second portion of code I'm looking for is to monitor the water level in 1 position near the bottom of the barrels to prevent the motor from turning on when the water source is depleted.  Also, I need recommendations on the cheapest Arduino that would accomplish this task.  I don't care about expansion possibilities bc this will be the sole purpose of this particular module.

Things I need from you guys:
-Recommendation on which Arduino module would be best/cheapest
-Code for timing and controlling motor
-Code for monitoring whether the water sensor is submerged or not
-What I can use as a water sensor

Once I have a starting program, I will understand it instantly and should be able to fine tune it myself with a few tuts and questions.  Starting is the hard part.  Any and all info is welcome and VERY appreciated by me and about 20 other people.

THANKS GUYS!!!  ...OR GALS!!!

#### Nick Gammon

Posting the same lengthy question in multiple places is likely to be counter-productive. You will annoy people who might have otherwise helped, and you waste everyone's time. - Moderator
Please post technical questions on the forum, not by personal message. Thanks!

http://www.gammon.com.au/electronics

Go Up

Please enter a valid email to subscribe