I'm trying to debug a circuit that's having either a frequency- or pulse-width dependent glitch. We're using a hall-effect sensor to measure RPM on the Boldsprints equipment and under mysterious and hard-to-reproduce circumstances, the microcontroller that bridges the sensors to the software crashes. Maybe we're exceeding the frequency input of the micro. Perhaps the sensor isn't triggering for long enough. Maybe there's excessive noise on the line. Well, at least the first two conditions are easy enough to rule out or verify by swapping out the sensor input for a function generator. The only problem is - this isn't for work, and I don't own a function generator. So, I took the day to make one.
The ckt:
The scope shot:
It's a straight-forward circuit using two LM555s. I cascade an astable 555 into the trigger of a monostable 555, and sweep the Ra of each to vary frequency and pulse width, respectively. In retrospect, I should have used LMC555s - a CMOS version that has full-swing TTL output... but more on that below the notes. As it is, I can dial the pulse width from 110uS to 12.5mS and sweep the frequency from 12Hz to about 2.5kHz using the two 100k potentiometers. I can generate negative and positive pulses (by exploiting aliasing!). The signal swing is from 0V to 3.7V. The overshoot is minimal.
And because there's nothing sacred in engineering... the notes:
Congrats - you made it to the bonus geek-out portion. Why should I have used an LMC555 over the LM555? Well, it's the difference between CMOS architecture and old-school bipolar processes. Here's the schematic for the National LM555. For the purposes of this discussion, we only care about the output stage - specifically the pull-up transistors Q27 and Q28.
The LM555 is old. In addition to being incredibly cheap, it uses a very old-school bipolar process. Now, a modern bipolar process typically has comparably good P- and N-type transistors, so you'll often see a push-pull output stage that has pretty good output swing. However, Back In The Day, the P-type transistors (PNPs) were really crappy compared to the N-types (NPNs). Specifically, the P-type had really low beta (low gain), and couldn't slew a lot of current. So, a push-pull output wasn't an option for the LM555 designers. Instead, the LM555 has two NPNs (Q27 and Q28) configured as a totem pole to slew a lot of current at the output (which is necessary if you want your square wave to look square). When the LM555 is driving high, Q27 is always on, and the maximum output voltage is one Vbe down from the rail (Vbe is typically 0.6 Volts, give or take) plus the voltage drop across R12. When the load current is high enough so that the voltage drop across R12 (3.9k * Iload) exceeds the Vbe of Q28, then Q28 will turns on, which increases the current drive capability of the output but has the trade-off of limiting the output swing to within 2x Vbe of the top rail. My function generator circuit is driving a 50 Ohm resistive load (which requires a fair amount of current - 3.7 Volts / 50 Ohms = 74 mA), so it's no surprise that the output of my circuit settles at 3.72V instead of 5V.
In the CMOS-based LMC555, the output is driven by a beefy inverter - an inverter being a P-type MOSFET stacked on top of an N-type MOSFET. Once nice thing about FETs is that you can design them to have very low on-resistance (Ron), and the output of such an inverter will be able to swing to within Ron * Iload of either rail. So, in order to improve on the LM555, all the C555 designers had to do was specify the "max" output current load and the output swing to exceed the specs of a bipolar 555, having already sized the output FETs accordingly.
2 months ago