Go Down

Topic: Seperate IC to Count Pulse Input? (Read 5 times) previous topic - next topic

Wagner Sartori Junior

Original post:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1230550957

Quote

Hi,

Is anyone aware of any IC's that can be used to count the pulse from a hall effect sensor and whose count can be read via serial/i2c?  I have found some IC's that provide a 4 bit digital output to represent its count, but i'm worried about losing input pins on the Arduino.

If you've used any in the past, it'd be great to hear of anything!

Cheers,
Scott.


I'm using a rain gauge and an anemometer(in two interrupts with a counter++ function). I want to count the pulses and I'll put my arduino to sleep. It'll wake up each three minutes to transfer the information using Ethernet.

The ethernet uses 150mA and is too much to be enabled 24x7. I have some solar panels and a 7500mAh battery and my station is using too much power. I want to save power and get some batteries and solar cells back.

MarkT

I didn't find such a chip when I last looked, so I've used a counter chip with parallel output and a shift-register to read its output...  Is there a reason you can't just use pin2 or pin3 with an interrupt routine?
[ I won't respond to messages, use the forum please ]

Graynomad

Quote
Is anyone aware of any IC's that can be used to count the pulse from a hall effect sensor and whose count can be read via serial/i2c?

Yep, an ATtiny85/84.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

tkbyd

There's a good chip for this sort of thing in the 1-Wire range... well... there WAS one in the range. You can still buy modules from HobbyBoards.com, search for "counter", even though Dallas isn't making any more of the chips.

1-Wire to Arduino: Uses just one digital I/O line.

Wagner Sartori Junior


I didn't find such a chip when I last looked, so I've used a counter chip with parallel output and a shift-register to read its output...  Is there a reason you can't just use pin2 or pin3 with an interrupt routine?


actually I'm doing this, the problem is to maintain my arduino on and it stays drawing power(the ethernet is consuming >200mA).

I made a research yesterday and comes to this solution you are saying:
1 x 74HC4020 (14-bit counter)
2 x 74HC165N (shift register)

I bought the ICs and are waiting for the tests. I'll put my arduino to sleep, it'll wake-up from a 555 monostable and then I'll have to get the counter, reset it, send using ethernet and sleeping again. My main concern is to get the counter and reset. Do you have any code getting to get the counter?

BenF

Quote from: Graynomad

Yep, an ATtiny85/84.

They will use more power than a counter chip, but this idea is good for a lot of "is there a chip than co do ..." cases where as a hobbyist you may have a go at creating it yourself.

No one mentioned the more obvious solution however, that all of the three AtMega timers can be configured to work as pulse counters.

Wagner Sartori Junior


No one mentioned the more obvious solution however, that all of the three AtMega timers can be configured to work as pulse counters.


I know, but I can't maintain my arduino on. So I need a "offline" solution to count for me. Even if I put an attiny85 to do this and transfer using some USART or I2C between arduino/chip.

The DS2423 is a good way to go. But the chip is SMD I'll need a breakout board to it because $25.00 for the complete board on hobbyboards is VERY expensive.

BenF


I know, but I can't maintain my arduino on. So I need a "offline" solution to count for me.

When using sleep mode idle, counters will still operate and you can disable unused peripherals for further power reduction. Wakeup source could include timer overflow (from the timer that counts external pulses). When using an external counter IC, you will probably need to wake up more frequently (worst case wind condition) in order not to overflow the external counter. Using the internal counter (8-bit for timer2 or 16-bit for timer1) you would only wake up if and when needed. Power usage in sleep mode idle is about 2.5mA so this would be the target to beat when considering external counters (you could probably avoid the 555 timer as well using sleep mode idle).

Timer2 can be configured for asynchronous operation and this would allow operation during additional sleep modes, but unfortunately is not compatible with the Arduino design (AtMega must run on internal oscillator in this mode) with the asynchronous clock connected to PB6 (Atmega328 pin 9).

steinie44

Might try a 74590 with a PCF8574. Count on the 74590 and read I2C from the PCF8574 chip. Thinking of doing this myself as I want all my weather sensors to be I2C. :)

gismo

Hey, I've been looking for a similar solution a separate IC that can count pulses and also calculate frequency..since you're already counting pulses and using timers..

Anyway, was looking for a ready made solution and found one chip the LS7366r which communicates via SPI. They're not cheap or very easy to come by.  I found a few breakout boards, but still pricey.

I opted to program an ATtiny85 and came up with a working solution that will send pulse information over I2c. The major problem is precision... If you want to use the 8bit timer/counter then you cannot use a crystal.  Regardless, I tried both an interrupt based method and count interrupts with a short ISR(PCINT) and with the 8bit counter. Lastly, to get better timer precision, you can tune it, but it's not ideal for me. I might try an ATtiny84 which has more pins free for crystal and counter. If anyone would like to collaborate or help or just test it on their setup, PM me.

I might try the crystal and pcint on the 85 and report back...need to buy a crystal

Thanks


el_supremo

The PCF8593 is a clock/calendar but it can be configured as a 6-digit event counter.
http://www.nxp.com/documents/data_sheet/PCF8593.pdf

Pete

gismo

I looked at some of those real time clocks as well..but if you need multiple counters at the same time, you'd have an i2c address conflict. Also,  I'm more interested in frequency measurement so I'd be nice if the IC was able to do most of the computing.

It would be great if a small single chip could take two or three inputs as counters or interrupts to count. And communicate via i2c or spi. Maybe attiny84? I might look into that

Graynomad

#12
Apr 27, 2014, 01:38 am Last Edit: Apr 27, 2014, 01:42 am by Graynomad Reason: 1
One of our members did a board with 4 (I think) tiny85s (or maybe 84s) whose job it was to do high-speed counting. There all talked to the master mega2560 with SPI.

I'll see if I can find the thread.

EDIT:
This is the thread, http://forum.arduino.cc/index.php?topic=69358.0, I didn't re read it to see if there are any details but I know that's what he did because I helped off line with it.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

gismo


EDIT:
This is the thread, http://forum.arduino.cc/index.php?topic=69358.0, I didn't re read it to see if there are any details but I know that's what he did because I helped off line with it.

______
Rob


Thanks Rob! It's quite an old thread, but I've posted there to see if the code could be made available.

I wonder if there are some small FPGAs that could do this.. or maybe it's overkill. I haven't done anything with an FPGA before, so excuse my ignorance.

Graynomad

Yes you could use an FPGA or CPLD, one hell of a learning curve though just for this app, OTOH if you wanted to get into them this would be a good first project I think.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Go Up