Currently I am working on a rather simple project that uses an IR sensor to operate a peristaltic pump when movement is detected 5 centimeters from the sensor.
I successfully worked out the attached circuit which works exactly how I want for now.
The next step in the project is to massively decrease the size and get rid of the USB power supply, but for this I had some newbie questions:
Would this exact set-up also work with a Arduino Nano or Mini?
I want to make this battery powered (depending on the board (Uno, Nano, Micro, ...) which types (and how many for the necessary voltage) of batteries should I choose so it can work for a sufficiently long time? The sensor is triggered 10 times every hour and should last at least some months.
How can one estimate the battery lifetime of such a set-up?
I might also be able to change the sensor to this one, if it is better for the battery lifetime?
Nano is the preferred version for practical applications. Pro Mini is even smaller - and marginally cheaper - once you no longer require the USB interface.
A PN2222 (600 mA maximum) is completely unsuitable for that pump which presumably has a stall current in excess of 2 Amps. Not to mention the stupidity of not having a base resistor. You need a logic-level FET. An IRL540 would be perfect, readily available on eBay if you can wait.
TheChimaira:
Currently I am working on a rather simple project that uses an IR sensor to operate a peristaltic pump when movement is detected 5 centimeters from the sensor.
That is not a motion sensor, it's an obstacle sensor, so more like a presence sensor, which is indeed the kind of sensor you'd be looking for if this is something like a soap dispenser (hand held in front of the sensor, a squirt of soap comes out).
Note that it may be very sensitive to ambient IR, and while there is some kind of "sensitivity" there's no explicit mention of setting it it to trigger at specific distances. So detecting that there's something 5 cm in front of it won't work well with this sensor. You'd need a distance sensor for that, which tells you the distance of the nearest object in front of it.