I have a project in which I want the arduino to send some data to wifi when motion is detected by the PIR motion sensor.
I'm powering the arduino through three 1,5 V AA batteries (4,5 V total) and I've noticed that running the arduino all the time is very power consuming.
Is there a way to connect the PIR output sensor to the arduino power input in order to turn the arduino on while the sensor is active, and then turns off when there is no movement.
I tried connecting the output pin directly to the power input, but that wouldn't power on the arduino (current not high enough probably). I also tried this with a NPN 2N2222 transistor, connecting the PIR output to the base, the collector to the battery positive output, and the emitter to arduino power input. This would slightly turn on the "ON" led, but that doesn't seem right.
OK. Well in that case you still have the problem that 4.5v is marginal for an Arduino and as the batteries run down and/or get cold there won't be enough volts.
A couple of options.
1 Use a higher voltage rechargeable battery such as 2 LiPo cells (~7.2V) to supply Vin to the Arduino and use the 5V from the latter to supply the PIR.
2 Stick with the present batteries, have a "low drop out" (LDO) regulator to drop this to 3.3V for a 3.3v Arduino.
I think you will find that in both you need to put the Arduino into some sort of sleep mode to give decent battery life. It is probably not a good idea to just switch the Arduino supply off because it will take some time to reboot when it powers up and that might not suit your application.
You can setup controller deep sleep mode that it power consuming will decreased in hundreds times. The mcu will wake up from PIR sensor via interrupt.
This is a common way to arrange power saving for mobile applications.
It's not possible. You can power up a PIR sensor with an Arduino. But you cannot power up an Arduino from the output pin of a PIR sensor. The PIR output has a very low current. The current is not sufficient to drive an Arduino.
Switching a load and providing power out are two completely different things.
The PIR sensor is a data-level output and will NOT provide enough power to run any processor board. It will provide enough to turn on a MOSFET that controls a relay- as it likely in the Aliexpress module.
This Ali modules has in-board solid relay, that internally switched on and off by PIR output. It can be used to control small loads (for example led lamps) without any additional components.
I have used such module in my house, 220v variant - it turns on and off 20w LED lamp.
Ok, and how would I make sure the arduino stays on while there is movement detected.
If I'm not mistaken, the arduino gets reset through the reset pin on the falling edge, meaning if I connect the PIR output pin directly to the reset, it would wake the arduino up once the movement is gone, but I want it to turn on immediately.
I tried some circuits with the transistor, but can't seem to make it work. Any suggestions?
I thought about relays, but they seem a bit too expensive for my needs.
Yes, this will supply enough power to work some electronics, such as single arduino board.
But please note, that switching arduino on and off has nothing to do with sleep mode.
It will be quite difficult to get it work as expected OP if it turns on for a few seconds and starts every time from hardware reset.