Some kind of one-shot?

Thread Starter

Willsy

Joined Aug 23, 2018
13
Hi there

I have a battery powered loop (6V) broken by a normally open magnetic switch.

When a metal object passes close by, the magnet closes the loop, and the 6V is fed into the opto side of an ASSR-1218 solid-state relay.

I've sized the limiting resistors on the opto side to pull 5mA according to the ASSR-1218 datasheet. That closes an input into a micro-controller on the other side, which wakes it up and causes it to do its thing. All working.

However, I'm worried that if the metal object stops right next to the switch, the switch will remain on (could be for hours), pulling 5mA all the time, and steadily draining the battery.

How can I make the detection of a metal object send a single pulse of a few microseconds (approx 100 to be on the safe side), and then pull no current until the object moves away, which would reset the circuit?

Any thoughts?

Regards

Mark
 

Thread Starter

Willsy

Joined Aug 23, 2018
13
Why do you need the solid state relay?
Could you not connect the magnetic switch directly to the uC pin?
Hi Albert,

I can maybe do that... There's potential for it to be a long cable run. Maybe tens of metres. I don't know how much volt-drop one may encounter. Let's say it's a ten-metre cable run from the uC (which will be in a kiosk, mounted on DIN-rail) to the water purifiers. That's 20 metres (10 there, 10 back). What sort of volt-drop would one expect.

Maybe there's a calculator for that online somewhere. I'll have a search online.

Maybe volt-drop is not an issue. The input on the uC is weakly tied high, so the magnetic switch will simply ground the input.

Regards

Mark
 

AlbertHall

Joined Jun 4, 2014
12,625
The current will be very low so the voltage drop along the wire will also be very low. You might need a capacitor across the uC input if the wire picks up some interference.
 

Thread Starter

Willsy

Joined Aug 23, 2018
13
Thank you, Albert. I'll bear that in mind. Any thoughts/opinions of the value of the capacitor? The pulse from the magnetic switch will only be a few 10s of milliseconds (I think!).

BTW: I did find some online cable voltage drop calculators. As you mentioned, the voltage drop is indeed very low, so not likely to present a problem.
 

AlbertHall

Joined Jun 4, 2014
12,625
What current is the uC pull up?
The switch will discharge the capacitor quickly and it will then recharge from the uC current when the switch opens again. The value needed really depends on what frequency/amplitude the pickup on the cable is.
 

Thread Starter

Willsy

Joined Aug 23, 2018
13
There's a 20K pull-up resistor on the uC input, so, @5V current dissipated when switched to ground is 0.25mA

Mark
 

AlbertHall

Joined Jun 4, 2014
12,625
With a 100nF capacitor, after the switch opens, the recharge will take on the order of 2ms and be ready for the next switch input. The exact time depends on the threshold voltage of the uC.

So 100nF seems to be a good starting point.
 
Top