5

I want to replace my door lock with an one made with an Arduino and a servo, but I'm not sure if the platform is stable enough to use it for something like this.

If I do everything right (code, connections, constant power), could I trust in this?

  • 2
    If you use the watchdog timer, I'd trust the Arduino part. I would be more worried about the mechanical parts. Just make sure you have an alternative way of access. Just like the digital vaults that still have a key. – Gerben Aug 29 '16 at 18:12
  • 14
    About safety: in case of power out, will your door be left open or closed? And if closed, do you have a way to get out, for example in case of fire? Sorry for offtopic comment, but it might be a case of life and death for some. – Mołot Aug 29 '16 at 22:11
  • 1
    IMHO, manage your security and access to vital things only with really reliable and unaffected by external events systems, as a well-oiled good-quality mechanical door lock. Sorry to write that in an arduino post. – Benj Aug 30 '16 at 12:32
  • 3
    Software/hardware stability aside, you may want to check with your insurance company to ensure that they regard your setup as something that qualifies as a "lock". In case of a break-in, you need to be sure your insurance won't be void because "your door was not locked". – KlaymenDK Aug 30 '16 at 14:56
  • 1
    If this is intended to be secure against an actual attempt to break in, make sure the electronics are far enough away from access and that the connection to the lock is protected. Otherwise, a simple high-voltage discharge to the lock could fry the CPU and possibly trigger an unlock. – David Schwartz Aug 30 '16 at 19:16
16

I'm not sure if the platform is stable enough to use it for something like this.

Absolutely it is. As I describe in my post about an RFID door lock I use a Uno (and some additional parts) to unlock my door.

Since writing that I improved the software as described here so you can reprogram the valid list of cards "on the fly" (without uploading new code) as the valid cards are stored in EEPROM.

RFID door lock

My system has been operating for over 5 years without any problems, except once when there was a brownout in the area and I had to power cycle the system (possibly the RFID reader failed and not the Arduino).

My system "fails shut" so it keeps the door locked in the event of a power failure. However I have alternate ways of leaving the building in the event of a power failure combined with a fire.

You are talking about a servo rather than an electric strike. That is likely to be the weak point, and not the Arduino as such. You would need to ensure it was powerful enough to do whatever-it-is you are planning to do, and that it had suitable drivers (eg. MOSFET or driver board).

My system gets used dozens of times each day. We never have a problem with it.

  • Pretty useful info. +1. Source is nice and simple. Just to be clear; do you feed that Uno 5V to the 5V pin? What's the power supply for 5V? – user2497 Aug 27 '17 at 13:43
  • @user2497 - the Uno is powered by a 12V wall-wart. That gives 12V on Vin which is used to activate the door lock (it is a 12V model). The Uno itself has a voltage regulator on-board which drops the 12V to 5V for the logic circuits. – Nick Gammon Aug 27 '17 at 22:00
  • Oh, I thought I saw 5V to the MCU. I use 7808s between 12V and Vin now, since I had a few devices die on me. What's your secret - do you heatsink those tiny regulators? – user2497 Aug 27 '17 at 22:02
  • @user2497 - the current consumption of the logic (Uno) is low. The door lock doesn't go through a regulator. – Nick Gammon Aug 28 '17 at 2:18
11

If you want to use an Arduino in this sort of environment, there are a few things to watch out for:

  • Heat (usually from sunlight striking the enclosure). This could be relevant for your project, depending on the installation and location of the door. Choice of enclosure material, colour and finish can all affect this.

  • Rollover of millis() (see http://playground.arduino.cc/Code/TimingRollover). After 55 days, the millis() function on the Arduino rolls over and resets back to 0. Depending on if/how you use this, it may affect you.

  • Power supply stability. If you choose to power your Arduino directly from 5v, ensure that it is a smooth stable supply. I've had noisy power supplies cause some weird resets and glitches.

  • Water ingress. Again, this depends on location. Don't forget to account for condensation and frost (if applicable).

  • Flyback from relay switching and locking solenoids. Add flyback diodes to relay coils and solenoids to stop any flyback voltages killing your control circuitry. See https://en.wikipedia.org/wiki/Flyback_diode

I've run in to all of these issues across various Arduino projects. They may not cause the system to fail completely, instead causing strange behaviour.

If you design your system to account for all of these factors, then it is absolutely reliable enough to run something 24x7x365.

  • 8
    But not on the last day of leap year? – Michael Karas Aug 30 '16 at 8:58
  • 1
    As far as Water ingress goes, look for enclosure's and connectors rated IP67 or better. – MDMoore313 Aug 30 '16 at 18:12
  • @MichaelKaras - very amusing! – Nick Gammon Aug 30 '16 at 22:01
  • 3
    @MichaelKaras That's the routine maintenance day :) – toxicantidote Aug 30 '16 at 23:45
  • 2
    @BigHomie IP67?!?! Only a few months ago everyone was trying to migrate to IPV6! Just shows you how fast the internet moves... – Anonymous Penguin Dec 22 '16 at 20:54
7

If you can guarantee that your hardware and software skills are impeccable then you can certainly trust the MCU on the board. After all, the ATMega chips aren't toys, even though many people around here seem to treat them as such. They are a professional industrial product.

Of course, this is assuming that the Arduino you have is genuine and not some cheap Chinese knock-off with gawd knows what on the board.

  • 1
    Not to mention, try explaining to your insurance agent that the reason your house was broken in to was because you screwed up a pointer reference that caused your door to unlock at midnight. :) It's better to leave it up to a commercial lock—one that has been tested. The mere fact that the OP is questioning the board and their skills may suggest that they should get something already built, at least for securing their home. – Anonymous Penguin Dec 22 '16 at 20:58
  • The prices for the originals (Genuino here) are too high. Tell me how they are more reliable. – user2497 Aug 27 '17 at 13:51
4

Replying to Majenko's answer with more depth. The limits of the Arduino hardware depend on the ATmega CPU it's built around (I suspect you'll be directly migrating from Arduino to the final PCB).

but I'm not sure if the platform is stable enough to use it for something >like this.

Thus it may be worth considering for you to read through the data sheet. I'd read through it and look at the parameters which could affect your project. For example, the ATmega is only designed to work properly within certain temperature ranges (so this may affect your lock if it's outdoors in the cold). If you're relying on the built-in timer for something in your project, then that can get affected by temperatures, for example — as opposed to using a quartz crystal for reliable timing.

So you'd need to think how your project can fail with the parameter limits of the hardware components. For example, if you're activating the door lock with a secret code stored on external memory, then the memory used may get corrupted when it gets near a magnetic field.

2

To add to the already good advice so far.

Safety and security wise you need to plan and anticpate for failure. An electromechanical lock or your power supply are hardware wise probably more likely to cause issue than the Arduino board, just watch for back emf and use a flyback diode or snubber as mentioned if required. There may be issues though in your code being stuck in a loop or say card reader or contact faults and so on, this may require a simple on-off at best.

Consider using a battery backed power supply for short blackouts or brownouts.

Then consider your lock type and what will happen in an emergency or with a fault.

Locks such as a strike or mortice lock allow you to use standard door hardware so you have the capability to use a free handle egress out so you won't be trapped in an emergency. You can then also fit a key barrel so if the lock has failed you have a backup way of entry.

With either type you can then have a fairly good balance of safety and security, if you set it up as fail secure your house will not be vulnerable in a power outage or PSU fault whilst also not trapping you inside.

In a commercial setting fail safe is commonly used on non secure common areas and rooms but preference for a residential front door is fail secure.

Other lock types such as maglock, drop bolt, V-Lock, hook and loop and automatic doors among others do not have purely mechanical methods of using the door in a fault so are harder to use in a residential setting and may need emergency breakglass or stop buttons to cut power on the inside and keyswitch or pincode unit on the outside in case of fault if no other entry point available.

Maglocks for example are fail safe only and will open once power is off,potentially leaving your home vulnerable, so need fairly significant battery backup. However I have also experienced issues where a door controller has failed and will not release, as it is a maglock the power has to be broken and there was no method of release externally and no other point of entry.

I would suggest a strike or electronic mortice lock for your purpose and suggest an off the shelf unit, it will be far more reliable long term.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.