Pulse counting with an external device

I am trying to count pulses coming from two reed switches (an anemometer and the rain tip bucket for a weather station). Whenever the anemometer rotates or the rain bucket tips, a small magnet activates a reed switch. By counting the number of pulses over a given amount of time, I can calculate wind speed and rainfall.

The most common solution looks to be reading pulses with a digital pin and a pull up resistor + cap for debounce. I would like to do the same thing, however this weather station needs to be low-power. I have the arduino in a low power sleep state (to where it is drawing 10s of uA) for ~60 seconds at a time. At the end of each sleep cycle, I want to read read the number of pulses that occurred, then the device will go back to sleep.

A counter chip looks like a solutions that would work, but I have no idea which one. Something like a 74-series device? I have little experience here, so I may be way off base. The highest pulsing frequency I would imagine possible is less than 200Hz. The biggest concern is around power consumption, since I want to keep the whole weather stations running on as little power as possible, so the power draw of the IC needs to be as low as possible.

Are you using an Arduino (which one?) or a standalone Atmega 328 chip ?

Will the power draw of the external counter be lower than just using the "Arduino" to do the counting?

What is the maximum number the counter will be required to reach between reads by the "Arduino" ?

...R

Is your rain bucket going to tip more frequently that once a minute?
If so, either your rain bucket is too small or you're expecting a deluge of Noahic proportions. :slight_smile:
If not, you only need to know whether the bucket tipped in the last minute.
To do this, get the reed switch to charge a capacitor when it closes. When the Arduino wakes up, it checks to see if there's a voltage across the capacitor (on an analog pin). If there is, it knows that a tipping event has happened and discharges the capacitor (through a resistor and transistor), ready for the next tip.

I am planning to use a bare Atmega328pu and an LDO regulator with a low quiescent current @ 3.3v/8MHz.

I'm not sure about the draw of an external counter since I didn't know what counter to use, hence the question. I don't know what a 'typical' counter ic draws.

An 8-bit counter would provide probably suffice, since that would allow a maximum of 265 revolutions during the sleep period (say 30 seconds). I don't yet know how fast that would be in wind speed, if it weren't enough, I could shorten the sleep period.

The question was part practical and part theory. I may be able to use two interrupts to perform the counting, but if I had a third pulsed input that I needed to count, what could be an alternative?

@Henry:

The capacitor idea is a good one, but I also need to count the pulses from an anemometor, which can occur multiple times person in high winds.

I suspect the voltage regulator will waste more power than any external chips can save. Why not power directly from a 3.7v LiPo battery ?

You could save even more power by running at 1 MHz.

How long do you want the device to operate between battery charges / replacements?

I strongly suggest you first get the device working without bothering with sleep or external devices. That will make the programming and debugging much easier.

Then see what the power consumption is and decide what additional power saving steps are necessary, and how the "cost" (in terms of time and complexity) of the power saving compares with the cost of a larger battery - such as an old car battery, and, perhaps a solar charger.

The 1996 book I have "Modern CMOS Circuits Manual" does not mention counter chips that go beyond about 10 counts (e.g. a 4017). I guess you could cascade them. There may be newer options, but I suspect not because Microprocessors came along and people no longer built microcomputers from dozens of ICs.

...R

What size battery are you planning to use?

I am also doing a rain gauge.

Why don't you just get one reading going first using a button state change sketch and a float variable.

How are you planning to view the information?

stuwilson:
using a button state change sketch and a float variable.

Why a float variable - I have never heard of fractional states.

Perhaps it was a joke about a rain gauge ?

...R

You could use a cmos ripple counter 4024 is 7 stage 4040 is 12 stage, that should cover your needs for recording a lot of pulses.

so Robin, how would you put 0.2mm of rainfall into an integer variable?

stuwilson:
so Robin, how would you put 0.2mm of rainfall into an integer variable?

Use fixed point arithmetic.....

stuwilson:
so Robin, how would you put 0.2mm of rainfall into an integer variable?

He's not directly measuring the rainfall, he's counting the number of times a bucket tips in a timed period. I suspect that 0.2mm will not be enough to cause the bucket to tip.

stuwilson:
so Robin, how would you put 0.2mm of rainfall into an integer variable?

As @HenryBest has said in Reply #11

The OP may subsequently wish to calculate the 0.2mm based on the number of bucket-tips in a period of time. But that value should be in a different variable which could, indeed, be a float.

...R