DIY

Doorbell with SMS alert (via the Internet)

Doorbell with SMS alert ( via the Internet) In this article, the wizard will tell us about assembling a doorbell that will send SMS -message when pressing the button. This function is convenient, for example, in a private house or industrial premises. When you press the doorbell button, an SMS notification will be sent to the owner and you can be sure that even at a considerable distance from the front door, you will know that you have a visitor.
You can also install it indoors and use it for control. For example, when a schoolboy comes home, he presses a button and the parents know that he is at home.
Tools and materials: -HUZZAH32 board – ESP32; -Jumpers; -Breadboard; -USB-C-USB cable; -Normally open button;
-Computer;
-Soldering accessories; -Pin connectors;
Step one: FeatherS2
FeatherS2 is a 32-bit single board computer measuring 2 “x 7/8”. It has Bluetooth, Wi-Fi and battery charging support, as well as 16MB of flash storage. FeatherS2 comes without breadboard connectors.
Doorbell with SMS alert ( via the Internet) As a first step, we need to solder the connectors. Installing the connectors on the breadboard. Install FeatherS2 on top. Soldering.
Doorbell with SMS alert (via the Internet) Doorbell with SMS (via the Internet) Step two: software
FeatherS2 board supports Circuit Python. Circuit Python is a derivative of Micro Python, an open source project designed to enable people new to software to program new electronic projects. Traditional software for embedded systems, computers, written in the “C” programming language. For example, most standard simple Arduino onboard computers use the Ardunio interactive development system and the C programming language. C, as a programming language, is generally considered more difficult for newbies to programming than Python.
Circuit Python is an offshoot of Adafruit's Micro Python. It is open source and maintained by a fast growing company.
We do not need to write any programs for this project. You just need to create a configuration file and debug the system. The wizard uses the Mu editor for both of these tasks.
Go to the Code with Mu site, download the version for your operating system and install it.
Then press the first button at the top left, at the bottom press “mode” and select Circuit Python.
Exit the editor.
The error message stating that you have no Circuit Python device connected can be ignored.
Doorbell with SMS alert ( via the Internet) FeatherS2 comes with a built-in Python schema. Circuit Python compatible devices have unique capabilities. You plug them into your computer and they are labeled as USB stick. However, when you copy a Python program with the special name code.py to the device, it reboots and runs the program.
So, we connect the device and find CIRCUITPY on the desktop or in the file finder. If it does not appear, make sure the USB-C cable is fully inserted into the device. If you still can't see it, try pressing the RST button on the board for about 3 seconds. If that doesn't work, head over to the Adafruit troubleshooting site:
Troubleshooting Adafruit Circuit Python
Doorbell with SMS alert (via the Internet) Doorbell with SMS alert (via the Internet) As soon as the CIRCUITPY device appears on the desktop, reload the MU and select “Load”. Next, select a file named code.py and open it.
Different Circuit Python devices will appear on the computer under different names. If you are using a board with a different Circuit Python version than FeatherS2, look for a new USB device when plugging in the microprocessor board.
 Doorbell with SMS alert (via the Internet) Next, we'll use the Mu Editor to learn about debugging software using the program that comes with FeatherS2. This will prepare the user to install their own specialized software.
In the Mu editor, press “Serial,”, a new window should appear at the bottom of the screen.
Next, you need to save the program to FeatherS2. Remember that when you save a program to a Circuit Python device named code.py, it runs. You should see the results of the program execution in the sequential display area. The multicolor LED should also change color on the FeatherS2.
Doorbell with SMS alert ( via the Internet) Now stop the program.
Click in the serial number window.
Enter ctrl-c. Enter ctrl-d. This command forces FeatherS2 to reboot and restart the program. The screen should look like the picture for this step. Every time you want to stop a running program, enter ctrl-c. After saving the program, type ctrl-d to restart it.
Doorbell with SMS alert (via the Internet) Python program, uses several modules from the Adafruit CircuitPython library. You can copy individual models from the library you want, but if there is enough space, you can copy the entire libraries.
The Adafruit CircuitPython library is located at:
CircuitPython Libraries
We will need to download the zip file, unzip it, and then inside the unpacked directory find a folder labeled “lib”. Next, you need to copy this folder to FeatherS2. If the device already has a lib folder, overwrite it.
If you do not want to take up space for the whole library, then you can selectively copy only the modules used in this program into the “lib” folder. The “Fees2_SMS_button.py” program that the wizard accompanies this tutorial uses the following libraries:
import ssl
import wifi
import socketpool
import adafruit_requests
import time
import board < br> import digitalio
import feathers2
import binascii
Doorbell with SMS alert (via the Internet) Magic SMS Button uses Twilio service to send SMS (text) messages. Sending SMS messages to one recipient with a single button is compatible with a “trial” subscription to the Twilio service and is completely free. You will need a credit card. However, your card will not be charged unless you renew your subscription.
Go to Twilio and sign up for a trial account.
After setting up an account and choosing a phone number, click the “home” icon. To use the SMS service, you need to copy three key elements: “account sid,” the “auth token,” and “phone numbers.”.
If you are using a Twilio trial account, you need to “verify” the destination phone number before than successfully using the SMS service. Here is a link to the Twilio page to verify your phone number.
Doorbell with SMS alert (via the Internet) Step three: connecting the board
After installing and configuring the software, you can proceed with the installation.
This electronic breadboard consists of four parts. The whole connection is intuitive.
Doorbell with SMS alert (via the Internet) Step four: testing the button
The electronic layout should look like in the photo. Now you need to check the circuit. We start with a Github repository with examples of Python diagrams.
Download the repository zip file and unzip it.
After connecting FeatherS2, open MU. Using MU, load a program called “feathers2_button_test.py” ..
Press the MU “Serial” button. Double click the MU tab that says feathers2_button_test.py. Go to your CIRCUITPY device (which is FeatherS2) and save the file as code.py.
Next, when you press the button, the program should start. If it doesn't, click in the serial console area and type ctrl-d. This action will reboot the device and the program should start.
Doorbell with SMS alert (via the Internet) Step five: configuring the SMS program
In this step, you will need to create a configuration file.
In the MU editor, click “Create” to create a new file. Cut and paste the code below into a new file, replacing the dummy data with the correct information that you copied from the Twilio website in the previous step.

 secrets = & # 123; & # 39; ssid & # 39; & # 58; & # 39; DrVax XXXXXXXXt & # 39 ;, & # 39; password & # 39; & # 58; & # 39; KHKHKHKHK & # 39 ;, & # 39; TWILIO_ACCOUNT_SID & # 39; & # 58; & # 39; ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx & # 39 ;, & # 39; TWILIO_AUTH_TOKEN & # 39; & # 58; & # 39; xxxxxxxxxxxxxxxxxxxxxxxxxx & # 39 ;, & # 39; TWILIO_FROM_NUMBER & # 39; & # 58; & # 39; + 1AAAEEENNNN & # 39 ;, & # 39; NOTIFICATION_NUMBER & # 39; & # 58; & # 39; + 1AAAEEENNNN & # 39 ;, & # 39; message & # 39; & # 58; & # 39; Your message here. Button pressed at & # 39 ;,}  

Each line without curly braces must end with a comma, including the last line. Single line spacing. All values ​​are case sensitive, including labels at the beginning of lines.
Save this file as secrets.py on FeatherS2.
 Doorbell with SMS alert (via the Internet) Step six: first launch
Using the MU Editor, open the program in an unpacked directory named “fles2_SMS_button.py”. Change the name of this file to code.py and save it to FeatherS2.
If the console is open, it will display as in the picture below.
First, the program displays the hardware address of FeatherS2.
Then displays the Wi-Fi networks and connects to the Wi-Fi network, which is specified in the secrets.py file
Then the IP address is displayed and the HTTP connection is configured.
When the button is pressed, an SMS is sent to the phone specified in the settings.
If you see any errors, make sure your secrets.py file is formatted correctly.
Doorbell with SMS alert (via the Internet) Step Seven: Debugging
Some things can go wrong. In most cases, if something goes wrong, you should start by checking the information in your secrets.py file. Typically you will see an error message in the MU serial console indicating what is wrong.
The picture shows what happens if the Wi-Fi password is incorrect.
 Doorbell with SMS alert (via the Internet) If the device does not connect to the network, and the password and name are set correctly, you need to check the signal strength. The antenna in FeatherS2 is quite small.
After sending a request to Twilio, the program will display the received response. For many potential errors in secrets.py, the user will see an error message in the response. When the SMS message is sent correctly, the program will display a long message on the console that looks like this.
Note that in this example, the wizard changed all the authorization information and phone numbers:

 **************************** debug output ********************* **********  
 ---------------------------------------- 200 & # 123; & # 39; timezone & # 39; & # 58; & # 39; America/Chicago & # 39 ;, & # 39; utc_datetime & # 39; & # 58; & # 39; 2021-04-06T19 & # 58; 24 & # 58; 56.268883 + 00 & # 58; 00 & # 39 ;, & # 39; raw_offset & # 39; & # 58; -21600, & # 39; client_ip & # 39; & # 58; & # 39; 73.209.1.53 & # 39 ;, & # 39; dst_from & # 39; & # 58; & # 39; 2021-03-14T08 & # 58; 00 & # 58; 00 + 00 & # 58; 00 & # 39 ;, & # 39; unixtime & # 39; & # 58; 1617737096, & # 39; utc_offset & # 39; & # 58; & # 39; -05 & # 58; 00 & # 39 ;, & # 39; datetime & # 39; & # 58; & # 39; 2021-04-06T14 & # 58; 24 & # 58; 56.268883-05 & # 58; 00 & # 39 ;, & # 39; week_number & # 39; & # 58; 14, & # 39; abbreviation & # 39; & # 58; & # 39; CDT & # 39 ;, & # 39; day_of_year & # 39; & # 58; 96, & # 39; day_of_week & # 39; & # 58; 2, & # 39; dst & # 39; & # 58; True, & # 39; dst_offset & # 39; & # 58; 3600, & # 39; dst_until & # 39; & # 58; & # 39; 2021-11-07T07 & # 58; 00 & # 58; 00 + 00 & # 58; 00 & # 39;} ----------------------- ----------------- QUNiYjZkOWVhNGJiNhkhkkhkhhkhkhkhkhkkhkhk0NWRhZjU4Y2ExODJhNTNmZA == --- & # 123; & # 39; Authorization & # 39; & # 58; & # 39; Basic QUNiYjZkOWVhNGJiNDRkNjjkjkjkkjkkjkjkjMzlmOGY0NWRhZjU4Y2ExODJhNTNmZA == & # 39;} SMS sent with status code 201 Response & # 58; & # 123; & # 34; sid & # 34; & # 58; & # 34; SM959e9198fd044cbc9e96b339f9506d37 & # 34 ;, & # 34; date_created & # 34; & # 58; & # 34; Tue, 06 Apr 2021 19 & # 58; 24 & # 58; 57 + 0000 & # 34 ;, & # 34; date_updated & # 34; & # 58; & # 34; Tue, 06 Apr 2021 19 & # 58; 24 & # 58; 57 + 0000 & # 34 ;, & # 34; date_sent & # 34; & # 58; null, & # 34; account_sid & # 34; & # 58; & # 34; ACbb6d9xxxxxxxxxxxxxx & # 34 ;, & # 34; to & # 34; & # 58; & # 34; + 1xxxxxxxx & # 34 ;, & # 34; from & # 34; & # 58; & # 34; + 1xxxxxxxx & # 34 ;, & # 34; messaging_service_sid & # 34; & # 58; null, & # 34; body & # 34; & # 58; & # 34; Sent from your Twilio trial account - Son, please call me. Button pressed at & # 58; 2021-04-06T14 & # 58; 24 & # 58; 56 & # 34 ;, & # 34; status & # 34; & # 58; & # 34; queued & # 34 ;, & # 34; num_segments & # 34; & # 58; & # 34; 1 & # 34 ;, & # 34; num_media & # 34; & # 58; & # 34; 0 & # 34 ;, & # 34; direction & # 34; & # 58; & # 34; outbound-api & # 34 ;, & # 34; api_version & # 34; & # 58; & # 34; 2010-04-01 & # 34 ;, & # 34; price & # 34; & # 58; null, & # 34; price_unit & # 34; & # 58; & # 34; USD & # 34 ;, & # 34; error_code & # 34; & # 58; null, & # 34; error_message & # 34; & # 58; null, & # 34; uri & # 34; & # 58; & # 34; /2010-04-01/Accounts/ACxxxxxxxxxxxxxxx/Messages/SM959e9198fd044cbc9e96b339f9506d37.json" ;, & # 34; subresource_uris & # 34; & # 58; & # 123; & # 34; media & # 34; & # 58; & # 34; /2010-04-01/Accounts/ACxxxxxxxxxxxxx5e4913939/Messages/SM959e9198fd044cbc9e96b339f9506d37/Media.json"}} *********************** **** end of debug output *************************  

If you change anything in your configy.py file, you must save it back to FeatherS2. If FeatherS2 does not restart the program, click on the console and type ctrl-c followed by ctrl-d.
You are almost done. Once the device is working properly, you can disconnect it from your computer. The program is saved on the FeatherS2, so you can simply plug it into a USB power source. A smartphone charger can be used as a power source. Of course, you still need to make a good case and maybe mount everything on a board, but this is already the user's choice.
 Doorbell with SMS alert (via the Internet) The whole process of assembling and configuring the device can be watched in the video.

Source:

usamodelkina.ru

Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button