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

  • \$\begingroup\$ I debated on writing an answer for this Q. There is just so much wrong with this that it is difficult to really know where to start (and how to end). The interface between the green and blue is not biased correctly. The transistor in blue needs a pulldown on the output. The peak detector isn't going to work like you want (you want "RMS peak", not "peak peak"). The voltage comparator needs a pullup on the output (unless it is really an opamp). And I suspect that there are issues with the 555+control circuit but there isn't enough detail to say for certain. \$\endgroup\$
    – user3624
    Commented Aug 28, 2013 at 17:30

2 Answers 2


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


simulate this circuit – Schematic created using CircuitLab

  • \$\begingroup\$ Thank you, will the rest of my circuit work how I explained it should? btw, thank you, that's exactly the sort of answer I wanted, nice and simple \$\endgroup\$ Commented Aug 28, 2013 at 16:35
  • \$\begingroup\$ Not certain about the green section; I'm weak on audio input. \$\endgroup\$ Commented Aug 28, 2013 at 16:39
  • \$\begingroup\$ Also, what are the Set & Reset pins of the D Flip Flop (Ill just ignore them for now) \$\endgroup\$ Commented Aug 28, 2013 at 16:39
  • \$\begingroup\$ They set the flip-flop state asynchronously (as opposed to the D input, which only takes effect on the clock edge). \$\endgroup\$ Commented Aug 28, 2013 at 16:41

Your variable resistor only has two terminals (should be 3) and your input stage is questionable:

  • electret microphones need power / bias current
  • currently this is only supplied by base current from the transistor
  • what is the rolloff frequency of your filter, and have you taken the microphone impedance into account?
  • the "output" of the transistor is a current, which must all flow into the opamp, or through the varistor; but the opamp input impedance is high. You may need a 10-100k resistor to ground from the output of the transistor to pull that side of the branch down.

Have a look at Can I use a PNP Transistor with an Electret Microphone to get an non-inverting output for my Arduino? for a good discussion on how to build the kind of amplifier you're looking for.

Edit: I'm not convinced that your resistor switching arrangement will have the desired effect on the PWM module, but without its schematic we can't tell.

  • \$\begingroup\$ Could you look at the schematic again please? :) \$\endgroup\$ Commented Aug 28, 2013 at 22:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.