1
\$\begingroup\$

I am building an IR based faucet. I need to include a battery backup. I am using only an ATmega328 with a crystal and a capacitor, I am not using a regulator or LED.

I need to increase the battey life. I am using 4AA batteries in series with a capacity of 2000 mAh and thd device is currently consuming 15 mA when no hand is detected.

When there is no hand in front of the IR receiver it should be in sleep mode and when a hand comes near to the sensor it should wake up and energise a solenoid.

Instead of waking the Arduino every 2 s is there any way that it could wake up only when a hand is near?

\$\endgroup\$
1
  • \$\begingroup\$ If the existing answer helped you solve the problem, please mark it as answered. \$\endgroup\$
    – AJN
    Commented Aug 4, 2020 at 8:48

1 Answer 1

1
\$\begingroup\$

Welcome to the forum. Your sensor does essentially the same as the button. What button does is: pulled up line is shorted down to ground OR Pulled down line is connected up to HIGH

so your wake up on button simply feels the line changing up to down or down to up position. Your sensor does exactly the same. You only need to understand if the sensor pulls down or up when it's detecting. Then you connect it like a button and program it like for a button, because in terms of voltages they behave similarly. Again, you have to check if your sensor outputs "active high" (high voltage out for detection), for example, which I'm assuming now. If so, make a pulldown on its output and program interrupt on the rising edge. So your output line is always low, but when detection event occurs, the output of sensor becomes high and it wakes atmega up or does whatever your interrupt on rising edge does.

I assumed you have some most basic detector that output just detected or not detected at some range.

ADDITION (too long to comment):

I still lose your point sometimes, but as I see it, you need a sending circuit that will run independently from the MCU? I mean, the worst case thing you can always throw in a ATTINY85, it consumes close to nothing, especially if you sense not continuously, but, say, sleep 0.5s, wake up, sense, sleep. Because your hand will definitely cross that time interval. Or make it 0.2s or whatever. And ATTINY can control receiver too then, and then wake up the atmega from total shutdown (can even unpower it entirely via mosfet or just wake up via interrupt)? This will also save you battery, because attiny uses just so little, but lets you shut down atmega328 entirely.

Clock down attiny as well for extra low power

\$\endgroup\$
4
  • \$\begingroup\$ my receiver is Active low device,and i agree the sensor acts like a switch but my question is i have connected the transmitter to the IC itself it will keep on transmitting 38kHz burst if the receiver sense the reflected signal of transmitter it gives logic 0,how can i put IC to sleep mode and detect weater hand is present or not if IC is in sleep mode how can it transmitte signal? \$\endgroup\$ Commented Jul 26, 2020 at 17:54
  • \$\begingroup\$ I'm sorry, I don't understand you well. So your receiver sends 38khz and then when detects it stops? then make RC lowpass filter (will be vcc*dutycycle, suppose, 50 duty cycle, 2.5V out), convert it via comparator to logic high (say if signal over 1v). and when 38khz stops, comparator outputs low \$\endgroup\$
    – Ilya
    Commented Jul 26, 2020 at 18:20
  • \$\begingroup\$ No my IR transmitter sends 38kHz modulated burst because the receiver sense only 38kHz frequency that to in burst not continuous 38kHz, because receiver rejects continuous signal so iam modulating the transmitting signal,my transmitter it connected to D3 of the IC and receiver to D8 ,whe i put Atmega328 to sleep mode the sketch inside will stop executing if it stops it cannont send signal through IR transmitter which is connected to D3,my receiver will have 5v on its line when modulated signal hits it 5v become 0v,is their a way where i can transmitte signal through D3 during Sleep mode itself \$\endgroup\$ Commented Jul 26, 2020 at 18:40
  • \$\begingroup\$ updated the answer \$\endgroup\$
    – Ilya
    Commented Jul 26, 2020 at 19:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.