63Views7Replies

Author Options:

How to power a 5v circuit with batteries? And will my circuit always draw power? Answered

I'm building a fridge door sensor that will beep when the door is opened. The one that is on my fridge right now is very inaccurate and so I want to improve it.

So what I've done is make a sensor that is mounted onto the door to makes a contact when its closed. When it's opened, I'm using an ATtiny 25 to wait 30 seconds and then make a pulsating buzzing noise through a buzzer.

The ATtiny operates in a range of 2.7 - 5.5v and I want to power it with batteries.

I'm new to electronics so I don't know much about powering stuff with batteries. My questions are:

How do I get that power that I need?
Will the batteries get drained quickly because of the circuit design?
(power always going through the contacts)

Also:
Does anyone know exactly how to hook up a battery to an ATtiny? I think that the positive should go through my switches and then into vcc, but I'm not sure where to put the negative.

Thank you so much!

Discussions

0
-max-
-max-

3 years ago

Normal alkaline or carbon zinc ("heavy duty") batteries output 1.5V nominally, but a fresh one can be as much as 1.8V and typically considered dead when it falls below 0.9v. So to stay in the appropriate operating voltage range, 3 batteries in series should be fine. Fully charged, that is about 5.4v, and fully discharged it is 2.7V. However you should probably add a low dropout regulator to ensure the voltage never exceeds the maximum voltage of the microchip. LDO's are a bit advanced for a complete novice, but I'm sure there are plenty of instructables here to help you out with that.

--------------------------------------------------------------

Positive to positive, and negative to negative. It really could not be much simpler.

---------------------------------------------------------------

How much current the circuit draws depends on how you wire it. Without a schematic I cannot tell you much. Make sure to use a very high value pullup or pulldown resistor with the switch to ensure the current is minimum. 1 megohm should be good. The microcontroller will also draw some current, and how much it draws depends mostly on your code. There are some low power sleep modes you can make the chip enter to greatly reduce power consumption to very low levels. https://learn.sparkfun.com/tutorials/h2ohno/low-po...

--------------------------------------------------------------

To be fair a microchip is not required for a simple task like this, you could easily use a couple of transistors and a switch to do exactly this. Or even relays and solenoids at the cost of more current draw. My idea would be to use a current source or resistor connected to a capacitor and switch in parallel so when the switch is opened the current source will slowly charge up a capacitor, and when it reaches a certain point another transistor can trigger at a particular voltage level which will activate the buzzer.

The 555 or 556 timer would also be a classic chip that would do exactly this. But in fairness the 555 does require 10mA to operate, which is a lot for something that continuously runs off battery.

0
rickharris
rickharris

Answer 3 years ago

Hence my suggestion the cct is triggered by a switch on the fridge door. that way the 555 only operates for a brief period.

0
-max-
-max-

Answer 3 years ago

That requires a normally closed switch, not the more common normally open type. Because you want the 555 to only turn on when the door is open and the switch depressed. I'm not sure is the reset pin on the 555 changes the amount of current it draws either.

0
rickharris
rickharris

Answer 3 years ago

My inclination would be to use a 555 as a monostable using the output to drive a stand alone alarm say a buzzer or siren for as long as required depending on how much reminding you need.

To be honest I might even be inclined to miss out the 555 and take the switch direct to the buzzer, that way it sounds all the time the door is open encouraging you to minimise the time you keep it open.

You could do this with a normally on micro switch so that once the door opened the 555 became switched on and ran through it's cycle.

0
yohiyoyo
yohiyoyo

Answer 3 years ago

Thank you! I'm going to look at a 555 timer and hopefully that will make things easier.

0
-max-
-max-

Answer 3 years ago

Not nessesarly easier, although both solutions would be easy. Look up monostable or one shot 555 circuits They trigger once and stay triggered for a set amount of time based on a RC time constant.

0
rickharris
rickharris

3 years ago

3 x 1.5 is 4.5 volts i.e. 3 AA cells will work fine.

How long they last is very much down to what the circuit does. You can use bigger batteries if there is room, c Cells for example.

You need the data sheet to should you which pins to connect to Vcc= +ve and GND is the negative side Pin 8 and 4 respectively.

http://www.atmel.com/images/atmel-2586-avr-8-bit-m...

This may be MUCH easier to do with a switch and a 555 timer this only draws current when the door is open/.