3
\$\begingroup\$

I'm trying to design a square wave oscillator to control an LED with a LINEAR frequency control range of ~0.017 Hz to ~17 Hz (1 BPM to 1000 BPM).

EDIT

Oli's excellent answer and circuit indeed make the duration between discharges linear wrt the control voltage. However it's not clear to me how to scale the input as suggested. Even with a large capacitor the control voltage range is narrow and the circuit throws a huge amount of current around.

To get the usual BPM range for music of between 40 and 240 BPM, that corresponds to periods of 1500 ms and 200 ms respectively. A BPM of 120 is exactly 500 ms.

I have another circuit that I believe also correctly linearizes the period based on the size of a resistor (e.g. a potentiometer):

metronome circuit

Could a current mirror like the one above with a different ratio be used to scale the control voltage / resistance? How?

As it is, the circuit would require an R4 of 14.5 Mohm to yield a period of 500 ms (120 BPM). I need the value to be exactly 5K (10K pot in the center position).

Note that I think adding an emitter resistor (R2) to the load will scale down the current (wildar current source?) but it also seems to ruin the linearity.

EDIT 2

Here's another version. That string of parallel transistors provides a 4:1 ratio step-down current mirror so that resistors can be smaller. It also makes the control current relative to ground which is nice depending on how you power your op amp.

metronome circuit

Despite the extra parts, the're mostly transistors so the build is probably not as complicated as the schematic looks.

\$\endgroup\$
3
  • \$\begingroup\$ Fiddling with the discharge current only is only going to affect the high part of the cycle, leaving the low part constant. Also, when you say "duty cycle" do you really mean the overall period? The usual idiom for this type of circuit is to use a constant current to charge the capacitor and use a very short dischage period (to produce the "click"). \$\endgroup\$
    – Dave Tweed
    Feb 2, 2013 at 20:36
  • \$\begingroup\$ That's funny - I'm just now putting together an inproved circuit that uses a current mirror and smaller capacitor :-) So the answer is, yes, you can do it this way - I will update my answer in a little while with a circuit idea. \$\endgroup\$
    – Oli Glaser
    Feb 3, 2013 at 23:24
  • \$\begingroup\$ I added the (Wilson) current mirror version which is much "stiffer" and uses smaller caps. This should perform much much better than the simpler version. A reasonable quality rail to rail in/out opamp is necessary. Decoupling caps are not shown, also a cap between opamp out and the inverting input to prevent oscillation is probably a good idea (e.g. >100pF) \$\endgroup\$
    – Oli Glaser
    Feb 4, 2013 at 0:40

3 Answers 3

3
\$\begingroup\$

You would be better using a microcontroller with a crystal for this, since the accuracy would be much much better. However, here is a (very rough) 555 based circuit I threw together, that uses a constant current source to charge the cap - it's very rough but does approximately 100mV/Hz from 9V downwards (e.g. 8.99V = 0.1Hz, 8.9V = 1Hz, 7V = 20Hz)
You can tweak it to scale the V/Hz as desired (and also tweak the cap value and pulse time (remember this doesn't change so ideally is short to stop the error becoming large as the frequency increases), generally tidy things up a bit) A rail to rail (ideally precision) opamp would be needed.

Circuit:

555 VCO

Simulation of the voltage control dropping and frequency scaling linearly:

555 VCO Simulation

Simulation set for 9 - 1.7V = 17Hz (notice error of ~0.4Hz from pulse width):

555 VCO 17Hz

Improved Version

Here's an improved version which uses a Wilson Current Mirror and a smaller capacitance, so a precision capacitor and trim cap can be used. I set it up for 0.45V/Hz, so with 9V and the 10 turn 10kΩ pot you will get 2Hz per turn (up to 9V = 20Hz in theory - in practice the current source compliance will limit things to around 17Hz, which is okay, but the pot cannot be fully turned all the way to 9V or the current source will "drop out")
So again, as it's a "rush job" things will need tweaking a bit to suit.
The large linear range is difficult to handle with one pot, so the slower range will be harder to set - it may be worth having another range resistor, to switch in for the lower range (e.g. to set it up for 0.45V/10mHz or similar)

Anyway, here it is (pot upper/lower represent the pot):

555 VCO improved

\$\endgroup\$
9
  • \$\begingroup\$ The OP noted in a response to one of my comments that the circuit is going to be controlled by a multi-turn precision pot. As such, it might note be a bad idea to tweak your circuit to include the pot, and preferably arrange things so that one of the precision pot will be a clean "zero", and a separate "calibration" pot may be used to set the range, so that the when the dial reads "120" the circuit will be outputting two pulses per second. \$\endgroup\$
    – supercat
    Feb 3, 2013 at 17:28
  • \$\begingroup\$ @supercat - good idea, I'll post a better version shortly (the current one can be improved considerably, it was just to illustrate the idea of using a constant current source really) \$\endgroup\$
    – Oli Glaser
    Feb 3, 2013 at 19:45
  • \$\begingroup\$ Is the Wilson Current Mirror necessary, or--if one had a rail-to-rail op amp--could one replace the NPN resistor with a PNP one and have a pot value of +V represent zero beats/minute, and the pot value closest to the negative rail represent maximum? \$\endgroup\$
    – supercat
    Feb 4, 2013 at 21:43
  • \$\begingroup\$ @supercat - You mean like the first circuit? Yes, you can do it various ways, but in the second circuit you have a greater current source compliance voltage range. The cap needs to charge up to 2/3 of V+, so with the first option your control voltage is limited to a low of just over 2/3 V+ (~6.2V) In the second option, you can use 0 - 8V or so. Either way, it's difficult to control the slowest speeds as the pot turn becomes very small, hence the suggestion of a range switch. The Wilson current mirror is simply much stiffer than a plain current mirror. \$\endgroup\$
    – Oli Glaser
    Feb 5, 2013 at 2:54
  • \$\begingroup\$ I was thinking in terms of the first circuit, but with the pot drawn in to show how it should be wired. The voltage range for SIG would be pretty small, but so what--just add a resistor on the ("maximum speed") side of the pot, and choose the collector resistor suitably. Even if you use the Wilson current mirror, you still end up with an error term due to the finite gain of Q3, right (some of the emitter current comes from the collector)? I agree that a 10x range switch would probably be good. Not sure if it's better to trim by adjusting capacitance or by adjusting e.g. R5/R2? \$\endgroup\$
    – supercat
    Feb 5, 2013 at 3:09
2
\$\begingroup\$

A linear scale on a metronome is not the good thing that you imagine it to be.

When you turn the dial halfway, from 1 bpm to 500 bpm, the metronome has gotten 500X faster.

Then, from there, when you turn it all the way, it only gets twice as fast.

The ideal metronome control would have the same geometric effect for the same turn angle. I.e. regardless of where we are on the dial, if we turn the knob five degrees to the right, we get about the same percentage speedup. And that is exponential behavior!

Just design the panel artwork for the knob so that it it matches the behavior.

\$\endgroup\$
3
  • \$\begingroup\$ You raise an interesting point. A linear metronome scale isn't perfect for music, but it's generally better than a scale which is proportional to the period (musicians working for old-style animators might have liked the latter scale, though, since music for animation often used tempos measured in frames per beat). A musical metronome scale wouldn't normally go from 1 to 500bpm; a more typical range would be 40 to 240, with 100 near the middle. Using a straight linear scale would mean the difference between 40 and 50bpm would be 1/20 full scale--not great, but not ridiculous. \$\endgroup\$
    – supercat
    Feb 3, 2013 at 5:31
  • \$\begingroup\$ Of course, if the metronome is for something other than music, the linear scale might be more useful than logarithmic. \$\endgroup\$
    – supercat
    Feb 3, 2013 at 5:33
  • \$\begingroup\$ I'm using a precision 10 turn bourns "dial pot" that has two clock hands builtin to the face. As you turn it the hands turn inside a little window. So if you set the big hand to 2 and the little hand to 5 the resistance is exactly 2500 Ohms (it's a 10K pot) which could correspond to 250 BPM. I don't know if it will be useful for music above 2 and a half turns but I'm just messing around at this point. \$\endgroup\$
    – squarewav
    Feb 3, 2013 at 8:25
1
\$\begingroup\$

I would suggest that if you want to use a 555-style device to produce a relatively-linear metronome, you should build a circuit which will charge the cap at a rate proportional to your control voltage, and have the 555 discharge the cap as quickly as practical so that even at the highest tempo setting its discharge current will swamp your charging current.

The fact that the discharge current will not be infinite will cause the control response of the described circuit to be slightly non-linear, but provided that the discharge current is an order of magnitude or so above the charging current, the control response should be adequate if you don't have to place your metronome markings perfectly uniformly. If you need something better than that, you will probably have to arrange to have your control voltage affect both the charging and discharging currents. Such a thing can be done, but is apt to make the circuit more complex.

\$\endgroup\$
1
  • \$\begingroup\$ I forgot to +1 this before, so I'll do it now while I remember :-) You point out the main issues clearly/concisely. \$\endgroup\$
    – Oli Glaser
    Feb 5, 2013 at 3:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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