Imagine you have a black box with 5VDC and ground inputs and you have to create one output that is an oscillating signal. What is the simplest circuit that can do so? Can you create a tank circuit with an inductor and capacitor?

The output signal will be detected by a PIC. The frequency is not important but should be rather low (between 10 and 500Hz). The PIC will not measure the frequency but only detect if the oscillating signal is present or not present based on whether this "box" is connected or not. That means the signal can be sin, square, saw-tooth, whatever, the shape doesn't matter.

Bonus points for the cheapest, lowest component count and lowest real estate solution!

  • 2
    \$\begingroup\$ Put an oscillator that is powered off of 5v? That sounds like the simplest, smallest, and cheapest method to me. I guess I am not sure what your question is. \$\endgroup\$ – Kellenjb Jul 12 '11 at 14:19
  • \$\begingroup\$ I have never seen one with that low of a frequency... \$\endgroup\$ – PICyourBrain Jul 12 '11 at 15:06
  • \$\begingroup\$ Opps, I read that as 500 KHz. My bad. \$\endgroup\$ – Kellenjb Jul 12 '11 at 15:23
  • 1
    \$\begingroup\$ I could use a ring oscillator, made of 3/6 inverters in a hex inverter IC. But that would oscillate in the MHz range. \$\endgroup\$ – Thomas O Jul 12 '11 at 22:18

Lowest component count I can think of:

enter image description here

The 74HC1G14 is the single gate version of the 74HC14 in SOT-23 package.

OK, I lied. You can do it with less. Take a microcontroller with an internal oscillator and write this incredibly complicated program to output a square wave. Number of components: 1. Board space: 6 mm\$^2\$.

If you drop the frequency restriction you can use a LED: f ~ 374740572500000 Hz. ;-)

Also out-of-spec is the Schmitt-trigger inverter with the output connected to the input. That's also a 1-component solution. Should oscillate at a few MHz.

  • \$\begingroup\$ +1 for the uC, it's amazing how easy or best it is to add to the simplest of HW solutions these days. \$\endgroup\$ – kenny Jul 12 '11 at 15:51
  • \$\begingroup\$ Agree, it is just amazing that you can now get a complete microcontroller with a precision internal oscillator in a SOT-23-6 package. And one can build a prototype using the same part in an 8-pin DIP costing under 60 cents in single quantities. I think I'll add some to my next Digi-Key order just to play with. \$\endgroup\$ – tcrosley Jul 12 '11 at 22:26
  • \$\begingroup\$ fwiw - I posted my bit before I read where you mentioned the uC. I thought you just had the inverter circuit on 1st reading. \$\endgroup\$ – JustJeff Jul 13 '11 at 2:05
  • \$\begingroup\$ I ordered my free sample of the PIC10F200. Should here soon. Once I get the code nailed down I can even order them from MicrochipDirect pre-programmed and labeled for less money then most of the other solutions. \$\endgroup\$ – PICyourBrain Jul 14 '11 at 11:59
  • \$\begingroup\$ @PICyourBrain: sounds great. Does this mean that they also program smaller batches? And for a low price? \$\endgroup\$ – Federico Russo Jul 14 '11 at 12:15

You want low component count? How about this:

enter image description here

You apply power. The relay activates. The contacts open. The relay deactivates. The contacts close. The relay activates ...

It's also good as a buzzer, and for generating nice flyback voltages.

Be warned - the flyback voltages could kill a µC.

But hey - it's one single component - you can't get less than that without getting all quantum...

  • \$\begingroup\$ Nice one, but like you said about flyback: I wouldn't want to supply this signal to a microcontroller :-) \$\endgroup\$ – stevenvh Jul 12 '11 at 14:44
  • \$\begingroup\$ I made one once and it did not work well. For cleaner signal, I had to use 2 identical relays cross coupled as multivibrator \$\endgroup\$ – user924 Jul 13 '11 at 20:53
  • \$\begingroup\$ @rocket I used to use it to electrocute friends... \$\endgroup\$ – Majenko Jul 13 '11 at 21:37

One part: an ATtiny 13. Yes you'd have to program it to output a square wave, but it's a mere 8 pin device, you can run it on low voltage, and easily hit the frequencies you mention.


If I wanted a "real" standalone oscillator then something like Steven's Schmitt trigger gate (which I also mentioned in the monostable query) is a practical cheap and flexible electronic solution. You can use a pkg of 6 gates for lowest cost (as they are so common) or for minimum size use some of the tiny single gate packages. You could also use an opamp or comparator for the same purpose. A unijunction forms a relaxation oscillator with a very few parts. Neon and cap and resistor if getting desperate. Esaki / Tunnel diode and R !!! :-).

BUT if you want something smaller and cheaper and electronic that arguably satisfies the letter and spirit of you requirement even though it does not look like an oscillator in isolation, and that requires a single 0402 packaged 1 cent component then -

Software driven sawtooth oscillation cycle. Exponential charge of a capacitor using weak pullups, preceded by discharge of capacitor. With care this gives minimal cost, minimal area, no power drain except when testing (and hardly then), no EMI etc when not in use.

PIC pin to Capacitor. Cap other lead to ground.

Enable weak pullups. Make pin output. Set low.

Set pin to input. Measure time taken to go high as cap is charged by weak pullups. Repeat several times if desired to check value. Can be multicycle oscillator or single cycle.

Needs: One capacitor, relatively low value. Can be 0402 if desired (breathing hazard :-) ) Pin can even be used for other purposes if desired if cap not too large.

Weak pullups vary in current sourcing by ? 2:1 ratio. The above can be calibrated by adding one more cap on board with cap >> stray and pin capacitance. Cycling this cap tells you how strong the pullup is. Adding offboard cap in parallel increases charge time.

Similar can be done with an ADC pin. ADC version has advantage of part charge cycle response. By looking for the shape of the exponential charge curve you can tell how much capacitance is present in << 1 RC cycle.

An external pullup R can be added in each case if desired.

  • \$\begingroup\$ The 74HC14 is a bit more expensive than the single gate, so that's nice if you need >1 gate, which we don't. The rest I don't understand. Are you using the PIC to create a waveform? That's cheating. In that case I can do it with zero components: use the PIC's timer to output a square wave and input it on another pin. The PIC doesn't count as a component, because we already had that one. Besides, are you discharging the cap by making the I/O low? The PIC won't like that. uCs don't like capacitive loads! \$\endgroup\$ – stevenvh Jul 12 '11 at 17:10
  • \$\begingroup\$ Capacitive load is OK if specifications are not exceeded. Add an 0402 series R to limit current if desired (unnecessary). Discharging small caps with a PIC is often done and can be well within datasheet spec. Example: A 1 nF and a 100k pullup has Tc = 100 uS. Alter to suit. 100 pF may suffice. Pins cost money and area if not available :-). I thought about a 2 pin loop - but that also adds a connector pin and more real estate. In the absence of definitive specification the 1 x C seemed safer. (1 cent). If using a loop formal oscillation is not needed. Just probe for high/low loopback. \$\endgroup\$ – Russell McMahon Jul 12 '11 at 18:11

I would use a 555 timer IC, in astable mode. Two resistors and two capacitors.

Five components. $0.50.

This is not as clever as the other answers. But it will work. And 10Hz or 500Hz is easily attainable. And other engineers will see it and immediately understand. And you can easily tune it with a pot or by swapping components. This is the engineering solution.

I give myself 10/10 and no bonus points.

If what you really want is an obfuscated magical trick that depends on temperature, trace inductance, ritual animal sacrifice etc. then by all means use one of the analog hacks.


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.