Author Topic: How does an electronic safe use a 9v battery to power a solenoid?  (Read 4022 times)

0 Members and 1 Guest are viewing this topic.

Offline flyingblindonarocketcycleTopic starter

  • Newbie
  • Posts: 4
  • Country: us
I have a gun safe with an electronic lock. I guess its a piece of junk as the electronics failed with in days of getting it. I thought it would be a good beginner micro controller project to replace the electronics.  I have an adafruit ItsyBitsy 32u4 chip and I wired up the 4x3 keypad.  The short version of this story is success...almost.  The safe locking solenoid does not need to capable of much force at all but how do I control it with a 9v battery and not drain the battery very rapidly?

The solenoid at rest has a very weak spring that keeps the pin out and blocks a mechanism keeping the safe locked.  When the solenoid is activated it pulls the pin out of the way and the safe handle is allowed to be turned and open the door.

The MCU circuit to control the solenoid was taken from https://www.bc-robotics.com/tutorials/controlling-a-solenoid-valve-with-arduino/

The code puts the ship to sleep. Wakes on a button press. Stays awake if a button is pressed within a short period. watches for the combination to entered. triggers the solenoid for a short period when the combination is entered.  It appears that the solenoid is drawing over 400ma when activated. 

How can a 9V survive long like that?  How is it that a 9V operated electronic safe is common place when they use a solenoid?

Thanks
FBOARC
 

Offline Rerouter

  • Super Contributor
  • ***
  • Posts: 4694
  • Country: au
  • Question Everything... Except This Statement
Re: How does an electronic safe use a 9v battery to power a solenoid?
« Reply #1 on: December 13, 2019, 10:03:37 pm »
400mA x 2 seconds = 0.22mAh

They would be using some capacitance to get around the batteries ESR, but the total amount of energy used is rather small per actuation.
 

Offline flyingblindonarocketcycleTopic starter

  • Newbie
  • Posts: 4
  • Country: us
Re: How does an electronic safe use a 9v battery to power a solenoid?
« Reply #2 on: December 13, 2019, 10:55:26 pm »
Are you saying that activating a solenoid with a 9V batter powered circuit is not insane?  I have been searching the internet and even on the adafruit forum I have been told that you can't use a solenoid with a battery.  Obviously someone figured it out as safes do exactly that.  But are you saying its no big deal?  This is very encouraging! 

Do you mind expounding on what you mean by the batteries ESR?

I should also mention that I did build this circuit and try it and sadly it only worked for a couple days. I have not yet pulled the micro out to see if it is damaged.
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9889
  • Country: us
Re: How does an electronic safe use a 9v battery to power a solenoid?
« Reply #3 on: December 13, 2019, 11:09:34 pm »
ESR => Equivalent Series Resistance.  This internal resistance limits how much current the battery can deliver and, more important, how the output voltage is related to the output current (Ohm's Law works here).  An ideal battery has 0 Ohms of ESR, a real battery will have some.

So, by putting a capacitor in parallel with the battery, it will charge to the same voltage but when it comes time to activate the solenoid, the capacitor probably provides most of the energy because it will  have lower ESR.  It's not free energy, the capacitor has to recharge from the battery.

For a gun safe used a couple of times per day, a pair of 9V batteries will last more than a year.  Based on Sargent & Greenleaf A Series lock.

https://www.sargentandgreenleaf.com/products/electronic-locks/aseries/


 

Offline Rerouter

  • Super Contributor
  • ***
  • Posts: 4694
  • Country: au
  • Question Everything... Except This Statement
Re: How does an electronic safe use a 9v battery to power a solenoid?
« Reply #4 on: December 13, 2019, 11:24:48 pm »
It is not wise to operate a solenoid for a long period of time off a battery, small pulses are OK if you mitigate the other issues

Batteries have an internal resistance, for short duration pulse loads you can treat them like a power supply with a resistor between the supply and your load, this means drawing a large amount of current will make the voltage on your load decrease, and generate some heat in the ESR / resistor,

The value of this ESR tends to get worse as the battery depletes, and changes with temperature,


This is making some assumptions, but lets say your solenoid resistance is about 22 ohm (9V / 0.4A), a 9V battery is normally 1.5-5 ohm ESR for the first 50% of its capacity
For your solenoid, you could on a proper supply work out what its "Actuation Voltage" is, e.g. what voltage is the minimum to make it unlock, this tells you how low the voltage can droop before it stops working
As for why your circuit stopped working, that is harder to say, its possible the nductive spikes carried into the rest of the circuit, (This is why circuits have decoupling capacitors and reverse polarity diodes across inductive loads)
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: How does an electronic safe use a 9v battery to power a solenoid?
« Reply #5 on: December 14, 2019, 04:39:56 am »
Are you saying that activating a solenoid with a 9V batter powered circuit is not insane?  I have been searching the internet and even on the adafruit forum I have been told that you can't use a solenoid with a battery.  Obviously someone figured it out as safes do exactly that.  But are you saying its no big deal?  This is very encouraging! 

Do you mind expounding on what you mean by the batteries ESR?

I should also mention that I did build this circuit and try it and sadly it only worked for a couple days. I have not yet pulled the micro out to see if it is damaged.

"A solenoid" describes a very, very broad range of things. Technically the motor in the typical quartz analog clocks that will run for years on a single AA battery is a solenoid. Solenoids can be tiny and consume a tiny amount of current or they can be huge and draw kilowatts. It's all a matter of current draw and duty cycle. You mentioned the solenoid draws 400mA, that's a very large load if you wanted to run it continuously from such a small battery but for 2 second pulses every now and then the amount of power consumed is very small. The data I found suggests a typical 9V alkaline battery is 500mAh, so that's more than 2200 2 second pulses consuming 0.22mAh each. That's completely ignoring the idle and active consumption of the microcontroller, loss due to the ESR of the battery and other factors but the point is it's perfectly acceptable to do what they're doing.
 

Offline not1xor1

  • Frequent Contributor
  • **
  • Posts: 716
  • Country: it
Re: How does an electronic safe use a 9v battery to power a solenoid?
« Reply #6 on: December 14, 2019, 05:32:13 am »
I think James is right.

There are plenty of garden watering timers using a 9V battery to open/close a valve by short pulses to a solenoid.

I have a couple of them exposed to all the weather stresses and after about 6-7 months of switching on/off a couple of times a day the batteries still have some charge. A few times I've even used rechargeable 9V NiMH batteries.
 
The following users thanked this post: Ed.Kloonk

Offline Brumby

  • Supporter
  • ****
  • Posts: 12297
  • Country: au
Re: How does an electronic safe use a 9v battery to power a solenoid?
« Reply #7 on: December 14, 2019, 07:01:31 am »
As mentioned above -
 * A capacitor can store energy from the battery which is then available for the high current required to pull the solenoid in.
 * By this process, a number of short activations is quite possible on a 9V battery, so long as you manage this power usage properly.
 * A reverse protection diode across the solenoid is essential to safeguard any circuitry driving it.  Without one, the back EMF from the coil when power is removed can run into hundreds of volts, which is a major risk to the driving circuitry.  For example:


Also - not mentioned is the fact that the initial current drawn to get the solenoid armature to move is much more than is required to hold it into position once it has moved to the "unlock" position.  This provides you with the opportunity to experiment to find out:
 1. What current is required to move the armature to the unlock position and how long that current needs to be supplied in order to reliably achieve that - and -
 2. What current is required to hold it in that position.

Finding these figures will help you derive much more efficient power management - giving longer battery life.

(Solenoids operate on the magnetic field created, which is a function of the current flowing - but since they have a DC resistance, Ohm's law will apply during steady state, which will be a few milliseconds after power is applied or removed.)
 

Offline flyingblindonarocketcycleTopic starter

  • Newbie
  • Posts: 4
  • Country: us
Re: How does an electronic safe use a 9v battery to power a solenoid?
« Reply #8 on: December 14, 2019, 03:14:20 pm »
Thanks a lot! This is all very good information.
 

Online Kleinstein

  • Super Contributor
  • ***
  • Posts: 14178
  • Country: de
Re: How does an electronic safe use a 9v battery to power a solenoid?
« Reply #9 on: December 14, 2019, 04:16:30 pm »
Like with normal relays the current to hold the plunger in open state can be quite a bit lower. So it only take the full current for a short time (e.g. 0.5 s) and can than reduce the current to something like 1/2 or 1/3 the value.

Reducing the current can be done quite effective with PWM modulation in the 10 kHz range if the diode is sufficiently fast. This way 1/3 the current only needs something like 1/6 the current.
 

Offline IDEngineer

  • Super Contributor
  • ***
  • Posts: 1926
  • Country: us
Re: How does an electronic safe use a 9v battery to power a solenoid?
« Reply #10 on: December 15, 2019, 12:23:48 am »
I've also seen battery powered applications like this use a motor or other rotary element to move the physical piece. Movement is slower but still well within human satisfaction. The benefits include lower current to actuate and potentially zero current when not changing.
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: How does an electronic safe use a 9v battery to power a solenoid?
« Reply #11 on: December 15, 2019, 01:24:11 am »
Yes that works too, although I suspect a motor would not consume less power in this case, by design it's only going to give you a few seconds to open the thing after entering a valid combination. A motor would just have to crank it one way, stop, then crank it the other way a few seconds later. I doubt that would consume less power than holding in a small solenoid for the same period. It's also likely to be more mechanically complex and failure prone.
 

Offline IDEngineer

  • Super Contributor
  • ***
  • Posts: 1926
  • Country: us
Re: How does an electronic safe use a 9v battery to power a solenoid?
« Reply #12 on: December 15, 2019, 01:39:45 am »
I was thinking of rotating the motor ~180 degrees, to swing an arm that selectively locks the mechanism. That would take very little power and only during transitions.
 

Offline Brumby

  • Supporter
  • ****
  • Posts: 12297
  • Country: au
Re: How does an electronic safe use a 9v battery to power a solenoid?
« Reply #13 on: December 15, 2019, 02:48:49 am »
That would depend on the motor, the arm and the lock structure.  A single 180º movement would require a certain amount of current, whereas a much less powerful motor running through a reduction gear set could achieve the objective with a significantly lower peak current requirement.  Yes, it would need to run for longer, but it's the total energy use that is important here.


I think I'd prefer to stick to the solenoid - especially since that mechanical structure is already in place and functional.
 

Offline IDEngineer

  • Super Contributor
  • ***
  • Posts: 1926
  • Country: us
Re: How does an electronic safe use a 9v battery to power a solenoid?
« Reply #14 on: December 15, 2019, 03:16:05 am »
I was just brainstorming... since you're retrofitting I agree, stick with what you've got.

Another option for the motor approach would be a small stepper. Could be very low power, has some position retention with zero power.

Lots of options, especially with a blank slate.
 

Offline austfox

  • Regular Contributor
  • *
  • Posts: 154
  • Country: au
Re: How does an electronic safe use a 9v battery to power a solenoid?
« Reply #15 on: December 15, 2019, 05:21:42 am »
I’ve used quite a number of these safes (shop safes, smaller ATMs etc) and the 9V battery easily lasts a year or two. Therefore I assume they work via a combination of electrical (solenoid latching a pin out of the way to allow the handle to turn and move the locking bolt to the unlock position), and mechanical (once the handle is turned back to normal position it mechanically disengages the latch of the pin and the lock bolt returns to the locked position).

If you briefly apply power to the solenoid does it allow you to open the safe after the power has been removed?
 
The following users thanked this post: tebbybabes

Offline flyingblindonarocketcycleTopic starter

  • Newbie
  • Posts: 4
  • Country: us
Re: How does an electronic safe use a 9v battery to power a solenoid?
« Reply #16 on: December 30, 2019, 12:36:43 pm »
Thanks for all the knowledge.  My safe is now operational with its new brain and a 9V bat.  The mechanics work exactly as austfox described.

Cheers
FBOARC
 
The following users thanked this post: tebbybabes

Offline eugenenine

  • Frequent Contributor
  • **
  • Posts: 865
  • Country: us
Re: How does an electronic safe use a 9v battery to power a solenoid?
« Reply #17 on: December 30, 2019, 02:22:44 pm »
Something that tutorial misses is solenoids have a pull in current and a hold in current.  If your going to hold the solenoid energized for more than a half of a second you can reduce the power to it to save more battery life.
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: How does an electronic safe use a 9v battery to power a solenoid?
« Reply #18 on: December 30, 2019, 05:46:00 pm »
Thanks for all the knowledge.  My safe is now operational with its new brain and a 9V bat.  The mechanics work exactly as austfox described.

Cheers
FBOARC

Nice job. I always like getting a followup on threads like this so we know what happened.
 

Offline tebbybabes

  • Contributor
  • Posts: 16
  • Country: au
Re: How does an electronic safe use a 9v battery to power a solenoid?
« Reply #19 on: December 31, 2019, 12:55:10 am »
Really interesting read! Thanks!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf