Looking for a "mini-locker" (secret box)


I want to build a "secret box" : a box that is locked and must be unlocked using a secret code.

I have no problem with the electronic and programming parts.

But I'm looking for the best solution for an arduino controlled "mini lock".

The goal is to :

  • have the box locked everytime, even on power off
  • power on the box, type your code
  • if ok, unlock the box
  • autoshut-down

So the lock should be powered using a battery source (a 9V or 4 AAA batteries).

I'm thinking about using a mini solenoid (push-pull a lock) or a mini stepper motor (to turn a little metal part which will lock the box)

I want to have this locker as small as possible.

The solenoid seems to be power greedy, the mechanical work to have a micro-stepper based lock seems to be difficult (for a small locker)

So I'm thinking about a magnet solution : using a permanent magnet to lock to box.
The permanent magnet should be "stuck" to a small electromagnet when the electromagnet is off.
And the permanent magnet should be "pushed" by the small electromagnet when it's on (playing with magnet polarities)

Do you have any idea or advice ?


I want to have this locker as small as possible.

That's not a specification. For some people, a gym locker might be their idea of "small". What do you think is "small"? What is going to fit inside it, other than the Arduino?

Car door lock actuators make great actuators for this. You need a reasonable amount of 12V power (like 12V worth of AA batteries) but they are nearly indestructible and they consume no power when "locked". If you wanted something smaller, you can cut them open and extract the gears to work without the large case.

How about a micro servo? Probably lower power than a solenoid and much easier to use than a stepper.

"Small" in this project is about a few centimeters on each side.

The microstepper is a good idea, any idea on the smallest ones reference ?


Here is a representative micro servo. There are smaller but this size is commonly available. These are often used for locking boxes (geocache).

Benefit of a solenoid is that power only needs to be applied to unlock it. The rest of the time it can be unpowered & remain locked. Servo's can do odd things upon power up, like jumping back to their 0 position on initial power application until the control signal is valid. Stepper's need pulses to move, are likely to stay in one spot until pulses are applied to make them move, but their rotary action needs to be translated into a rod that can move into a locking position somehow. The solenoid will have a rod that moves back & forth already.

Thanks for these advices and references.

What about the “electro magnet” solution ?

I think I might be great, because there is no mechanical moving parts involved.

The locking magnet should be strong (maybe be use 2 small ones) but not unbreakable.

Magnets aren't locks. You can choose a strong magnet that will make it close enough to impossible to open but then you'll need a strong electromagnet to cancel the field of the permanent magnet. Packing a 20A power supply into a box just a few cm wide will be difficult.

You can get "switchable" permanent magnets. Basically one magnet that can rotate inside another. When they are lined up, the field is strong and when they are 90 degrees, the field is weak. Look at how magnetic-base dial gauges work. But the force required to turn the control magnet is still high - easy to do by hand but hard to do with a small actuator that fits in a box.

I bought some really tiny linear actuators off eBay a few years ago. I can't find a picture but the whole thing fit on my thumbnail. A little tiny stepper motor drove a shaft with a spiral groove. I think it was 6 for $1 or something like that. I think you should find something like that and connect it to a latch. It would only use a tiny amount of power to lock or unlock and no power when not moving. They are so small, I would consider using only 2 coin cell batteries to power them.

Another source of small linear actuators is the mechanism inside a CD or DVD drive which moves the lens assembly. They are steppers so they will need 4 control wires but it should not cost you anything to pull apart a broken device and use the motor.

The tiny linear actuator you describe seems a good candidate !

And the idea to get it from an old CD player is nice to me...


Is that the kind of linear servo you talked about ?

It's a little more expensive than "6 for 1$", but it's really tiny !

That device is a servo, using the standard servo interface as defined by the servo library.

HobbyKing has a version for under $5

But I sure would like more info on the micro actuators. @MorganS, and recollection on product name, or info in email archives? Or ebay order lists?


The buy-it-now suggestions box shows one listing for 5 of them at $0.77. So no, you don't get 6 for $1. 8)

What happens if it loses power or charge runs out? Or whatever charging/recharging circuit it uses fails? Or if the circuit fails? A case of can get it, but can't get out, unless it's cut or forced out?

What happens if it loses power or charge runs out? Or whatever charging/recharging circuit it uses fails? Or if the circuit fails? A case of can get it, but can't get out, unless it's cut or forced out?

In this case, I will simply unscrew the bottom panel of the box to have an access to the circuit.