NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Project Help and Ideas » In need of a solution

October 02, 2012
by Pew446
Pew446's Avatar

I'm adding a keypad to my door so I don't have to carry around a key anymore, and I've run into a problem. The chip is powered by a 9 volt battery, and the problem is even when the keypad is not in use, the chip is constantly looping to check if someone has pushed a button. I assume this could drain the battery quite quickly. Does anyone have a solution to turning the chip on only when needed? Or will a 9 volt last a long time? I was thinking I could add a switch on the door, but if someone leaves it on or I forget to turn it off when I get in the room, that could be a problem.

October 03, 2012
by pcbolt
pcbolt's Avatar

Pew -

What kind of keypad is it? Do you have a model number and manufacturer? If the processor current is low enough (in the micro Amp range) your battery should last a while. I think a typical 9 volt battery has about a .5 amp-hour capacity. So at 100 microAmps that should last about 7 months.

October 03, 2012
by Ralphxyz
Ralphxyz's Avatar

That is why the mcu has a "sleep" mode.

Ahem, there is even an article in the Nerdkits Community Library to get you started.

Well you could also work your way through the specsheet (which wouldn't hurt) to teach yourself how sleep works.

Essentially you can put different phases of the mcu to sleep to save power. Everything but listening for certain interrupts can be put to sleep. You trigger the interrupt from a button press and wake the mcu up.

Did I mention there is an article in the Library.


October 03, 2012
by JimFrederickson
JimFrederickson's Avatar

You didn't mention whether you had a display on this or not?

If you did then you would need to power that down as well. Mostly likely an active display is going to use more power than the AVR.

Sleep modes can work wonders for the AVR Battery life. So that would be highly recommended.

The other option is to use an "electronic switch".

Have a momentary contact button that would turn on the "electronic switch" to turn on your project.

Then have the AVR count in the background.

After a certain amount of time the AVR turns off the "electronic switch", and probably after a good code has been entered the AVR turns off the "electronic switch" as well.

If you wanted to be a little "crude" just put in a momentary contact button and a fairly large capacitor, and only have power to it when the button is held down.

Swapping your 7805 voltage regulator for a more expensive "switching regulator" will help in your battery life as well. (Although if you do implement some sort of complete power down this will likely only have a negligible affect...)

Do you have "low batter indicator"?

October 08, 2012
by Pew446
Pew446's Avatar

The keypad is a simple 4x4 membrane (like the LED Array project, but buttons instead of LEDs) I got off Amazon. Nothing but wires and buttons.

I have no screen attached.

After a couple days I've decided this 9-volt-a-day solution isn't working well. I'm running out of batteries. The reason the power drains so fast, at least in my opinion, is because the chip is constantly (24/7) looping, sending a signal down each column and checking each row for a contact. Obviously this eats up tons of power (like I said, a 9-volt lasts one day, if that.)

I can think of three solutions.

  1. A door handle interrupt system - touch the door handle, it triggers an interrupt, the keypad turns on, and you can punch in the code. I just don't know how to go about doing this. I'm going to research it, but if you have any ideas let me know.

  2. A simple power toggle flip switch, or a momentary push button to trigger an interrupt.

  3. A ~5 volt wall plug.

I feel like option 1 would be the best, I just don't know how to make it happen.

October 08, 2012
by pcbolt
pcbolt's Avatar

Pew -

You might be able to come up with a separate circuit to monitor your "door handle interrupt" solution, but if you are going to use the ATmega168 to do the monitoring like in the "Proximity Sensor" tutorial, you're back to square one since you will need to power the MCU the whole time.

If you are willing to sacrifice one of your keypad columns, you could wire up an interrupt that triggers when you press one button in that column. You'd just have to have that column pin "hot" and hookup the row pin to an interrupt pin on the MCU. Once pressed, the MCU can wake up and start scanning the keyboard. I'm not certain, but I think you would need a way to shut off the power to the "hot" column or it might short out the keypad. You would not need to monitor that column during scanning so that might help in your design. I'm sure there is a way to turn off the column power and still be able to scan it with a clever arrangement of FET's, but I can't think of it right now. May have to sleep on it.

November 14, 2012
by technogeek3000
technogeek3000's Avatar

you could have it in like a "sleep" so it turns on when any buton is touched like the iPod if you hit the volume it turns on.

Post a Reply

Please log in to post a reply.

Did you know that you can connect a pushbutton to a microcontroller with only one wire? Learn more...