[PYTHON] Since I made my own smart lock, I will summarize the difficult points

A beginner in IoT development tried to make a smart lock. I will summarize the jammed parts.

Made

I made a smart lock. There are two ways to unlock and lock.

IMG_1793 (online-video-cutter.com).gif

The inside is like this. I'm still using the breadboard and jumper wires, but I'll leave them as they are because it's easier to add new features. IMG_1794.jpg

Constitution

In order to unlock and lock using the endpoint, we created the following configuration.

Untitled Diagram.png

Technology used

The backend is serverless. Because I only use it, renting a server is costly. I used Serverless Framework for deployment.

I wanted to use WiFi, so I chose ESP32-WROOM-32. I used it for the first time, but the development was very easy. It can be developed with the Arduino IDE.

Difficulty

I will write about the difficult points in this development.

It was necessary to ensure availability while reducing power consumption

This time I decided to supply power from the battery. Frequent battery exhaustion is very inconvenient as a smart lock, and it can also cause you to be locked out of your house in the worst case. Therefore, it was necessary to reduce power consumption as much as possible.

As a countermeasure, we aimed for a solution ** by selecting ** ESP32-WROOM-32. ESP32-WROOM-32 has a function called DeepSleep, which can suppress ** current consumption in sleep mode to 10uA ~ 150uA **.

However, when you actually operate it, the battery will run out in about a week. Therefore, it was not possible to make a product equivalent to a commercial smart lock.

Mobile battery shuts down automatically

The mobile battery was originally made to charge mobile phones, etc., and seems to have a function to automatically stop to prevent overcharging and to avoid wasting power. ** Basically, this function is attached to the products sold at home electronics mass retailers **.

This problem was solved by using this mobile battery. cheero Canvas 3200mAh Mobile Battery for IoT Devices White CHE-061

I was confused about how to install a smart lock

Of course, if you attach the servo motor to the key, the servo motor will rotate as shown below. IMG_1776.gif

In order to fix this firmly, I used L-shaped metal fittings. However, I didn't have much experience in using such metal fittings, and it looked bad. IMG_1797.jpg

It is difficult to operate DynamoDB with boto3

It's not the main point, but it was difficult to send a request to DynamoDB using Python's boto3 API. The API specification was complicated and it took me a long time to understand.

I decided to use PynamoDB on the way. Development has become much easier.

Impressions of development

Life has become much easier because you can unlock the doorknob just by grabbing it.

Also, when a friend temporarily goes in and out of his room, he can unlock and lock without sharing a physical key, so it seems that there will be convenient situations in the future.

ESP32-WROOM-32 Development using the development board was very smooth. Even if the money is a little expensive, I realized that if you want speed and comfort of development, you should buy a development board. I used to use PIC for money and use ESP-WROOM-02 DIP kit.

I had a hard time installing the smart lock on the door. I also bought a 3D printer because my ancestors on the net often use 3D printers to tackle this problem. I would like to use it from the next development.

When actually developing a product, it is required to meet many standards such as making it small, inexpensive, and of high quality. We also need know-how such as mass production. I would like to work in embedded systems in the future, so I would be happy if I could accumulate more know-how like this.

Recommended Posts

Since I made my own smart lock, I will summarize the difficult points
I made my own research tool using the legal API [Smart Roppo]
I made my own language. (1)
I made my own language (2)
I made my own AML
I made my own Python library
I don't have the skills or strength, but I made my own compiler
I made my own primitive static site generator
I made my own parallel link robot (software version)
I made my own parallel link robot (mechanical edition)
I made my goimports
I made my own OSS because I wanted to contribute to it
I made my own 3-layer forward propagation neural network and tried to understand the calculation deeply.
[Python] I made my own library that can be imported dynamically
Python> I made a test code for my own external file
I made my own filter plugin for text parsing of Ansible