A trigger is used to create a square pulse from an analog sensor. After using some triggers with LM393 comparator https://www.mysensors.org/build/pulse_power, I found some issues due to the fact that this circuit doesn't have any hysteresis. I measured high frequency oscillations when the sensor voltage is closed to the reference voltage on the common LM393 circuit. When this happened, you have huge values like thousands cubic meters of water or GWh ! To avoid this, I designed a new trigger circuit with hysteresis.
The sensor can be a phototransistor, a switch, a reed contact, a microphone, a variable resistance (temperature sensor, light sensor, any sensor with a voltage output). U1 can be a dual operational amplifier like LMC6482, LF353, TL072, etc... or a comparator like the LM393. The selection of this component is related to the power supply voltage. Today operational amplifiers are available with working voltage down to 1.8 Volts to more than 30 Volts; check the datasheet to be sure you are in the safe range. Computing the values of the components R1, R5, R6, RV1 can be done with the following link: https://www.random-science-tools.com/electronics/inverting-schmitt-trigger-calculator.htm. Fixed values (R1, R6) can be used or an adjustable potentiometer (RV1) (if precise adjustment is needed) depending of the application. 2 resistors are cheaper and more reliable than a potentiometer. The potentiometer is a Bourns model 3214G https://www.bourns.com/docs/Product-Datasheets/3214.pdf. When an operational amplifier is used, there is a second analog output; output gain is selected by the relation: Av = 1 + R7 / R8. If a LM393 comparator is soldered the resistance R2 must be present as this component is open collector. If needed, the sensor can be powered / polarized through R4. C2 is optional; keep the value small. If U1B is not used, R7 must be soldered.
I added the LED D1 to be able to see the state of the output.
All passive components and LED are 0805. U1 is a SO-8 case.
Design files (Gerber) are available in the files tab.
I will not provide BOM as the components must be computed for your own application and some are optional. Up to now, I assembled 2 pieces which are working as expected as trigger on power and water meters. The first one sensor is a phototransistor on the Wh blinking LED of the powermeter; the second is installed on a watermeter with a reflective optical sensor.
Let me know if I missed some explanation or if you have any trouble.