Hardly a week goes by that some Hackaday post doesn’t elicit one of the following comments:
That’s stupid! Why use an Arduino when you could do the same thing with a 555?
That’s stupid! Why use a bunch of parts when you can use an Arduino?
However, we rarely see those two comments on the same post. Until now. [ZHut] managed to bring these two worlds together by presenting how to make an Arduino blink an LED in conjunction with a 555 timer. We know, we know. It is hard to decide how to comment about this. You can consider it while you watch the video, below.
There is an old saying: “In theory, theory and practice are the same. In practice, they are not.” We spend our time drawing on paper or a computer screen, perfect wires, ideal resistors, and flawless waveforms. Alas, the real world is not so kind. Components have all kinds of nasty parasitic effects and no signal looks like it does in the pages of a text book.
Consider the following problem. You have a sine wave input coming in that varies between 0 V and 5 V. You want to convert it to a square wave that is high when the sine wave is over 2.5 V. Simple, right? You could use a CMOS logic gate or a comparator. In theory…
The problem is, the sine wave isn’t perfect. And the other components will have little issues. If you’ve ever tried this in real life, you’ll find that when the sine wave is right at the 2.5 V mark the output will probably swing back and forth before it settles down. This is exacerbated by any noise or stretching in the sine wave. You will wind up with something like this:
Notice how the edges of the square wave are a bit fat? That’s the output switching rapidly back and forth right at the comparator’s threshold.
The answer is to not set the threshold at 2.5 V, or any other single value. Instead, impose a range outside of which it will switch, switching low when it leaves the low end of the range, and high when it exceeds the high end. That is, you want to introduce hysteresis. For example, if the 0 to 1 shift occurs at, say, 1.9 V and the 1 to 0 switch is at 0.5 V, you’ll get a clean signal because once a 0 to 1 transition happens at 1.9 V, it’ll take a lot of noise to flip it all the way back below 0.5 V.
You see the same effect in temperature controllers, for example. If you have a heater and a thermal probe, you can’t easily set a 100 degree set point by turning the heater off right away when you reach 100 and then back on again at 99.9999. You will usually use hysteresis in this case, too (if not something more sophisticated like a PID). You might turn the heater off at 99 degrees and back on again at 95 degrees, for example. Indeed, your thermostat at home is a prime example of a system with hysteresis — it has a dead-band of a few degrees so that it’s not constantly turning itself on and off.
Schmitt Triggers and How to Get One
A Schmitt Trigger is basically a comparator with hysteresis. Instead of comparing the incoming voltage with VCC / 2, as a simple comparator would, it incorporates a dead band to ensure that logic-level transitions occur only once even in the presence of a noisy input signal.
Assuming you want a Schmitt trigger in a circuit, you have plenty of options. There are ICs like the 74HC14 that include six (inverting) Schmitt triggers. On a schematic, each gate is represented by one of the symbols to the right; the little mark in the box is the hysteresis curve, and the little bubble on the output indicates logical negation when it’s an inverter.
You can also make them yourself out of transistors or even a 555 chip. But the easiest way by far is to introduce some feedback into a plain op amp comparator circuit.
Below are two op amps, one with some positive feedback to make it act like a Schmitt trigger. The other is just a plain comparator. You can simulate the design online.
If you haven’t analyzed many op amp circuits, this is a good one to try. First, imagine an op amp has the following characteristics:
The inputs are totally open.
The output will do whatever it takes to make the inputs voltages the same, up to the power supply rails.
Neither of these are totally true (theory vs. practice, again), but they are close enough.
The comparator on the right doesn’t load the inputs at all, because the input pins are open circuit, and the output swings to either 0 V or 5 V to try, unsuccessfully, to make the inputs match. It can’t change the inputs because there is no feedback, but it does make a fine comparator. The voltage divider on the + pin provides a reference voltage. Anything under that voltage will swing the output one way. Over the voltage will swing it the other way. If the voltages are exactly the same? That’s one reason you need hysteresis.
The comparator’s voltage divider sets the + pin to 1/2 the supply voltage (2.5 V). Look at the Schmitt trigger (on top). If the output goes between 0 V and 5 V, then the voltage divider winds up with either the top or bottom resistor in parallel with the 10K feedback resistor. That is, the feedback resistor will either be connected to 5 V or ground.
Of course, two 10K resistors in parallel will effectively be 5K. So the voltage divider will be either 5000/15000 (1/3) or 10000/15000 (2/3) depending on the state of the output. Given the 5 V input to the divider, the threshold will be 5/3 V (1.67 V) or 10/3 V (3.33 V). You can, of course, alter the thresholds by changing the resistor values appropriately.
Schmitt triggers are used in many applications where a noisy signal requires squaring up. Noisy sensors, like an IR sensor for example, can benefit from a Schmitt trigger. In addition, the defined output for all voltage ranges makes it handy when you are trying to “read” a capacitor being charged and discharged. You can use that principle to make a Schmitt trigger into an oscillator or use it to debounce switches.
If you want to see a practical project that uses a 555-based Schmitt, check out this light sensor. The Schmitt trigger is just one tool used to fight the imprecision of the real world and real components. Indeed, they’re nearly essential any time you want to directly convert an analog signal into a one-bit, on-off digital representation.
Sometimes you use a Raspberry Pi when you really could have gotten by with an Arudino. Sometimes you use an Arduino when maybe an ATtiny45 would have been better. And sometimes, like [Bill]’s motorcycle tail light project, you use exactly the right tool for the job: a 555 timer.
One of the keys of motorcycle safety is visibility. People are often looking for other cars and often “miss” seeing motorcyclists for this reason. Headlight and tail light modulators (circuits that flash your lights continuously) are popular for this reason. Bill decided to roll out his own rather than buy a pre-made tail light flasher so he grabbed a trusty 555 timer and started soldering. His circuit flashes the tail light a specific number of times and then leaves it on (as long as one of the brake levers is depressed) which will definitely help alert other drivers to his presence.
[Bill] mentions that he likes the 555 timer because it’s simple and bulletproof, which is exactly what you’d need on something that will be attached to a motorcycle a be responsible for alerting drivers before they slam into you from behind.
We’d tend to agree with this assessment of the 555; we’ve featured entire 555 circuit contests before. His project also has all of the tools you’ll need to build your own, including the files to have your own PCB made. If you’d like inspiration for ways to improve motorcycle safety in other ways, though, we can suggest a pretty good starting point as well.
You try to be good, but the temptation to drown out the noise of parenthood with some great tunes is just too much to resist. The music washes over you, bringing you back to simpler times. But alas, once you plug in the kids started running amok, and now the house is on fire and there’s the cleaning up to do and all that paperwork. Maybe you should have tried modifying a baby monitor to interrupt your music in case of emergency?
Starting with an off-the-shelf baby monitor, [Ben Heck] takes us through the design goals and does a quick teardown of the circuit. A simple audio switching circuit is breadboarded using an ADG436 dual SPDT chip to allow either the baby monitor audio or music fed from your favorite source through to the output. [Ben] wisely chose the path of least resistance to detecting baby noise by using the volume indicating LEDs on the monitor. A 555 one-shot trips for a few seconds when there’s enough noise, which switches the music off and lets you listen in on [Junior]. The nice touch is that all the added components fit nicely in the roomy case and are powered off the monitor’s supply.
When [Kerry]’s son asked him if there was a way to make a mouse click rapidly, he knew he could take the easy way and just do it in software. But what’s the fun in that? In a sense, it’s just as easy to do it with hardware—all you have to do is find a way to change the voltage in order to simulate mouse clicks.
[Kerry] decided to use the venerable 555 timer as an astable oscillator. He wired a momentary button in parallel with the left mouse button. A 50k mini pot used as the discharge resistor allows him to dial in the sensitivity. [Kerry] found that he maxed out around 5 clicks per second when clicking the regular button, and ~20 clicks per second with the momentary button as measured here. The mouse still works normally, and now [Kerry]’s son can totally pwn n00bs without getting a repetitive stress injury. M1 your way past the break to check out [Kerry]’s build video.
There are lots of other cool things you can do with an optical mouse, like visual odometry for cars and robots.
Logic probes are simple but handy tools that can be had for a couple of bucks. They may not be the sexiest pieces of test gear, nor the most versatile, but they have their place, and building your own logic probe is a great way to understand the tool’s strength and weaknesses.
[Jxnblk]’s take on the logic probe is based on a circuit by [Tony van Roon]. The design hearkens back to a simpler time and is based on components that would have been easy to pick up at any Radio Shack once upon a time. The logic section is centered on the venerable 7400 quad 2-input NAND gate in the classic 14-pin DIP format. The gates light separate LEDs for high and low logic levels, and a 555 timer chip in a one-shot configuration acts as a pulse stretcher to catch transients. The DIP packages lend themselves to quick and dirty “dead bug” construction, and the whole thing fits nicely into a discarded marking pen.
Servos are pretty basic fare for the seasoned hacker. But everyone has to start somewhere, and there’s sure to be someone who’ll benefit from this primer on servo internals. Who knows – maybe even the old hands will pick up something from a fresh perspective.
[GreatScott!] has been building a comprehensive library of basic electronics videos over the last few years that covers everything from using a multimeter to programming an Arduino. The last two installments delve into the electromechanical realm with a treatment of stepper motors along with the servo video below. He covers the essentials of the modern RC-type servo in a clear and engaging style that makes it easy for the newbie to understand how a PWM signal can translate into positional changes over a 180° sweep. He shows how to control a servo directly with an Arduino, with bonus points for including a simple 555-based controller circuit too. A quick look at the mods needed to convert any servo to continuous rotation wraps up the video.