Ack! This site is moving to tomhorsley.com since Comcast's efforts to improve their world's worst customer service ranking apparently include terminating web hosting for their existing customers.

Gadget Mark II

NOTE: This document is somewhat obsolete. The improved Mark II description (with updated diagrams and less chaotic organization) can be found here.

Introduction

If you haven't read about the previous gadget, you won't know what this one is supposed to do, so you might want to bop over there are read the motivation section first.

Having more Christmas vacation to kill, I was irresistibly drawn to work on the much improved Mark II silly phone contraption. Investigating ways to implement some of my To Do list items from the previous gadget I found a web page devoted to the wonders of the LM339 comparator chip, which turns out to be exactly what I should have been using instead of the LM324 op-amp.

I also found another web page which includes a 555 timer circuit demonstrating how to rig a capacitor and a few other components to turn a really long low signal into a one-shot pulse (which the 555 requires).

New Detector

Putting the bits together gave me this new and improved circuit for the light detector. The output is a single low pulse to trigger the 555 no matter how long the photocell stays lit (the output from the LM339 is low all the time the resistor is lit):

Note 1: The R1 resistor isn't strictly necessary. Originally I just went directly to +5V, but since I want this thing to be battery powered, I decided to see if adding a resistor to cut down on the total current the bridge draws would help, and measurements showed that it did. Right now, I have a 12K resistor there, but I should probably experiment to see how big I can make it before the circuit starts to get erratic.

Note 2: The R3 resistor is the photoresistor. From the web page I referenced above comes the advice that R2 and R3 should be related thusly: R2 = 3 * R3 (when R3 is measured while fully illuminated (i.e. the minimum resistance it normally has). Currently I have a 5.5K resistor in place for R2, but that will obviously need adjustment based on the way the phone and photoresistor work together in the actual Mark II enclosure (yet to be designed).

Note 3: The R4 resistor acts as a pull-up, and is another source of power drain. I currently have a 5.6K resistor in place, but again, I should experiment with larger values and see how high a resistance I can use before the one-shot stops shooting :-).

Also note that the NAND gate is gone. By hooking up the bridge voltages in the opposite sense, I can get the output from the LM339 to be low when the resistor is illuminated and high when it is dark, so I don't need to switch the output around (I coulda done that with the old LM324 as well - Doh!).

Improved Timer

The 555 timer is similar in spirit to the old one, but many details changed:

The most important change was picking much more reasonable values for the timing resistor and capacitor. This combo produces about 0.3 seconds of output (I actually measured it by using my phone's voice memo feature to record the sound of the relay clicking on and off, then checking the relative times of the click spikes in a sound editor program :-). The 0.3 seconds is much better than 20 seconds, being much more like the time you might actually press a doorbell button. This will also save power by not driving the relay for so long.

See below for another change. The reset pin (pin 4) is no longer hooked to +5V, instead a delay circuit has been added to prevent the relay from triggering on power-up.

Apparently it is a good idea to add a capacitor from ground to the control voltage line when you aren't using it for anything, so that is new on the Mark II.

Same Old Relay

Anther major power saver was the use of one of the new low power 555 timer chips. Using this chip eliminates any possibility the 555 might be able to drive the relay directly, so the final part of the Mark II is the exact same relay driver circuit from the original:

Connect the 555 output to the 100 ohm resistor input of the relay driver, hook an LED to the relay switch for testing, and you can watch the LED flash once (and only once) each time you illuminate the photoresistor.

New Breadboard

Here's the new and improved breadboard setup with a highly sophisticated photoresistor holder consisting of a 4 ounce dixie cup with a lens cap that happens to fit on the bottom:

Note that you can see the container of paper mache paste in the background :-). Here's the dixie cup photoresistor holder with the lens cap off:

Results

With the breadboard complete, I was able to hook up a meter and measure the current it draws. In the idle state (with the photoresistor in the dark, the way it will be most of the time), the circuit only draws 0.9 mA. Since the old circuit draws 5.5 mA in the same conditions, the Mark II should have about 6 times longer battery life. If the phone rings a lot, it will be even longer (since they both still draw about 130 mA to power the relay, but the Mark II only runs the relay 0.3 seconds, instead of 20 seconds). If I'm lucky, I can get the current even lower by fooling with the resistors (but I need to wait till the new enclosure is built to test under actual conditions).

Meanwhile, it has now been about 8 days since I put the initial gadget into service, and it is showing signs of the batteries going dead. It is no longer nearly as responsive to light as it was at first. Clearly a max life of maybe 10 days for the batteries isn't good enough. I need to get on with the Mark II (although I suppose I could have a separate subsystem that runs off wall current most of the time, unless there is a power failure, in which case a normally active relay could switch in the batteries).

New Enclosure

I'm merely in the initial thinking stage for the new enclosure, but my experiences with the dixie cup have convinced me that absolute darkness isn't as critical as I thought (I can deactivate the test circuit by just hovering over the photoresistor with the lens cap - being completely covered is not essential).

Right now I'm thinking about a small platform I can just set the phone on and cover with a shell that slides over the edges of the platform. A small groove in the platform could let the charger cord fit without letting in a significant amount of light.

This would also let me get rid of my manual disarm switch. I could put the photoresistor inside the covering shell facing down, and it would simply hook into the circuit with a couple of sliding contacts that don't touch until the cover is almost all the way over the platform. Perhaps a couple of spring loaded conductive disks in the base that press against contacts in the cover would work (but of course I'd never use pennies - wouldn't want to get in hot water with the Treasury department :-).

All the batteries and circuits would be in the base. This will give the base enough weight to stay in place while putting the cover on or taking it off (and the cover can be a fairly loose fit anyway).

The only question is finding an existing box (or PVC pipe fittings, or a big Russian doll, or something) I can adapt, or building one from scratch (maybe I could sculpt a stylized cell phone box from paper mache :-).

Nah! Too complicated to use. I don't really want to have a box bigger than the phone I need to be lifting the top off of (which will be a pain if I have my hands full or no convenient place to set the top while putting the phone in).

My new favorite design idea could be harder to build, but much simpler to use. Unfortunately it is also complicated to describe in words as well, but I'll try. Basically I want a vertical slot I can slide the phone in sideways. The slot would be just exactly as wide as the phone is thick, and probably lined with felt to make good contact with the phone. A stop at one end would leave the phone positioned in the same place every time I insert it in the slot, so the photodiode could simply be in a hole in the side of the slot that will be facing the phone display as it sits in the slot. Shoving the phone all the way in would also hit the switch to arm the system. The key will be making it tight enough to block light from the photodiode, but not so tight it is hard to get the phone in.

The problem with this scheme is the possible potential for false triggers. The photoresistor takes a while to increase the resistance once it gets dark, and it might be possible to shove the phone in fast enough to arm the system while the resistor is still too conductive.

Various schemes are possible to avoid this. An extra timer in the circuit could hold the main 555 timer reset while the resistor is "cooling down" (but extra circuits means more current consumption). Some mechanical device could keep the resistor in the dark normally and slide out of the way as the phone is slid into the slot. Perhaps the resistor is on a weighted rocker arm that gets pushed down by the phone, thus exposing it. Perhaps a spring loaded shutter is pushed sideways by the phone. Perhaps a pivoting shutter is pushed up by the phone sliding into the slot. Some scheme like this should work (that's assuming there is actually a problem).

Perhaps the thing to do is make a crude version and experiment to see if a shutter will even be necessary. One possible advantage of the shutter would be also making the shutter be an integral part of the arming switch so that the shutter reaching its maximum movement make the final contact to complete the arming.

More Circuitry

Nah! Forget the shutter too. I have had my (hopefully) final "Doh!" moment: If the power is switched off while the Mark II isn't in use, then the battery drain will be as small as it can physically be. The obvious way to go is to have the switch cut the batteries in and out of the circuit, not the photoresistor. Currently the relay is always triggered once on power-up, so I can solve that problem as well as the slow photoresistor problem by adding a circuit to keep the 555 reset input low for the first two or three seconds after power up. Whatever load the timer adds should be negligible compared to the savings by having the power completely off while not in use.

Also, since 3/4ths of the LM339 is not yet in use, I ought to be able to whip up something like another bridge circuit with a capacitor instead of a photoresistor in one leg, and feed voltage across the bridge into one of the LM339 input pairs with the output going to the 555 reset pin.

Going back to the breadboard for a bit of experimenting, I came up with this circuit:

This appears to work fine. No relay trigger on power up, and if I expose the photoresistor within the first 4 seconds, I also don't see the relay triggered.

The extra power drain appears to be negligible. Instead of normally drawing 0.9 mA, I now draw 1.0 mA (2.0 mA while the capacitor is charging up at power up). I still haven't made any changes to increases some resistor values here and there, so I can probably get the current lower in the end.

Final Mechanical Design

My final design for the new Mark II gadget is simplicity itself. Basically just a felt lined surface with a hole in it the phone display will rest on top of, and an upside-down L shaped piece sticking up that I slide the phone under. That will press up a flap that turns on the power (I removed the cute little micro switch pushbutton from the spare doorbell transmitter - it is just the thing to mount under the L for the phone to push on when it is placed on the Mark II).

I have found a nice box for the Mark II - an old non-functioning frequency meter (taking it apart, I see why it is non-functioning - all the copper is peeling off the PC board :-). It already has a place to hold a 9 volt battery, so it would be very convenient to adapt my circuit for 9 volt operation. Adding a small resistor in series with the 5 volt relay coil will prevent it from getting blowed up by too much voltage, and the chips I'm using are all rated for operation over a wide range of voltages, so that shouldn't be a problem.

Experimenting with my breadboard, however, I find the quick power up delay hack I rigged up never decides the system is powered up. I'll need to experiment with it some more. (Fixed it, but need to revise some of the schematics one of these days once I finalize everything).

If I get really ambitious, I may want to add a blinking LED that comes on when the circuit is triggered the first time and keeps blinking till I take the phone out.

Yet More Circuitry

OK, having 2 of the 4 comparators laying around doing nothing was an irresistible challenge to use them for something, so here is the first circuit - a single bit of memory that remembers if the relay was ever triggered (since power up).

And now that I can keep track of the fact that I once noticed the phone rang, here is a circuit to use the last of the comparators as a pulse generator to flash an LED.

The above circuits were both from the application notes from the National Semiconductor spec sheet for the LM339. The one bit of memory was adapted from an OR gate (by feeding back output to input as the memory device), and the pulse generator simply had the resistors and capacitors adjusted to get a reasonable flasher and the transistor added to switch the whole thing on only when the memory bit gets set. Now the breadboard has a veritable fountain of wires sprouting from around the LM339 :-).

The circuit still uses less power than the original (even with the memory and flasher added), and I've just discovered that TI makes a special very low power CMOS version of the LM339 comparator, so if I can get my hands on one of them, I might be able to make it use even less power.

And another power related note: This is Jan 27th, and it looks like the batteries have finally died in the mark I (not quite as soon as I thought they would from early returns, but still about a month is not a really good lifespan for a battery powered device).

Just another random idea: If I hadn't already decided I liked the idea of disconnecting the batteries when the phone isn't in use, it did occur to me that a really clever way to arrange things might be to use two photoresistors - one facing the display, and one facing a different part of the phone that doesn't light up. Then I could trigger the timer only when the display is lit and the control detector is dark. If I pick the phone up, both detectors will be lit, so that wouldn't trigger the display, and if the phone is covering them, but there is no call, both will be dark, so that wouldn't trigger the timer either. A clever idea, but it doesn't beat just turning off the thing when I'm not using it :-).

Page last modified Sun Feb 6 17:57:44 2005