Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIR Sensor Trips, Powers Microcontroller?

Status
Not open for further replies.

MitchV

New Member
The subject says it all but I'm afraid my ignorance is getting the best of me. From what I can understand I need a "flip flop" (or a relay?) but I'm not sure about that or where to start. I don't care at all to do the legwork (I *want* to, believe me), but I'm a bit overwhelmed.

Here is what I want to do :

Power the whole thing with a 9V battery. Have the PIR sensor hooked up directly to the power source and when tripped (the signal pin goes low), I want to power a microcontroller for a few seconds, then turn it off leaving the PIR sensor ready to go again. Ideally the microcontroller itself could shut itself down after it completes its tasks.

I'm lost and don't know where to start and the only electrical engineer I know is on vacation ;-)

Is a "flip flop" what I need and if so, can anyone give me an idea of how to build one?

Thanks!
 
Switch

As long as the output from the PIR is not to short this should work. The output from the PIR turns on the 9 volts to the micro. The micro then must output a signal to latch the power on until it has finished its task then allow the signal to go high.
 

Attachments

  • HS Switch.PNG
    HS Switch.PNG
    34.6 KB · Views: 438
Awesome, I'll take a look at this when I get home tonight and see if I can get it to work. Thanks *very* much!
 
Why don't you just power them both directly, then put the microcontroller to sleep, then have the low signal wake it up, then put it back to sleep when it's done?
 
I've actually done that but the power draw even in the deepest sleep mode I can use is still pulling 10ma or so. Keep in mind that I'm an absolute amateur at all of this but my understanding of that is that even a 10ma constant draw is going to eat up a 9V battery within 24 hours. I'm going to wire one up and real-world test it to see but thought that actually dropping the power to the MC all together would be best since the PIR sensor itself only draws a tiny bit of current.

The 9V battery is just for convenience, I might need to look at additional power sources for a better fit.
 
Then something is horribly wrong. What micro is it? A typical micro would draw 1-2 microAmps in sleep. Microchip just came out with a PIC16F1823 that actively runs at 1mhz on 75uA and sleeps at 30nA. I am not saying you should use that micro, I am just illustrating that 10ma is silly, you could fly to the moon on that.
 
Actually the whole thing is hooked up to an Arduino right now and I'm not 100% sure I got the sleep/interrupt stuff right. I'm using a bench power supply for testing and right now at 6V it is drawing 0.011A.

I inherited all of this equipment (and the Arduinos) so I'm slowly figuring out how it all works. I might be reading this power supply wrong (I can tell now that it doesn't have much of a way to show less than a milliamp since it's display is fixed). I'm going to hook up my multimeter to a battery source and see if I can better measure the current draw.

Thanks very much for taking the time to reply, I know it can be annoying to talk to greenhorns about the stuff that is probably common sense to most of you guys.
 
Ok, a "duh" moment of sorts.

First, I'm using the Duemilanove with the 328 and that's a HECK of a lot more than I need for what I'm doing. That, and there is a lot more than just the ATMega MP going on this board. I guess I thought that those other components needed no power or something. Geeze..

Using the proper sleep code I have the whole thing down to using 5mA but am confident I can get it quite a bit lower than that by using a different board.
 
OK, you should have specified that. I don't know much about arduino but I am familiar with the ATMega8. It is rated for 0.5uA sleep current. If we say that's an exaggeration and calculate at 1uA then your 9V will happily last 50 years.

I took a look at the schematic and 5ma is exactly what I would expect. The reason is the voltage regulator that takes you from 9V input to the 5V for the micro, the MC33269, has a 5.5ma quiescent current. Quiescent current is the current draw when nothing is happening.

Luckily the power header on the board allows you to bypass the regulator and power the micro directly. Unfortunately, the mega 8, is one of the few micros that actually requires 5v, so you cant run it from 2 AAs, although you might be able to get away with 3. Your second option is to get your own regulator with lower quiescent current and down convert it yourself. Here are some links to lower current regulators:

MCP1702, 2uA: MCP1702-5002E/TO Microchip Technology Low Dropout (LDO) Regulators

TPS7250, 180uA: Digi-Key - 296-8059-5-ND (Manufacturer - TPS7250QP)

Have fun.
 
Learning something new every day! Awesome stuff, thanks so much for taking the time.

Using an arduino mini I have it down to 0.38 mA. It's a 3.3 volt board but still has a voltage regulator on it so I think I'll grab some of those LDO regulators and see what I can do with it.

Thanks again!
 
You are welcome. If you have a 3.3V board, don't even worry about it. Just connect 2 AA or AAA batteries in series to the VCC pin. Even though it is nominally 3.3V, the mega168 will work down to at least 2.7V. Even at 0.38mA draw, the drain from 3.0v to 2.7v would take about 6 months. However, if you skip the regulator by using the VCC pin (only OK if you have a low voltage source), instead of the raw pin, im sure the current draw would be much lower than that. If they used the mega168v (you can tell by looking at the chip), then as long as you clock it at 4MHZ or lower, it will operate all the way down to 1.8V. You can get nice enclosed AA holders at radio shack: Enclosed 2 AA Battery Holder : Battery Holders | RadioShack.com
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top