Why not just connect them to the hand brake levers?
That sounds much simpler, cheaper, and reliable than "detect changes in the frequency of the wheel rotation".
Also, it works like a car's brake lights, which drivers are accustomed to, rather than "start pulsing when you decelerate", which is when you stop pedaling (unless going downhill).