I found an older article (here) with an example of how to implement this, but I am working with 5v not 12v.

What is the math involved here to determine the correct resistor, capacitor and diode values?

I have never had to dive this deep into circuitry before.

Not looking for direct answer, willing to learn, just don't know where to start for something like this.

Thanks