Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: Beginner project guidance - hall sensor frequency to MQTT

  1. #1
    Junior Member
    Join Date
    Mar 2023

    Beginner project guidance - hall sensor frequency to MQTT


    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 Click image for larger version. 

Name:	Screenshot_20230316-113858.png 
Views:	4 
Size:	61.3 KB 
ID:	30628
    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)?


  2. #2
    Junior Member
    Join Date
    Jun 2022
    PA, USA

    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.


  3. #3
    Junior Member
    Join Date
    Mar 2023
    Thanks Andy!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts