I've build a fairly simple doorbell using Arduino Pro Mini 3.3V: https://www.youtube.com/watch?v=WFd94CYT2Lw&feature=youtu.be

Here's the current setup:

  • Arduino running off the 9 V battery
  • A simple speaker is connected to Arduino (powered from the battery, Arduino just drives it through a transistor)
  • Arduino is reading light level from the light meter every 200 ms.
  • Bulb is connected to the wire that is lit up when someone presses the doorbell button.

It works well - someone presses the doorbell button, bulb gets lit up, Arduino notices that (using light meter) and doorbell rings.


In short - battery life. This kind of setup lasts around 2-3 days off a single battery. I was reading all about how to run Arduino off a single battery for a few weeks, even months, but I'm not sure it's feasible in my case. First of all, I need to wake up Arduino every 100-200, maybe 500 milliseconds, to read the light level. Plus, many of those long-battery-life solutions involved basically building own Arduino-compatible scheme from scratch, which I'd like to avoid.


But... I have a 230 V power source - the one that drives the bulb. Issue is that this power source is down all the time, unless someone is pressing the doorbell button.

I could approach it in two ways:

  1. When someone presses the button, I'd power the Arduino and immediately play a song. Issue with that approach is that if someone presses the button for just a split second, my Arduino would be powered up for just that short amount of time, and I wouldn't have enough time to play the complete song.

  2. If I could possibly reverse the way doorbell button works, I could have +230V all the time, and 0 when someone presses the button. This way Arduino would be on all the time, and it would "notice" someone pressed the button when power would go down. Issue with that approach is that song would be played only once guest would release the doorbell button, + the time it takes for an Arduino to boot.

In both #1 and #2, I need two things then:

a) have Arduino on all the time, regardless of whether button is pressed or not

b) power Arduino from the doorbell to avoid having to use a battery

Which kind of means that I need to power Arduino from a dual source - 230 V and rechargeable battery. 230 V when available, and battery when 230 V goes down. In a perfect scenario, this battery would be charged from 230 V source too :)

Any ideas how to built such a thing? Is there some AC power module that I could use? How would I wire things up in such a case - Arduino, AC power module, rechargeable battery?

Or maybe I'm missing some easier, simpler solution here?

4 Answers 4


This kind of setup lasts around 2-3 days off a single battery.

I measured 15.8 mA consumption on my Pro Mini, running from 9V. A typical 9V battery may have a capacity of 500 mAh, so that is 500 / 15.8 = 31.6 hours. Thus your observed consumption is about right.

Probably 10 mA of that is the LED, so removing it would help. I have a page about power saving. You would want to investigate going into sleep mode, and waking long enough to check the light. You might be able to arrange a LDR in such a way that it generates an interrupt and wakes the processor immediately from a deep sleep.

Example of waking using an LDR

I made up a test like this:

LDR schematic

D2 is one of the external interrupt pins so we can write a simple low-power sketch that sleeps all the time until the LDR gets enough light that the resistance drops, and D2 goes HIGH.

#include <avr/sleep.h>

const byte LED = 9;

void wake ()
  // cancel sleep as a precaution
  // precautionary while we do other stuff
  detachInterrupt (0);
}  // end of wake

void setup () 
  }  // end of setup

void loop () 

  // flash LED 5 times
  for (byte i = 0; i < 5; i++)
    pinMode (LED, OUTPUT);
    digitalWrite (LED, HIGH);
    delay (100);
    digitalWrite (LED, LOW);
    delay (100);

  pinMode (LED, INPUT);

  // disable ADC
  ADCSRA = 0;  

  set_sleep_mode (SLEEP_MODE_PWR_DOWN);  

  // Do not interrupt before we go to sleep, or the
  // ISR will detach interrupts and we won't wake.
  noInterrupts ();

  // will be called when pin D2 goes high  
  attachInterrupt (0, wake, RISING);
  EIFR = bit (INTF0);  // clear flag for interrupt 0

  // turn off brown-out enable in software
  // BODS must be set to one and BODSE must be set to zero within four clock cycles
  MCUCR = bit (BODS) | bit (BODSE);
  // The BODS bit is automatically cleared after three clock cycles
  MCUCR = bit (BODS); 

  // We are guaranteed that the sleep_cpu call will be done
  // as the processor executes the next instruction after
  // interrupts are turned on.
  interrupts ();  // one cycle
  sleep_cpu ();   // one cycle

  } // end of loop

My example just flashes an LED on pin 9 five times, that is where you can play your doorbell sound. Now, with no major external circuitry (like LEDs that are always on) it should have low power consumption.

What would be a good replacement for it, with low power draw and support for interrupts?

The LDR as described above. I measured 3 µA through the LDR when it was partly covered with a black box (my glasses case) and the room lights off. However it was daylight. I think that is pretty acceptable.

Come to think of it, you could probably turn this into a nice "doorway detector" (like they have in shops where it plays a sound when you break a light beam at the doorway). By arranging the LDR in a tube at one side of the door, and shining a light across the doorway into it (and probably tweaking the resistor values a bit) it would play a sound once you cross the beam.

  • Thanks! So if I'd remove the LED, I'd prolong battery life up to ~500 / (15.8 - 10) =~ 3.5 days. That's fine, but the big savings would be if my light meter supported interrupts, Unfortunately, BH1750 I use doesn't - no mention of "interrupts" here. What would be a good replacement for it, with low power draw and support for interrupts? I don't need a big resolution, light meter and a bulb are going to be in a box, so it'd be very dark inside when bulb is off. Also, do you have any pointers for the powering Arduino from a AC + battery?
    – kamituel
    Commented Apr 27, 2016 at 7:08
  • See amended reply.
    – Nick Gammon
    Commented Apr 27, 2016 at 21:35
  • That's interesting. If I'd follow instructions here and disabled built-in LED, and then followed your sketch, by using a single 500mAh battery I could get 500mAh / (0.0541mA+0.003mA) / 24h =~ 365 days. And I even could use couple of AA batteries to go beyond that. Obviously minus speaker power consumption. Let's try that, but first I need to practice using multimeter to actually measure this stuff, and order LDR. Many thanks!
    – kamituel
    Commented Apr 27, 2016 at 22:01

You can run a Pro-Mini just fine of a battery. It's the UNOs that cause a lot of problems, because of the onboard USB-to-Serial chip. The only thing you might want to tweak on this board, is removing the power-led, which I've recently done with a knife.

I poll the reflectivity of my power-meter every 250ms, and I'm getting at least 3 months of battery life out of 2 AA-batteries.

Depending on the light sensor you are using, you could even use interrupts to wake up the Arduino when the light is on, instead of having to poll every few milliseconds.

  • Thanks! I read about removing this LED. I'm surprised you get as much as 3 months of life with polling every 250ms. Maybe my speaker draws some power then, when off? I connected it to one of the outputs via small resistor and a NPN transistor. Collector and emitter are connected to battery VCC and GND. It's a simplest, 8 Ohm, 1 Watt speaker. I also used different battery, the 9V rectangular one. And I'm getting 2-3 days, measured on a brand new battery.
    – kamituel
    Commented Apr 26, 2016 at 17:02
  • Do you put the arduino into sleepmode? Not just using delay.
    – Gerben
    Commented Apr 26, 2016 at 18:44
  • I think so. I used "Low Power" library - here's the relevant line in my code: github.com/kamituel/arduino/blob/master/src/doorbell/rtttl_bin/…
    – kamituel
    Commented Apr 26, 2016 at 18:47
  • The BH1750 takes around 16ms to do a measurement, so you are are already spending 15% of the time awake. I'd suggest just using a simple LDR (light dependent resistor) instead. They are only a few cents, and will be more than adequate in this case. Do you have a multi-meter, so you can measure the (average) current consumption? Low power can be hard to figure out sometimes. There's a lot of variables.
    – Gerben
    Commented Apr 26, 2016 at 18:55
  • 1
    Those "plugs" are standard on multimeters. There aren't any "arduino specific" multimeters. Any simple multimeter will be fine for a beginner. I got mine for 20 euro at a local hardware store. Not the best, but fine for basic usage. You want to measure the current used, so you put the meter into mA mode. Just place two wires with one side into the breadboard, the other two ends of the wires, you can just press against the two "plugs" with your fingers.
    – Gerben
    Commented Apr 27, 2016 at 9:13

A small solar cell would not require excitation and would probably generate enough voltage to trigger an interrupt pin and wake up the MCU.


If you make it so that the light only goes out when you press the button, and connect a battery charger with that bulb in parallel, put a battery in the charger and plug the arduino into the battery, then use the light sensor approach to detect the button press and play a tune, it would work just fine... Really the only 3 things you might wanna worry about are the user holding the button for a few hours (which is very unlikely), power outages (can be solved using a UPS), and replacing the battery/bulb once every few years, depending on how good it is... Probably the simplest approach, not sure if it is the best tho... But why not just plug the arduino to a phone charger that is then connected to the wall, and then use the doorbell switch as input for the arduino?

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.