Simple Door Lock - A 3D-Printing and Arduino Project
This door lock is the ultimate solution to the very professional way of keeping the door to the 3d-print shop shut (which didn't work well BTW.) seen in the last image.
Actually, an electric door lock was installed before but there was an issue with the controller, rendering it more or less useless...
The project consists of two main parts, namely the outdoor door terminal and the indoor electronics enclosure. I used an Arduino Uno as the controller, however, it works with others as well.
Make sure to check out the [accompanying video] of this project for more information!
For now, I only publish the dual-color outer terminal cover, and the multi-colored model for single extruder machines is still WIP!
These are the parts that I used:
- 1x Arduino Uno
- 1x LCD 1602 with I2C adapter
- 1x 1A fuse with DIN-rail holder
- 1x door lock 12v
- 1x PSU 12V 10A (to be mounted externally)
- 1x Indicator Red 12V
- 1x Indicator Green 12V
- 2x 5V Relay Module
- Electronics enclosure base
- Electronics enclosure cover
- Door terminal base
- Door terminal cover
- Pinheads and sockets or DuPont connectors
- 0.14 and 0.25mm wires
- Ferrules for screwed wire connections
The printed parts in this thing are just the outside terminal and the inner enclosure. It doesn't include the DIN rail and holders for the inner enclosure.
Here are links to the mentioned parts:
The inner enclosure can be printed in PLA while the outer enclosure has to be printed in PETG, ABS, ... to avoid bending/melting like seen here and here.
The assembly takes longer than you might expect, be aware of that!
- Print all parts and get everything ready
- Connect the 5V part according to the schematics (blue wires, see below). Either solder the wires to the pinheads and sockets (like I did) or use DuPont connectors. You need to be able to quickly disassemble/reassemble it later on when you install it. Also, it's better to have the wires too long than too short, as you need to pull them thru the wall!
- Test it out. Don't forget to upload the firmware (see below).
- If everything is fine so far, go on with the 12V part (black in the schematics). The Arduino's power is supplied with the 12V attached to the VIN (+) and GND (-) pins.
- Take a good look over your circuit. Is it safe? Use common sense! Double-check everything. Then supply 12V using a PSU and test it out.
- Alright, it's working fine, now, remove all power and start installing it into the cases. You might need to disassemble some parts.
- Use some silicone to make the LCD screen waterproof.
If you encounter any difficulties or stuff that is unclear to you, just comment me!
Anet A8 (w/ dual extrusion mod)
The above-mentioned settings are more or less a reference.
The inner enclosure is best printed in PLA with your preferred settings. I printed it on my JGAurora A5 in BQ Gray PLA.
DO NOT PRINT IT IN PLA!
I did it for the first time, and the model started to bend like 5 minutes after installation in the summer heat!
I ended up printing it in orange and white PETG. The base can be printed with your preferred settings, but I'd suggest using at least 1.2mm of shell thickness.
The most tricky part is the cover:
Use high infill or print it solid!
It's going to "feel" stronger when you enter the code later on.
If you have a single-extruder machine, wait a week or two until I publish my dual-color cover for single-color printers. It's still WIP.
For dual-extrusion machines, take care of a few settings if you use Cura:
- As PETG likes to "run" out of the extruder, cool the inactive nozzle to 170-180°. Also use fast travel moves and optional higher accelleration.
- Use full Combing to avoid retractions-and-travel moves. I used normal painter's tape and can't print the first layer faster than 20mm/s (travels are like 50), and PETG tends to "ooze" out during these travel moves. If you inspect my images closely, you can see how it's going to look if you leave it on!
- I used extra shells (2mm thickness) as I like the thicker outlining of the letters.
If you have any problems with merging of the parts or printing, comment me right away!
Upload of the Firmware
Before you can test anything, you need to install the software onto the controller.
You need to have the Arduino IDE with the Arduino drivers installed for it to work.
Install the LiquidCrystal_I2C Library
My software depends on the LiquidCrystal_I2C library by marcoschwartz.
Download it using the "Clone or Download" button and extract it. Now, open up your Documents folder where you should find an Arduino folder. Inside this one, there's a library folder in which you'll create a new folder using the name of the library, so "LiquidCrystal_I2C" in this case.
Next, open up the LiquidCrystal_I2C-master folder in the recently unzipped one and copy all the contents to the newly created folder!
Complicated? Just check out the video, where I show how it works!
Installation and Configuration of my Firmware
Now, download my firmware from Pastebin.
Note: I'm not a C/C++ developer, so don't judge me on the code! I'm aware that there are like 1000 ways of making the code more efficient, but I'm learning.
Create a project folder and put the downloaded file inside. Then, rename it to the
foldername.ino and open it.
doorlock.ino (placed in above folder)
Once opened, click "Verify" and check for errors. If there are some, let me know.
Scroll down nearly all the way to the bottom to the Configuration Area, where you can adapt the firmware to your environment.
Note: Nearly everything in my software can be adjusted, which is very helpful especially if you want to use another controller. But, if you use the exact same setup as I did, the only thing that you should change is the passphrase.
After all changes are adapted, don't forget to save and verify the code again. If there are any errors, they normally can be found quickly. If not, let me know.
For the upload, connect your controller to the PC using a USB cable. In the
Tools menu, select your correct board, which in my case is
Then, select the Port where the Arduino is connected to. To find it out, open the Windows Device Manager and expand
Ports, where your Arduino should be listed. This is the correct port to use in the Arduino IDE. If your controller is not listed, make sure that it is connected to the PC and the drivers installed.
Once Board and Port are all set, hit the
Upload button. Normally and when the code is fine, the upload process should start.
If it compiles fine (can also be checked by just hitting
Compile) but doesn't upload, unplug/replug the device. In most cases, this fixes the problem.
Schematics and Wiring
I'm not responsible for anything you do or any occurring side-effects of the actions you do because you read this thing or watched my video! Every action I show should be approached with common sense before you copy it.
However, safety is very important to me, but there can't be any guarantee.
Electrical safety starts with the basics:
- Use common sense! I can't stress this more. Yes, you work with 5 and 12V, but still, even low voltage appliances have caused fires...
- Switch the PSU off before you do anything!
- Never apply line voltage (115/230V) to this project! This project works with 12V DC, while the controller regulates it down to 5V DC for itself and the control circuit. Everything else is wrong!
- Pay attention to the connections!
Wrong connections in the 5V and 12V areas hopefully won't hurt you but could destroy the Arduino or peripherals!
- Never solder wires for screwed connections, use ferrules instead! They don't cost much, are easy to apply and really increase the safety!
- Everything else that I didn't think of now but is or could become dangerous!
The schematics can be found using this link.
It is a scan of the schematics drawn in the design phase of this project.
If you have any questions about the wiring, better ask me before you do something wrong. Although I have used these schematics for my own implementation, there's no 100% guarantee that everything is true what's shown there!