2
\$\begingroup\$

For a "plant waterer circuit" I would like to add a safety feature that prevents watering for over ~3 minutes, and delays the next watering from occurring for ~12 hours.

Currently the circuit is constantly checking the water level to see if water should be added. Thus, it seems that if I could create a square wave that is high for ~12 hours (circuit "off" during this time) and low for ~3 minutes (circuit "on" during this time) then I could use some simple logic to achieve my goal, except I don't know how to create this wave.

Timing chips like the 555 would require unwieldy resistor and capacitor sizes, so it seems those by themselves are not suitable.

I am considering using counter chips, as I could achieve the period I need (~12 hours). However, these output a 50% duty cycle (or 33%, etc.) which I don't want. Rather, the square wave I described above has a duty cycle of about .0042.

Any suggestions? Thanks.

\$\endgroup\$
4
\$\begingroup\$

I am not going to answer your question, instead I'll answer a question that you didn't ask :)

You could implement a timer-based solution. However, it is actually going to be cheaper and more effective to use a microcontroller for your problem. The advantages of a microcontroller solution are:

  • Cheaper to build (I know it sounds crazy but it is true)
  • More flexible in the logic: you can change the logic with a few mouse clicks
  • More supportable: for many people it is easier to see the application code than understand why the RC time constant is not behaving as it should.

Some solutions to think about in the microcontroller world:

  • Arduino: starts at about $11 for Arduino Nano on ebay/DealExtreme, programmable over the USB port, more input and outputs than you'll know what to do with. Programmed in C/C++
  • Pure AVR: about $2 for the minimum chip, but requires ~$20 investment for an ISP programmer. Programmed in C/C++ or Assembly.
  • PICAXE. Do they make them anymore? Programmed in BASIC or Flowchart. About $3-$5 to get started. Programmed with nothing more than a serial port.
  • PIC Microprocessors. Similar to AVR, but it's kind of a Mac vs. PC thing from a few years ago. I am an AVR person, but there is a number of PIC people on this board, so if you go this route there is plenty of help too.

Basically, Arduino is an easier-to-use AVR\$^*\$, and PICAXE is an easier-to-use PIC. Between Arduino<->PIXAXE, Arduiono wins in popularity hands down: Arduino is extremely popular and well-supported. Between the underlying platforms (PIC/AVR), it isn't clear: both are popular. There are also other microcontroller options(Cortex M, Propeller, and many others) but the options mentioned in the bullets above are the easiest to get started with, IMHO.

* This is only 99.9% true because a few Arduino's use non-AVR Atmel chips.

By the way, I am not suggesting the you ditch your existing circuits and use a microcontroller for everything (whether that's a good idea or not is not relevant to your question). You can use a microcontroller for the purpose that you don't flood your house or overwater your plans as stated in your design goals. Here's what your solution would look like in microcontroller pseudocode:

loop:
   have 12 hours passed?
      yes: turn on output for 3 minutes
      no: don't do anything
   go back to loop:

There are all sorts of sophistications you might add, such as sleep, implementing the wake 12 timer hit as an interrupt, etc.

\$\endgroup\$
  • \$\begingroup\$ Hi, thanks for the thoughtful reply angelatlarge. While I agree that a micro-controller solution is better (and easier), I am still interested in other solutions. I am building this circuit for a school project, and the use of micro-controllers is discouraged. \$\endgroup\$ – Ben Apr 9 '13 at 4:21
  • \$\begingroup\$ Ah, I see. Maybe something to add to your post then? \$\endgroup\$ – angelatlarge Apr 9 '13 at 4:24
0
\$\begingroup\$

How about using a counter to implement a function something like (not calibrated for 12h but you can get the idea):

out = counter[10] && counter[9:4] == 0

You can assert that the output is high when both the 'large' bit is true, and when all but the lowest few bits are zero. This will give you a short pulse after the high bit toggles (after 12 hours), and then relatively quickly fall to zero again (after a few minutes). Could be done with one counter and a handful of AND gates.

\$\endgroup\$
  • \$\begingroup\$ Thanks Tim. I'm a bit confused by what counter[x] means. Does counter[10] refer to the 10th bit, and counter[9:4] refer to the first 4 bits? When I think of bits, I think of each bit as a flip flop and so after each bit the frequency is halved. Thus, the last bit gives the lowest frequency, and the earlier bits give a higher frequency. \$\endgroup\$ – Ben Apr 9 '13 at 18:24
  • \$\begingroup\$ Sorry, I was using RTL jargon. counter[10] is the (technically 11th) bit, while 9:4 are the 6 next less significant bits (bits 9 through 4). counter[0] is the least significant bit (bit 0) which will toggle every clock cycle. Thus the output will only be high when the value of the counter is 1000000xxxx (lowest 4 bits are don't care). @Ben \$\endgroup\$ – Tim Apr 9 '13 at 18:35
  • \$\begingroup\$ Sorry, I meant to say counter[9:4] refers to bits 4 through 9. edit: just saw your new message \$\endgroup\$ – Ben Apr 9 '13 at 18:44
0
\$\begingroup\$

Since you state it's a project and hence taking the easy/obvious solutions is not possible (just buy a mains timer plug for $5 or use a micro and roll your own) you could use a counter chip or combinational logic (shift register) running from a very slow clock pulse (~1Hz or less).

Your duty cycle of ~0.0042 means that an 8-bit counter clocked at 3-minute ticks would give you the desired result. I'll leave the details of creating the 3-minute tick and output enable condition to you, otherwise it wouldn't be a project ;)

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.