About Schmitt (Triggers)

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:

scope1

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.

Hysteresis

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.

Schmitt Trigger Symbol by Selket CC-BY 2.5

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.

 

schem21-wide

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.

Practical Applications

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.

Suddenly, Wireless Power Transmission Is Everywhere

Wireless power transfer exists right now, but it’s not as cool as Tesla’s Wardenclyffe tower and it’s not as stupid as an OSHA-unapproved ultrasonic power transfer system. Wireless power transfer today is a Qi charger for your phone. It’s low power – just a few amps — and very short range. This makes sense; after all, we’re dealing with the inverse square law here, and wireless power transfer isn’t very efficient.

Now, suddenly, we can transfer nearly two kilowatts wirelessly to electronic baubles scattered all over a room. It’s a project from Disney Research, it’s coming out of Columbia University, it’s just been published in PLOS one, and inexplicably it’s also an Indiegogo campaign. Somehow or another, the stars have aligned and 2017 is the year of wirelessly powering your laptop.

disney-research-quasistatic-cavity-roomThe first instance of wireless power transfer that’s more than just charging a phone comes from Disney Research. This paper describes quasistatic cavity resonance (QSCR) to transfer up to 1900 Watts to a coil across a room. In an experimental demonstration, this QSCR can power small receivers scattered around a 50 square meter room with efficiencies ranging from 40% to 95%. In short, the abstract for this paper promises a safe, efficient wireless power transfer that completely removes the need for wall outlets.

In practice, the QSCR from Disney Research takes the form of a copper pole situated in the center of a room with the walls, ceiling, and floor clad in aluminum. This copper pole isn’t continuous from floor to ceiling – it’s made of two segments, connected by capacitors. When enough RF energy is dumped into this pole, power can be extracted from a coil of wire. The video below does a good job of walking you through the setup.

As with all wireless power transmission schemes, there is the question of safety. Using finite element analysis, the Disney team found this room was safe, even for people with pacemakers and other implanted electronics. The team successfully installed lamps, fans, and a remote-controlled car in this room, all powered wirelessly with three coils oriented orthogonally to each other. The discussion goes on to mention this setup can be used to charge mobile phones, although we’re not sure if charging a phone in a Faraday cage makes sense.

motherbox-charging-phone-squareIf the project from Disney research isn’t enough, here’s the MotherBox, a completely unrelated Indiegogo campaign that was launched this week. This isn’t just any crowdfunding campaign; this work comes straight out of Columbia University and has been certified by Arrow Electronics. This is, by all accounts, a legitimate thing.

The MotherBox crowdfunding campaign promises true wireless charging. They’re not going for a lot of power here – the campaign only promises enough to charge your phone – but it does it at a distance of up to twenty inches.

At the heart of the MotherBox is a set of three coils oriented perpendicular to each other. The argument, or sales pitch, says current wireless chargers only work because the magnetic fields are oriented to each other. The coil in the phone case is parallel to the coil in the charging mat, for instance. With three coils arranged perpendicular to each other, the MotherBox allows for ‘three-dimensional charging’.

Does the MotherBox work? Well, if you dump enough energy into a coil, something is going to happen. The data for the expected charging ranges versus power delivered is reasonably linear, although that doesn’t quite make sense in a three-dimensional universe.

Is it finally time to get rid of all those clumsy wall outlets? No, not quite yet. The system from Disney Research works, but you have to charge your phone in a Faraday cage. It would be a great environment to test autonomous quadcopters, though. For MotherBox, Ivy League engineers started a crowdfunding campaign instead of writing a paper or selling the idea to an established company. It may not be time to buy a phone case so you can charge your phone wirelessly at Starbucks, but at least people are working on the problem. This time around, some of the tech actually works.

Continue reading “Suddenly, Wireless Power Transmission Is Everywhere”

Interview: Nacer Chahat Designs Antennas for Mars CubeSats

You have a shoe box sized computer that you want to use in a Mars fly by. How do you communicate with it? The answer is a very clever set of antennas. I got to sit down with Nacer Chahat, one of the engineers on the Jet Propulsion Laboratory team responsible for antenna design on Mars Cube One (MarCO). Two of these CubeSats that will soon be used to help a lander reach Mars. We talked about the work that went into MarCO, the deployable radar antenna he’s worked on for the RainCube project, and the early progress on OMERA, the One Meter Reflectarray.

This is a fascinating discussion of dealing with a multitude of engineering challenges including lack of available space for the antenna components, and power and weight limitations. Check out the video interview to see how the people at JPL fit it all into this, and other tiny satellites, then join us below for more details.

Continue reading “Interview: Nacer Chahat Designs Antennas for Mars CubeSats”

An Overview Of The Dreaded EMC Tests

There is one man whose hour-long sessions in my company give me days of stress and worry. He can be found in a soundless and windowless room deep in the bowels of an anonymous building in a town on the outskirts of London. You’ve probably driven past it or others like it worldwide, without being aware of the sinister instruments  that lie within.

The man in question is sometimes there to please the demands of the State, but there’s nothing too scary about him. Instead he’s an engineer and expert in electromagnetic compatibility, and the windowless room is a metal-walled and RF-proof EMC lab lined with ferrite tiles and conductive foam spikes. I’m there with the friend on whose work I lend a hand from time to time, and we’re about to discover whether all our efforts have been in vain as the piece of equipment over which we’ve toiled faces a battery of RF-related tests. As before when I’ve described working on products of this nature the specifics are subject to NDAs and in this case there is a strict no-cameras policy at the EMC lab, so yet again my apologies as any pictures and specifics will be generic.

There are two broadly different sets of tests which our equipment will face: RF radiation, and RF injection. In simple terms: what RF does it emit, and what happens when you push RF into it through its connectors and cables? We’ll look at each in turn as a broad overview pitched at those who’ve never seen inside an EMC lab, sadly there simply isn’t enough space in a Hackaday article to cover every nuance.

Continue reading “An Overview Of The Dreaded EMC Tests”

HackBusting: Can you Fake a TV Remote with a Lighter and some Paper?

We recently published an article where someone apparently controlled their TV by simulating a remote with merely a lighter and a sheet of paper. The paper had a barcode like cutout for a supposed “Universal Standby Signal”. The video rightfully attracted a substantial crowd, some awestruck by its simplicity, others sceptical about its claims.

Coming from some generic “Viral Life Hack” production house, the characteristic blare of background music, more suited to an underground rave than a technical video, certainly did not do it any favours. As any moderately experienced campaigner would know, modern televisions and remotes have been carefully engineered  to prevent such mishaps. Many of us at Hackaday, were under the impression that it would take something slightly more sophisticated than a fluorescent-bodied lighter and a crisp sheet of A4 to deceive the system. So we tested it out. Our verdict? Unlikely, but not impossible. (And we’re pretty sure that the video is a fake either way.) But enough speculation, we’re here to do science.

Continue reading “HackBusting: Can you Fake a TV Remote with a Lighter and some Paper?”

LTC4316 is the I2C Babelfish

The LTC4316 is something special. It’s an I²C address translator that changes the address of a device that would otherwise conflict with another on the same I²C bus. Not a hack? Not so fast. Exactly how this chip does this trick is clever enough that I couldn’t resist giving it the post it rightfully deserves.

On-the-Fly Translation

What’s so special? This chip translates the address on-the-fly, making it transparent to the I²C protocol. Up until this point, our best bet for resolving address collisions was to put the clashing chip on a separate I²C bus that could be selectively enabled or disabled. In that department, there’s the PCA9543 and PCA9547 demultiplexers which we’ve seen before. Both of these devices essentially act like one-way check valves. To address any devices downstream, we must first address the multiplexer and select the corresponding bus. While these chips resolve our address collision problems, and while there’s technically a way to address a very large number of devices if we’re not time-constrained, the control logic needed to address various bus depths can get clunky for nested demultiplexers.

What’s so classy about the LTC4316 is that is preservers simplicity by keeping all devices on the same bus. It prevents us from having to write a complicated software routine to address various sections of a demultiplexed I²C bus. In a nutshell, by being protocol-transparent, the LTC4316 keeps our I²C master’s control logic simple.

How it Works

I mocked up a quick test setup to have a go at this chip in real life. Continue reading “LTC4316 is the I2C Babelfish”

How A Van De Graaff Generator Works

What I particularly like about the Van de Graaff (or VDG) is that it’s a combination of a few discrete scientific principles and some mechanically produced current, making it an interesting study. For example, did you know that its voltage is limited mostly by the diameter and curvature of the dome? That’s why a handheld one is harmless but you want to avoid getting zapped by one with a 15″ diameter dome. What follows is a journey through the workings of this interesting high voltage generator.

Continue reading “How A Van De Graaff Generator Works”