..code needed to read from fan tacho output for rpi-4

all i need is a basic program that can read from the yellow r.p.m output of the fan
that uses a gpio pin/s to read the signal…
and display in text …the fan speed in a terminal with constant refresh…thx
either user or root permission …
using a noctua 40x40x10 5 volt
also if possible a twin or triple gpio pin configuration allowing for extra fans would be good…
that i can either edit manually or on screen menu to adjust for extra fan`s …scale 0-10000

EXAMPLE BELOW…

FAN ONE R.P.M = FAN SPEED

FAN TWO R.P.M=FAN SPEED

FAN THREE R.P.M=<FAN SPEED

===============================================

ENGAGE FAN SELECTION selet 1 2 3 to change status

1:ON/OFF= gpio-pin=status=on

2: OM/OFF= gpio-pin=status=off

3 : ON/OFF= gpio-pin=status=off

===============================================

Hi @brian86770,
Reading PWM frequency is a bit fraught on a Raspberry Pi since it cannot guarantee precise timing like a real-time microcontroller can (source). However the frequency you’d expect out of a fan could be low enough that it’s not a problem.

There’s a pigpio example linked on another forum topic that may help you.

1 Like

accurate to 100 rpm would be ok. if any body can do this for me i see that diagram of converting it to an analog voltage reference as the sorce 4.7k and 100nf to ground then connecting it to the gpio pin…i see also on that pasge several progam codes…i will post on another forum.i dont know how to code very well…thank you for the links…

ok so since i am not an avid coder could anybody else write me a program …pls …to the specs i want if only one fan can be shown then that is ok,

i got this page to help with but am unshure exactly how to go about it all i need to do is read the tacho output of the fan not power it…one gpio enabled would do the trick but the program i`m unshure of…

https://www.domoticz.com/wiki/Raspberry_pi_fan_control_and_monitoring_with_bash

i can switch between fans with an rotary switch …manually