Doorknob touch alarm 28
I recently found a doorknob touch alarm schematic while browsing Discover Circuits’ archives. The project was originally intended as a present for my brother’s dorm room, but a bad capacitor and the lack of a proper oscilloscope caused delays. It has not made it off the breadboard, and it probably will not until his next semester. The circuit contains a few basic elements, an flip-flop based oscillator, a set of delays, a flip-flop as a sensor, and the audible alarm.
The schematic

The oscillator
The first section of the circuit is an oscillator based on a flip-flop. Clock and D are both grounded while Reset is tied high. Hence, the output Q will only be high if Set (node 6) is high. When the output is low, the transistor Q1* is cutoff. This allows *node 6 to be charged with a delay relating to the system of impedances R1*, *R2, R3*, and *C3. Once the voltage at node 6 triggers Set, the output changes to high and Q1* is opened. *Node 6 then discharges out through the capacitor. Once node 6 is low enough, Set is no longer triggered and the output is automatically reset (because R is tied high) to low and the process is repeated.
The screen capture below shows node 6 charging and discharging as the blue trace. The yellow trace is the output at node 1. You can see that the output turns high when node 6 reaches the switching threshold of the flip-flop (about 1.8 volts). Right afterwards it spikes up due to feedback through C2*, but quickly starts discharging. The oscillator switches off when *node 6 returns below the 1.8volt switching voltage. Feedback through C2* draws *node 6 to ground before the process repeats itself.
In order to change the period of oscillation, adjust the value at C3*. If you would like to make the pulses longer, adjust *C2. The circuit works best right where it is at, though.
The delay and ‘sensor’
The output of the oscillator is divided down two paths. The time constants of the two delays are nearly equal and can be adjusted with the sensitivity potentiometer. The path to node 11 is the Clock input of the flip-flop, and the path to node 9 determines if there is an alarm or not.
In the capture above, node 9 high than the the clock. Hence, the flip-flop stays high when the leading clock edge triggers it to lock. When the doorknob is touched, your body absorbs some of the charge and node 9 charges slower. This can be seen in the capture below. When the clock edge rises, node 9 is not high yet and low value is locked into the flip-flop.
The alarm
The designer uses an audible buzzer in order to relay the alarm. This is also my intent for the circuit, but I use a LED in my photos because you cannot see sound. They are both attached to the inverting output of the second op-amp (Q-bar) because it is high when the alarm is triggered.
There is an endless number of uses for this circuit, but I will just name a few crazy ideas:
- Using the intended buzzer for your hotel or dorm room. (This is a bit more impressive than the old sock trick.)
- Connecting the output to a relay that triggers the doorbell for you house. Just make sure to put it in parallel with your standard doorbell switch. That way you can still hear the Fed-Ex man. (This one has a major cool factor when someone opens your door.)
- Tying the output into a security or home automation system. You could have the lights turn on as soon as you touch the door handle to scare the dog away from laying on the door.
Photo Gallery
Charging batteries with Solar energy 4
Depending on the application, charging batteries can be complex process. Charging methods range from constant voltage to pulsed and random charging. Once power is being delivered back into the battery, you have to know when to stop charging!
Once a battery is fully charged, the charging current has to be dissipated somehow. The result is the generation of heat and gasses both of which are bad for batteries. The essence of good charging is to be able to detect when the reconstitution of the active chemicals is complete and to stop the charging process before any damage is done.
Typically, common household batteries are charged with a current that is kept constant and relieved when the batteries reach a predetermined potential. However, solar cells typically generate a constant voltage of 0.5V and a varying current that depends on the amount of collected light. As such, a consant voltage charging model is easier to implement. I found two respectable tutorials on building your own charger:
- AA Battery Solar Charger
- Clean Power’s Solar battery project charger

The first solution uses a diode to stop the batteries from discharging when there is no sunlight. I highly reccomend including this protection. Unfortunately, neither project implements a charge limit. You have to remove the batteries and test their charge with a multimeter. A shunt regulator is the simplest way to regulate the upper limit.

Always be wary of schematics 3
Ladyada has an interesting rant on her new blog. In linear circuit analysis, we tend to ignore the difference between the positive and negative inputs. However, in practice positive feedback results in a bistable circuit. (Also read up on negative feedback.)
Usually everyone ends up remembering this detail the hard the way. While designing a tape head preamplifier she was utilizing this circuit from an application note:

After a few hours of staring at the circuit and debugging and wondering “man why the hell is this railing?” I finally look back at the datasheet and realize: oh its in positive feedback, of course its railing.
Just a reminder that the textbook (or pdf) isn’t always right!
A low power, long life LED flashlight circuit 16
Scouring the Internet for information on LEDs, I accidentally stumbled upon a PDF detailing a flashlight made from PVC. For the torch, he biases ultra-bright LEDs with ballast resistors as described in my LED lighting guide. This is a simple solution, but a with a slightly more complicated circuit we can extend battery life by over ten times!
Download PDF instructions for the inefficient version

Electrical losses in the flashlight
In this flashlight, each LED/resistor combination consumes 4.5volts at 30mA or about 135mWatts. The ballast resistor alone consumes 1.1volts at 30mA or about 33mWatts. Therefore, 25% of the power being drained from the batteries is lost in the resistor of each LED chain!!
Battery life
The ‘C’ size batteries in the PVC flashlight have a capacity of around 4 500mAh. If you build your flashlight with seven LEDs, there is a constant current drain of 7 * 30mA or 210mA. Dividing this into our battery capacity, it becomes obvious this flashlight will only stay lit for about a day. This is a far cry from the 50-100 hours claimed by commercial flashlights running on smaller ‘AA’ batteries.
Cutting your losses
As mentioned above, the ballast resistors are wasting 25% of our battery power. Electronic Design proposed a simple circuit to resolve this in a recent article. The front end of their circuit draws less than a milliamp of extra current.

The circuit is best described in two parts: one, the boost circuit function of Q1 and Q2, and two, the control circuit of Q3 and JFET1. Assume Q1 is off. With the battery voltage slightly above Q2’s VVB, a positive Q2 base current [iB = (battery voltage VBE)/RJET1] would flow. Q2 turns on, which switches inductor L1 to ground.
The end result is a 23volt pulse (as shown in Figure 2) across the series of ultra-bright LEDs. At 278kHz, the human eye cannot distinguish the difference between these pulses and a constantly lit LED. This saves even more battery power.
As the battery voltage decreases, the pulses become further apart. The brightness remains indistinguishable until the voltage falls near 2volts. (The circuit does not function well below 2volts) I doubt the PVC flashlight has this efficiency near the end of its life.
The extended battery life
According to Electronic Design, this circuit consumes an current equivalent to about 17mA. Powered by our ‘C’ cell in the PVC, this circuit could run for 265 hours! This is ten times the original PVC design.
DIY LED lighting Guide 24
LED lighting is becoming increasingly popular in fish tanks, case mods, and even household lighting. This article intends to be a comprehensive guide to their advantages, powering them, and creating dimming solutions.
- Why use LED lighting?
- Powering your LEDs with a DC source
- Using an AC source to drive LEDs
- Dimming your LEDs (with PWM)
- Purchasing LEDs

Why use LED lighting?
LED lights are extremely efficient compared to standard incandescent lighting. No other lighting source outputs as many lumens per watt. They are particularly efficient at producing a single color of light. Other light sources have to produce the entire spectrum and optically filter out unwanted colors. However, LEDs can be manufactured to produce only one wavelength of light. This makes them particularly useful in stop lights.
Another advantage to LEDs is their operating temperature. Most available today can be function for hours and remain cool to the touch. Directionality is another key property. They only emit light over a relatively small angle. This can be advantageous for reading lights, but hinders performance when attempting to light an entire room.
If the advantages of LED lighting interest you, Myths Busted, LED Lighting is an excellent article by a researcher in outdoor lighting solutions. (And the source of most my information.)
Powering your LEDs with a DC source
Warning: Driving your LEDs with too much current will permanently disable them.
If you attach LEDs directly to an unlimited power source, they naturally draw enough current to blow themselves out. Therefore, the driving current must be limited with a resistor. The relationship as described by Ohm’s Law, is V = I*R where V is the voltage over the resistor, I is the driving current, and R is the limiting resistor. Two example circuits are shown below. These particular LEDs are rated at 25mA and are powered by a 12 volt regulated supply.

Each white LED gives a voltage drop of 3.6 volts. As an example for a 12 volt light, you can run a maximum of 3 white LEDs in series at full power (3.6 x 3 = 10.8 volts drop). Subtract this from your supply voltage of 12 volts to get the additional voltage that must be dropped (in this case, 12 - 10.8 = 1.2 volts of additional drop needed). In this case, 1.2 volts of additional drop / .025 amps (25 ma) = 48 ohms… resistors are rated in watts. So in this case, 1.2 volts x .025 amps = 0.03 watts. A 1/4 watt resistor would work fine.
The tutorial above also explains how to construct a 12 volt voltage regulator from any 12+ volt DC source. Voltage regulation is highly recommended because large shifts in your driving voltage can cause the driving current to increase and burn out your LEDs!
If you are in doubt of your calculations, use one of the many LED resistor calculators.
Using an AC source to drive LEDs
It is also possible to convert an AC source to DC. My favorite way to accomplish this is with a bridge rectifier as shown below. As an added bonus, R is easily calculated using the method above.

In operation, a DC voltage of around 170 is produced from the bridge rectifier and 50uF capacitor. The capacitor value is not critical and can be anything from 20uF or more… To find the resistor value and wattage, multiply the number of LEDs by the individual LED voltage. Then subtract this number from 170 and divide the result by the desired current (usually 20 milliamps).
Dimming your LEDs (with PWM)
Using pulse width modulation (PWM) to dim your LEDs is extremely important! Simply decreasing the input voltage yields unreliable results and potentially reduces their life-span. Pulse width modulation basically pulses the source voltage on and off so quickly that your eye is unable to distinguish the difference.
PWM can be implemented using a variety of methods. The simplest is switching on/off the output of a microcontroller. There are also several circuits that implement PWM. My favorite method uses two comparators. The details are excruciatingly painful and may deserve their own article someday.

The first example uses the standard op-amp oscillator circuit to generate a triangular waveform which is level-shifted and fed to a comparator (e.g. LM339) to give the PWM waveform.
Purchasing LEDs
LEDs are available all over the Internet. Recommending a single source or particular LEDs is hard as prices, projects, and the LEDs themselves may vary. If you are planning on starting an LED lighting project, it is best to do some research. For smaller applications, like a reading light, it may be more cost-effective to skip out on the top-of-the-line and buy a few more (relatively) cheaper LEDs. If you want to build a moonlight for your fish-tank, then you don’t need all those lumens blinding your fish!
Laser communication via serial port (and more?)
Lately I have been daydreaming a lot in my laser communication course. Surfing around Google after class, I managed to find an article on sending serial port data over a laser link. The article is rather old (1997), but was published in a prominent Australian magazine. This is way back when a good, red laser pointer was only $70.

All said, this is an interesting read. It would be nice to see this applied to more practical situations. Many computers do not even have serial ports anymore. We have been discussing the feasibility of using a laser to send video signals in the DIY Live Forums. The idea is great because running cable your projector is often a major problem in home theaters. Unfortunately, I have no home theater and my only only monitor is an old, huge CRT. I will have to find another excuse to play with lasers.
On a side note, it is theoretically possible to send terabits of data per second over one channel, because the optical frequency of a laser is extremely high (~460 terahertz for a red laser). This bandwidth is limited to mere gigabits by the response time of current optical detectors and circuitry, though.
Sine wave generation techniques
I recently discovered an interesting application note from National Semiconductor in October of 1999. The article details nine sine wave generation techniques. Some techniques can be accomplished several ways so there are more than nine circuits available. The note also tabulates each technique with its frequency range, typical distortion, and amplitude stability. Both fixed frequency and adjustable frequency oscillators are covered. The simple crystal oscillator also has one of lowest distortion rates.

Building a binary clock
If you have ever wanted to build your own binary clock, then Building a binary clock is the best reference I have ever seen. The page lists complete schematics and explains their functionality in detail. In my opinion, it looks a lot geekier straight from the breadboard!

Don’t forget to check this diy binary clock out, too.














