Thursday, July 3, 2014

Experiment 6 Part 1 (Chapter 6) -- Fun With Comparators

Experiment 6 won't take you any time to wire up -- a fairly simple circuit, it's got the inexpensive LM339 chip that cost me about $0.35 each (bought a bunch at once from Jameco a month ago, along with other components to get me up to Experiment 15) and as Charles points out later in the chapter, LM339s are definitely old school. Yes, microcontrollers (like an Arduino) are often used to do comparisons these days, but it's still fun to see how a simple and cheap IC can be wired up to acknowledge whether a specific voltage meets a threshold.

For Experiment 6, the familiar phototransistor is part of the circuit. As the light on the phototransistor  changes, so does the voltage value felt on pin 5 of the ML339. A 5k trimmer (potentiometer) is used to "dial in" a test voltage (called the Reference Voltage) that is felt on pin 4. If the voltage on pin 5 is greater than the voltage on pin 4, the output pin (2) provides enough voltage to an LED to light up. Pretty cool!

Here's the video...

After you've built the circuit, you can tweak the 5k trimmer a bit until you get some flickering of the LED. You really need to see this in action, because it will help cement your understanding of the "hunting" that the comparator is doing... and the next discussion in Chapter 6 that shows how to prevent this type of thing. What's happening is that with very subtle changes in the light on the phototransistor, the comparator is turning on and off the LED quickly because the tiny changes in voltage are above and below the Reference Voltage. There's your flickering of the LED.

In the next post, I'll share the new circuit with some additional components that will remove this flickering/hunting effect.

No comments:

Post a Comment