Electronic – I need guidance with this circuit

audioservotoggle switch

This is the circuit i'm creating.

enter image description here

BTW: The light pink area is a D flip flop.

(From left to right)

  • The green area is a microphone with a preamp.
  • The signal passes through a low pass filter, with a cutoff frq. of 300Hz (Yellow)
  • It then passes through a peak detector, which holds on to the peak value until the capacitor discharges [discharge speed controlled by a 150Ohm var. resistor] (Orange)
  • An op amp is acting as a comparator. If the signal that comes off the low pass filter is higher than the (smooth) peak detector signal, it should output 5v, other wise, 0v. (Light blue)
  • This signal then gets smoothed by another peak detector, which discharges 0.25 seconds. (Purple)
  • A D FLip Flop, toggles between the Q and Q' terminals, which should turn on either transistor (Pink)
  • The change in resistance across the 555 timer circuit, replaces a 100k Ohm potentiometer, being turned backwards and forwards. I hope that this will toggle a servo between to definite positions.

In essence, all I want is for the servo to toggle between to definite possitions, to the beat of music.

  • Is there an easier way to achieve my essential goal?
  • Does my circuit work like I think it should?
  • Do you have any ideas on how i could improve/fix this circuit?

The original PWM Controller:

enter image description here

Best Answer

That's a D flip-flop with the input connected to the clock and the Q' output fed back into D.

schematic

simulate this circuit – Schematic created using CircuitLab