Easy secret knock detector to trigger anything with only an Arduino and a few cheap components

First of all I need to state that I'm new to Arduino and electronics in general. My question is about a project where the Nano is being powered up with a 12v rechargeable li-ion 2800 mAh battery on pins VIN and GND.

I'm using the 5v Nano pin to power a SRD-05VDC-SL-C relay along with the ground pin from the Nano. The IN pin on the relay is from the D11 pin on the Nano. So far so good. I'm also using the same 12v battery to power up a solenoid latch, which energizes for just a few seconds.

When I tested this setup (less the relay AND solenoid) for battery life, my volt meter read 9.8v and 1 hour later 2.8v. causing the Nano to go off.

How can I increase battery life?

This is the link to the code I used:

Hand drawn wiring diagram

I'm not having an issue with the code or the operation of the setup but the battery life is unacceptable.

  • please draw a schematic. there is a button for that when you edit your post. ... also, the arduino does not do anything by itself, i am sure there is a program involved. please post that.
    – jsotola
    Dec 21, 2017 at 2:43
  • I don't quite follow your schematic. What are T1 and T2?
    – Nick Gammon
    Dec 21, 2017 at 4:52
  • Hi, you just added a link to a YouTube video without any introduction. Could you explain the purpose of the video?
    – Andrew T.
    Dec 21, 2017 at 5:03
  • Fritz, you edited my answer to (attempt to) add a link to a YouTube video about a "Easy Secret Knock Detector" and have now edited your question to add the same link. What is your purpose in doing this?
    – Nick Gammon
    Dec 21, 2017 at 5:15
  • 1
    Draining a 12V batterypack down to 2.8V is very bad for the longevity of li-ion batteries. Please add some kind of battery (undervoltage) protection to your project.
    – Gerben
    Dec 21, 2017 at 15:48

1 Answer 1


Something is wrong with your setup. I don't have a Nano to hand to test, but it would consume similar current to a Uno (probably less) which is around 50 mA. Thus, using a 2800 mAh battery you should have a life of 2800/50 = 56 hours.

Li-ion batteries come in multiples of cells, where individual cells have a nominal voltage of 3.6V (thus you probably have three cells giving 10.8V). Deeply discharged they will have a voltage of 3.0V per cell (a total of 9V for your three cells). If you started at 9.8V as you stated, then the cells would have been 90% discharged already which probably accounts for the short running time.

Assuming you haven't wired it in a strange way (and it would help to show the wiring and possibly a photo) I suggest you try with a fully-charged battery.

Another helpful thing to do would be to measure the current consumption of the battery using a multimeter. Make sure you read up on how to measure current with a meter or you may damage something (example here).

The basic idea is shown in this photo:

Measuring current

The meter is placed in series with the battery and the Arduino. The negative side of the battery goes to the Arduino in the usual way. The positive side of the battery goes into the "milliamps" input of the meter (which is set to 200 mA range in my case) and then the common (black) lead from the voltmeter goes to the positive (Vin) side of the Arduino.

You can see that in this particular case, with a 9V battery, the Arduino is consuming 57.7 mA. I don't quite believe that reading as re-measuring with a more expensive meter gave a reading of 51.1 mA. Still, that gives you a ball-park figure. And it shows that spending a bit more on a better meter gives you more accurate results. :)

I have a page about power saving and you can also refer to the Wikipedia page about Li-ion batteries.

my volt meter read 9.8v and 1 hour later 2.8v. causing the Nano to go off.

For a 12V Li-ion battery get down to 2.8V there is something seriously wrong with its protection circuitry. It should cut the battery out at 3V per cell, that is at 9V if you have 3 cells in series.

  • Nick, I decided the battery needs to be changed out. Waiting for the replacement.
    – Fritz
    Dec 28, 2017 at 0:15

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.