Hi All,
I recently made a PIR sensor Arduino Alarm by following the steps in this tutorial:
It all works fine. However, this is only when I've plugged in the Arduino using a USB cable. When I try to connect this using a 9v battery/wall adapter, it does not work at all.
The circuit is supposed to set off an alarm in the form of a beep for a fixed amount of time once it detects a motion.
When I try to use a 9v battery adapter like the one in this image, it beeps continuously and doesn't stop. This does not work at all when I use a 9v wall adapter.
Any Idea what's happening? It works like charm when I connect using the USB cable but does not when I connect using a 9v battery/wall adapter (12 v).
This is quite a bad project. You should never drive an LED from an Arduino output without a current-limiting resistor in series. You may damage your output pin and/or the Arduino.
Regarding your problem: my guess is that the voltages may be slightly different or the current drawing of the sensor changes voltage levels. Without having links to the hardware you used it's extremely difficult to tell you more. What does the serial monitor tells you when the setup is driven by battery/wall adapter?
Hello Pylon,
Thanks for the response. I'll fix the LED part. I'll perhaps add a resistor in series to the LED on the breadboard. Thanks for your advise. Since I'm learning I followed the instructions on the site to the tee. But it's good to know about how doing things incorrectly could damage stuff.
I don't know how to set up the serial monitor when the Arduino is powered by a battery/wall adapter. I've always removed the USB cable from the Uno when it was being powered by an external battery. Is it okay to have both plugged in? I wasn't sure so I didn't try that. When powered by the USB, the serial monitor works fine and I've been getting the messages correctly.
As soon as you provide more than 6.6V to the power plug of an Arduino (UNO), it will use the power from there and not from the USB port. So you're able to have the Serial Monitor and use an external power supply/battery.
Thank you. I connected the LED with a resistor in series and plugged it on the breadboard as per your suggestion. Also, I tried connecting the USB and the battery together and it works fine. The serial monitor also shows the output logs that we have in the code.
However, when I remove the USB cable and leave it to be powered only through the 9v battery, the same problem ensues. The pizo starts beeping continuously.
With a wall adapter it works fine now, surprisingly. This wasn't working before though. I am beginning to think there is a problem is with the 9v battery. I checked the voltage output with a multimeter and I'm getting 8.6 volts. I checked the polarity as well and it is fine. Not sure what's happening.
I guess, your setup is consuming too much current for the 9V battery. These block batteries aren't able to power much more than the Arduino itself, especially if the cell is not completely fresh.