I stripped down a gate motor and found this chip/circuit board between a cog that was driven by shaft. I suspect the chip has something to do with either counting the revolutions of the motor or the distance the gate travels . The circuit itself appears simple but could someone provide a better explanation of how the chip electronics actually works when the cog turns .