Introduction: Website Controlled Lock Box
This is a locked box that can be opened by giving a prompt on a website. This means, you can lock things away in the box and only get access to them once someone entered a given passphrase on a public website. Why would one need this? Here is one example of someone locking away his/her ice cream. Just put the key in the lock box and let someone else decide whether or not you will get your treat. For the more kinky minded people out there, there are a lot of other "things" that can be locked away and this box will help you giving your keys to someone else w/o even leaving your home.
So how does this work? The box is closed and can only be opened from inside the box. Hey, you might ask, who is inside the box opening it? It is a small piece of electronic, that connects to the internet. It checks on a predefined web page like every 10 minutes or every 8 hours, you name it. If the content on the web site is featuring a preset keyword, then the device activates a solenoid that will open the box. The web-page that is checked can virtually be any site on the WWW. For example I use a profile page on emlalock.com and look for the key phrase: "Lalle's lock: open". If the person holding that profile page adds this phrase to her page, the box will magically open and release whatever I have locked away.
Step 1: Material List
You can use any box you like. Here is where I bought mine:
The Solenoid lock (i.e., an electro magnetic retractable bolt) was also ordered from China
A 12V Power supply
A step down voltage converter
https://www.banggood.com/10Pcs-LM2596-DC-DC-Adjust... (1,00 €)
Finally an IoT (Internet of Things) device that is programmable.
WeMos D1 Mini (~3.50 €)
A few cables, perforated steel sheet (for the lock bar), ...
Overall costs: ~ 16 € (~18 US $)
Step 2: Programming the WeMos D1 Using ARDUINO Software
If you have no experience with programing a WeMos, here are some useful links to get started:
I have compiled a simple (yet effective :-) program, that connects the WeMos to your home network using the WiFiManager library. The credentials are saved in the EEPROM (using the eeprom library), thus the initiation has to be done only once. You will see that there are a couple of other libraries required, too. You can download and install them using the ARDUINO programming environment. In addition you also have to install the WeMos board using your ARDUINO environment. If everything is installed on your computer, connect the WeMos to your computer, select the device ("WeMos D1 R2 & mini") and the virtual COM port (see figures above).
In the software listed below, you will have to make a few changes, unless you only want to open your box, when I say so on my profile page :-). If you are using an emlalock profile page, make sure the holder of that page made his or her profile public. Otherwise you would have to log in with your WeMos first. I guess this can be done, but I am not trying to figure out how, right now. Read the comments in the source code and modify as you please. In addition, of course, test the software using the debugging features. Basically you can see if it is working correctly in the serial monitor of the ARDUINO environment.
Step 3: Connect
Once the software is installed, the WeMos will start with the WiFi manager. You will see a new wireless network appearing in your home network environment. Connect to it using your mobile or computer and start your web browser. If the welcome screen (as shown above) does not open when starting the browser, try entering the IP "192.168.4.1" directly. Click on configure WiFi and select your home network and enter your password. That's it! The WeMos will now connect to your network. You don't have to continuously keep the lock box attached to the power line. Next time you start the device, it will remember the credentials as they are saved in the EEPROM (electrically erasable programmable read-only memory).
Once the connection to the WWW is established, the software will open the desired web page and look for the key phrase. This will be repeated every 10 minutes (10 min is the default value, see comments on how to change this).
Step 4: Solder a Little Bit
If everything works fine according to your serial monitor, you can now connect the relay to your WeMos, the solenoid and 12 V to the relay, and 12 V to the in-port of the voltage regulator and 5 V from out-port to the WeMos.
I have made a figure illustrating how to connect everything. If you have ordered the WeMos relay shield, you can put it on top of the WeMos if you take your time soldering all pins that come with both devices. If you decide to connect directly, use the scheme shown in the figure. Don't forget that the relay also needs the 5V power supply! You might also add an LED indicating that the box can be opened and a push button to activate the solenoid (which works only if the passphrase was found). I have prepared these features in the source code but didn't implemented them in the simplified version shown here. Moreover, a lot of cool features can be added to this box. I might throw in some ideas later on but I also be happy to hear your comments.
Finally, glue everything in place inside the box, throw in the key to your ice cream box and close the box. Have fun waiting, and remember to always play safely :-)
We have a be nice policy.
Please be positive and constructive.
Hi, i'm desperately trying to use the emlalock api instead, but my barely existing coding skills give me a headache. Did anybody try to modify it to use the emlalock api?