Implementing precise single shots with AVR timer

Microcontroller timers are meant to count clock cycles in hardware, and there are many ways and configurations where timers are handy. First of all, timers are meant to work purely in hardware without utilizing CPU. Secondly, timers help generate waveforms like PWM, trigger events, count the time between events, etc. But there is one use that, in most cases, is missed and not documented – precise single shots that allow generating only a single pulse shot with precise length. And this method doesn’t require CPU to be involved – just set and forget. The idea of this method lies in using fast PWM (refer to datasheet for more info) mode a bit differently. Normally in this mode timer works by counting to TOP value; somewhere in between, there is a MATCH value where timer outputs HIG and drops to LOW when TOP is counted. This way, there is a PWM signal generated. Josh came up with the idea that, in this case, we can generate only single pulse by setting MATCH value above the TOP and setting the initial timer…

Continue reading

Everything you need to know about diodes

Diodes are commonly used discrete semiconductor devices. It has many uses and purposes. Its operation is based on PN semiconductor junction characteristics. Depending on diode’s physical and chemical properties, it can behave very differently. Together with other electronic components diode can be used for voltage clipping, multiplying, rectifying, signal, demodulation, protection, and even more. Elektro-labs have written a pretty nice review of diode types and their common uses. The simplest and probably most recognizable is regular diode which is used in switching, protection rectification circuits. Another common diode type is Zener which is used for voltage stabilization. Here are some of the most common types of diodes, along with examples of part numbers:

Continue reading

Handy voltage transition indicator circuit

You simply need a simple way to test the voltage on battery-operated circuits. On the other hand, complicated circuits don’t look very attractive. So to keep things simple and low-cost, Einar Abell suggests his single transistor voltage indicator circuit. It is able to detect the transition between two voltage levels on battery. Simply speaking, if the circuit is powered from 9V battery, then it will transition from green to red indicator when voltage foes from 7.1V to 5.8V. One downside of this indicator is that it drains about 1mA of current. For any battery, this is nearly not acceptable. To avoid constant drainage, drop a push button to test voltage when needed. Pros and cons of discrete voltage transition indicator circuits Pros: Cons:

Continue reading