# Add tilt switch to this photodiode circuit

I'd like to take this phototransistor switch circuit:

And add a tilt-ball or similar switch in series. That switch needs to be heavily debounced, so that it stays "switched" more or less for several seconds after the last contact, but does not need a sensitivity adjusting trimpot which the phototransistor is still going to need.

Here's my attempt:

The desired behavior is that the leds should light when it's dark out and the tilt switch has been jiggled around recently.

I don't know how to simulate either the phototransistor or the tilt switch and I don't have the parts on hand. Does my circuit above seem reasonable?

UPDATE:

I hadn't realized that the transistor pair is inverting, so I think the way I have it above if there's no light and there's motion it will shut off. If there's light or no motion it will remain on.

What I want is if there's light and motion turn on the load, if there's either light or no motion fade out & shut off the load.

Also this is intended to be battery operated so it's better if it consumes as little power as possible when off. To me this seems a little challenging because you might naturally want the phototransistor pulling down a pull up which is always going to waste a little current.

UPDATE 2:

This seems pretty close to what I want. Horizontal switch represents the spring switch, the vertical switch represents the phototransistor.

Only question is how to tune the phototransistor's sensitivity...

• It's not clear how you expect the tilt switch and the phototransistor to interact. Can you clarify what sort of behavior you want? – Elliot Alderson Jun 25 '18 at 0:50
• desired behavior = If it's dark and the circuit has been jiggled around recently, light up the leds – J Halcres Jun 25 '18 at 1:51
• jiggled around recently ... how recently? – jsotola Jun 25 '18 at 2:17
• like 30 seconds say – J Halcres Jun 25 '18 at 3:33
• to avoid false triggers or missing triggers, the amount of tilt force such as wind and twilight with stray light beamwidth and reflection, after trigger needs to be defined clearly to avoid hiccups – Tony Stewart Sunnyskyguy EE75 Jun 25 '18 at 3:33

for simulation you can use an opto-coupler (eg 4n35) to simulate the phototransistor, connect the opto-coupler input to a variable current source.

The spring thing is just a special kind of switch

As you have it drawn it will only go dark if it has recently been jiggled.

You're going to want to move the tremble switch and capacitor to the top end of R2 (the potentiometer)

Well, that just sounds like wrapping your circuit (you did say you wanted to take a specific circuit, which is fine with me) with a power supply that has a timer. Something like the following:

simulate this circuit – Schematic created using CircuitLab

Nothing is particularly critical, helpful since to me your specifications are kind of vague. Set the hold-duration timing by playing around with $R_1$ and $C_1$. I spec'd Zetex parts, but the PNP isn't critical and you can use most any PNP there so long as it can handle your circuit's current compliance requirements and can dissipate the needed switch power. The NFET just needs a very low threshold voltage so that your supply rail plays nice with it. $R_2$ is just a "pull-up" and not critical. $R_3$ must be sized sufficiently small in order to supply the base current that $Q_1$ requires, though. Whatever that may be. (As it is, you might get $1\:\text{mA}$ base current. Maybe.)

In case you can't tell straight out, the "DARK" box there is your circuit. Just wire it into that spot. SW is your wavy spring switch, if I follow your drift.

$D_1$ is needed. Without it the circuit can't rapidly reset itself to prepare quickly for another "shake" event. $D_2$ is semi-optional.

• where would the load (leds) go in this circuit? – J Halcres Jun 25 '18 at 5:59
• @JHalcres The circuit provides power for whatever circuit you insert as "DARK." The part is your problem. This circuit simply detects the spring contact and applies power for a fixed time you can set. That's all. – jonk Jun 25 '18 at 7:22