2

I'm curious if the GPIO pins on a Raspberry Pi are capable of acting as a counter for TTL like signal inputs. I am interested in independently counting on six channels/pins, where the input signal that I would like to count is a 3.3 V (for greater than 1 kOhm, which the GPIO inputs seem to be) rectangular pulse with 5-50 us width. I'd like to count signals with a frequency of up to 1 kHz, but at least 100 Hz.

Based on this link it seems possible, using the pigpio c-module: Count RPM/Frequency/Pulses on GPIO ports (Maximum?)

I'd just like to verify that counting at 0.1-1 kHz can occur on multiple GPIO pins simultaneously with a Raspberry Pi, or if not, could a better board/computer be suggested.

1 Answer 1

2

The Pi is capable of doing what you want.

http://abyz.me.uk/videos/events.webm shows signals on GPIOs 2 through 26 being captured/displayed.

The only thing to be careful about is the minimum pulse width. By default my pigpio library samples at 5 µs so it would be best to ensure edges are at least say 10 µs. However you could boost the sampling rate to 2 µs so ensuring that 5 µs edges will be detected.

There are two C examples of simple (multiple GPIO) frequency counters at http://abyz.me.uk/rpi/pigpio/examples.html.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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