Charge indicator with comparator - very sensitive to noise
Yes, there is, add hysteresis to the comparator so the ripple is less likely to trigger the comparator from one state to the next. I used a circuit like this when I had a lot of ripple on the inputs. If your prototyping this, make sure you have good grounds and Vcc to the amp with bypass capacitors


Source: https://www.electronics-tutorials.ws/opamp/op-amp-comparator.html