Pages: [1]   Go Down
Author Topic: Switch Arduino ON, it does tasks, then Switches self OFF  (Read 1055 times)
0 Members and 1 Guest are viewing this topic.
Durham UK
Offline Offline
Full Member
***
Karma: 1
Posts: 167
aka Craig Turner
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

Please see attached schematic.

I wanted to make a circuit that detects an intruder using a pressure mat (which I guess is really just a big switch you can stand on). The mat triggers a thyristor which powers the Arduino. When the Arduino has finished it's tasks of sounding alarms etc... the last task it does is make a pin go from LOW to HIGH connected to a transistor which triggers a relay. The relay switches to expose the input of the thyristor to low current (ie below the holding level) and the Arduino switches off.

I made the circuit on breadboard and it worked when I just grounded the thyristor input using a reed relay but the current was too high and it blew the relay.

I would welcome some feedback on the new circuit using the SPDT relay but I'm not sure if there are better ways or I may blow further components etc... The zener diode is there to limit the voltage on the thyristor gate, which along with the resistor R2 is to limit power to the gate. I tried it on a simulator and it works in theory.

Many Thanks



* Alarm1.gif (7.75 KB, 600x700 - viewed 28 times.)
« Last Edit: August 11, 2011, 09:36:25 am by trendski » Logged

Craig Turner, blog: http://gampageek.blogspot.co.uk/ It helps with my learning if I write things down, esp. for others to follow (constructive comments welcomed to improve)

Offline Offline
Full Member
***
Karma: 0
Posts: 167
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't have any comments on your schematic, but have you considered just using sleep mode for your atmega rather than hard powering it up and down?  I've seen people claim years of runtime potential out of a AA pack, so you shouldn't have any problems with a large lead acid battery.  Then all your circuit would need is a weak pull up on your interrupt pin and your floor switch.
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6619
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Looks like it might work, but overkill. You don't need the zener or the 4k7 resistor, the 10k resistor in series with the gate provides all the voltage/current limiting you need. Also I can't see the point of R3.

If you use a transistor or MOSFET to do the switching instead of a thyristor, you won't need a relay to switch it off. How about this (see diagram). Pressing the button sets the flip-flop and provides power to the Arduino via the transistor. When the Arduino writes a 1 to the digital output, this resets the flipflop and turns off power to the Arduino provided the button is not pressed. The power consumption of the 4001 in the off state is tiny provided you connect the 4 unused inputs to gnd.

The 4k7 resistor in my circuit assumes that your total load is 100mA or less and you are using a BC327 transistor. If the load is higher you will need a smaller resistor and perhaps a PNP power transistor - you can choose the resistor to limit the transistor collector current to a safe value when the transistor switches on and the capacitors in the Arduino charge.



* tCad2.png (10.36 KB, 1495x1060 - viewed 22 times.)
« Last Edit: August 12, 2011, 02:05:07 am by dc42 » Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Durham UK
Offline Offline
Full Member
***
Karma: 1
Posts: 167
aka Craig Turner
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Guys,

thanks for the suggestions.

Quote
have you considered just using sleep mode

I'll use low-power mode to save juice for the Arduino, but I will still need to switch other power hungry stuff such as lights, klaxons, maybe even video recorder etc..

I've dropped the zener and superfluous resistors and all works fine.

I couldn't get the flip-flop circuit working in the simulator - I might be missing something though. Your suggestion pointed me to google gates and latches etc.. I got a NAND D-type latch working in simulator (plse see schematic attached) http://en.wikipedia.org/wiki/Flip-flop_%28electronics%29#SR_NOR_latch.


* NANDSwitch.gif (6.61 KB, 700x600 - viewed 15 times.)
« Last Edit: August 12, 2011, 04:01:41 am by trendski » Logged

Craig Turner, blog: http://gampageek.blogspot.co.uk/ It helps with my learning if I write things down, esp. for others to follow (constructive comments welcomed to improve)

Durham UK
Offline Offline
Full Member
***
Karma: 1
Posts: 167
aka Craig Turner
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Just got flip-flop working with minor ajustments!

I realised I was using a NPN instead of PNP tranny. The original uses PNP.

See attached. I swapped the Arduino PIN to hit the 1st input on NOR gate U1A and the Sensor switch to hit 1st pin on U1B (these are other way round on original).

Cheers!


* Flip-FlopSwitch.gif (5.54 KB, 700x600 - viewed 18 times.)
« Last Edit: August 12, 2011, 04:20:10 am by trendski » Logged

Craig Turner, blog: http://gampageek.blogspot.co.uk/ It helps with my learning if I write things down, esp. for others to follow (constructive comments welcomed to improve)

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6619
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Glad you got it working. My design used a PNP transistor (BC327, emitter connected to battery, collector to Arduino). Yours uses NPN (collector to battery, emitter to Arduino). That's why you had to swap the inputs. Mine drops about 0.1 volts across the transistor, yours about 0.7v or a bit more, so mine will work down to a lower battery voltage - but that probably doesn't matter.

If the power-hungry devices are switched using n-channel mosfets or npn transistors, you may not need to switch the supply to them, because when the Arduino is powered down the transistors/mosfets will be turned off anyway.
« Last Edit: August 12, 2011, 04:10:24 am by dc42 » Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Durham UK
Offline Offline
Full Member
***
Karma: 1
Posts: 167
aka Craig Turner
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Many Thanks for that.

I just modified my post before I saw your latest post, 'cos I realised my silly mistake of mixing up tranny types.  smiley-red

It's a steep learning curve! Phew.

I'll go ahead and use the Flip-Flop approach now, but just out of interest, when would you use a thyristor of this low power type?

Cheers?
« Last Edit: August 12, 2011, 05:46:35 am by trendski » Logged

Craig Turner, blog: http://gampageek.blogspot.co.uk/ It helps with my learning if I write things down, esp. for others to follow (constructive comments welcomed to improve)

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6619
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I just realised a problem with that circuit (both my original and your version). You're running the flip flop from a 12v battery, so the 5v output from the Arduino digital pin is unlikely to be enough to switch it over. I suggest you use an NPN transistor and 2 resistors to amplify the 0v->5v output into a 12v->0v output. Then use one of the spare gates in the 4001 to invert that, giving you a negative going signal to feed into the flip flop.  Or replace the 4001 by a 4011 so that you have a flip flop triggered by negative signals instead of positive ones.

The problem with thyristors is that you need to reduce the current through them to near zero to turn them off. The best uses of a thyristor I can think of are with an AC supply, or in a capacitor discharge circuit, or as the crowbar in an over-voltage detector (the crowbar shorts the output of the power supply - the intention is to blow the fuse).
« Last Edit: August 12, 2011, 07:16:00 am by dc42 » Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Pages: [1]   Go Up
Jump to: