Beginner project guidance - hall sensor frequency to MQTT


New member

I should say straight up that I'm not a programmer, in the last 40 years I've never "got" programming.

I'm OK with electronics though, I can solder.

I can also google and cut/paste.

I have a hall effect flow meter Screenshot_20230316-113858.png
It's open collector (I've tested it).

I just want the Hz published via MQTT.

I have just received my Teensy 4.1 and the ethernet kit.

I figure these libraries might be the correct:

So I need to figure out if I can use the input pin internal pull-up on the Teensy. The meter should produce around 100 (square wave) pulses/sec when the pump is running.

According to the documentation need >=6v DC for the sensor but it seems to work properly on my bench PSU with 5.00v/50ma.

So can someone please help me with the best way to wire this up and also how to code it (I don't expect help for free)?


The pull up isn't hard. simply a resistor of the suggested value - 5kOhm across the red and bare wire to make the signal go high when the hall sensor is open. When it's closed, it will pull the bare wire to ground.
Then, to bring the voltage down to the 3.3V required by the Teensy, put a 3.3V zener diode in tied to ground.
Connect that output to a pin that can do interrupts on the Teensy you choose.
Then, code up the example here FreqMeasure
FreqCount is for high speed signals - this is loafing along at 100Hz - FreqMeasure will be better.
I'm not a guru on the IoT / MQTT stuff so you'll need to seek some experience there from someone else.