For a project I am working on, I have a 1Hz square wave coming from a real time clock, and need to convert it into a sinusoidal wave to pulse LEDs. After some googling and playing around with simulations I came up with the circuit below. The 1Hz square wave is connected at the net labelled SQUARE and then filtered: Triple RC Filter and NPN transistor

My question now is how do I determine values for the passives to effectively filter out the higher frequencies and get the single sine wave I want? I got the values you see here from messing with a simulator, but I don't understand how to derive them analytically.

Thank you for your help.

  • 2
    \$\begingroup\$ 200k is far too large for Rb when I expect Rc ~ 220 , thus Rc/Rb =1k should be around 20 max. unless superbeta switches are chosen. Please define linear sine output when you have a very non-linear amp. Since current ? not sine voltage! try current feedback. \$\endgroup\$ Jan 12, 2020 at 1:14
  • \$\begingroup\$ What is the input driver? \$\endgroup\$ Jan 12, 2020 at 1:24
  • 1
    \$\begingroup\$ @Treeaza What are you trying to achieve with the LEDs? It's not clear to me. Do you want some kind of varying intensity? Or? \$\endgroup\$
    – jonk
    Jan 12, 2020 at 2:47
  • 1
    \$\begingroup\$ I'm just trying to make them fade in and out. \$\endgroup\$
    – Treeaza
    Jan 12, 2020 at 2:56
  • 1
    \$\begingroup\$ @Treeaza Thought so. This means you really want an exponential increase in current and then an exponential fall in current. A linear increase in base voltage followed by a linear decrease in base voltage (relative to emitter voltage) achieves this goal, using the collector as the current source. You want to turn the square wave into a ramp up, then down -- a triangle wave. More like that. Does it need to turn them completely off and then completely on? (I think we recently covered this somewhere on EESE.) \$\endgroup\$
    – jonk
    Jan 12, 2020 at 3:23

1 Answer 1


Square wave has odd harmonics 3f,5f,7f at levels of ~ -10dB,-14dB, -17dB ..

A 1st order filter is -6dB/octave and 3f is 2 octaves above f or -12dB more than the -10db harmonic @ 3f.

Triangular Current will not be much different to the eye than sinusoidal as the eye is logarithmic .

You might try something like this.

enter image description here

Then you can always try sine PWM control using a FET switch with current limiting R for each LED.

But the hardest thing it seems to learn is how to define a design spec (before attempting to design it) including the LED datasheets with inputs, Processess and Outputs in a point form Hierarchical format.

IBM used to call this, the HIPO format for design specs.
Simple, Elegant, Complete, Measurable and Verifiable.

If you graduate and do design/test work, you must learn to create Design Specs then Design Verification Tests ( DVT plans and reports) based on these simple specs and record it. This is how Japanese Engineers think and how I did it in Winnipeg and Silicon valley. in early 80's as well as an Aerospace Engineer in late 70's.

If it meets spec. It's perfect. But it has to be a good specs with above Design values, budget and design time. (always double estimated design time)

  • \$\begingroup\$ Any questions?. \$\endgroup\$ Jan 12, 2020 at 2:56
  • 1
    \$\begingroup\$ No, thank you for all your help. I understand now how my question was very ambiguous, it hadn't occurred to me how much component selection would impact the filter design. I'm only a couple of years into my degree, and I often forget to use a proper design process with my projects, this is something I will need to work on in future. \$\endgroup\$
    – Treeaza
    Jan 12, 2020 at 3:03
  • \$\begingroup\$ Rule of Thumb is for same voltages Rb/Rc ~ 10 to 30. \$\endgroup\$ Jan 12, 2020 at 3:07

Your Answer

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

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