DIY Emergency Dialer and SMS Sender Prototype With NodeMCU and 4G Module

by taste_the_code in Circuits > Assistive Tech

389 Views, 3 Favorites, 0 Comments

DIY Emergency Dialer and SMS Sender Prototype With NodeMCU and 4G Module

SOS Emergency Caller Prototype with NodeMCU and Crowtail-4G SIM A7670E

In this Instructable, I'm excited to share a new device prototype that's particularly useful for elderly people or individuals who require care. This prototype uses a NodeMCU, a 4G module, and two simple push buttons to create an emergency dialer and SMS sender. By pressing one button, the device can automatically dial a predetermined phone number and by pressing the other, it sends out an SMS alerting that the user needs attention.

Let's dive into how this project works and demonstrate its capabilities using my setup here.

Supplies

MVI_1314.MP4.00_00_20_17.Still001.jpg
MVI_1315.MP4.00_01_16_12.Still001.jpg

Crowtail 4G SIM A7670E Module

MVI_1312.MP4.00_01_10_22.Still002.jpg

The Crowtail 4G SIM A7670E module is the core component of our emergency dialer and SMS sender project. It's specifically designed to provide 4G connectivity with various additional features that make it versatile and practical for different applications, especially in mobile scenarios for IoT projects. 

This module utilizes the SIMCom A7670E module to deliver LTE capabilities. It includes a series of useful ports and functionalities: a USB-C port, a UART port, a battery connector with an onboard charging circuit, and indicators via LEDs to show various states such as power and network activity. The USB-C port allows for direct connection to a computer, enabling the module to function as a 4G modem, providing internet access. Meanwhile, the UART port facilitates direct communication with microcontrollers, like the NodeMCU, through simple AT commands.

Additionally, the module features a combined headset jack, dual antenna connectors for 4G and GPS functionalities, and an under-side SIM card holder. The GPS capability is particularly helpful for tracking and location-based services, which can be integrated into the project if needed. This combination of features makes the Crowtail 4G module highly effective for projects that need both communication and geolocation abilities in a compact and easy-to-integrate form factor.

Wiring the Module and Components

MVI_1312.MP4.00_00_00_00.Still001.jpg

To start assembling the emergency dialer we need to connect the hardware components. We have two push buttons, a NodeMCU board to act as the brains of the device, and the 4G module.

For the push buttons, we'll wire one side of each button to the ground (GND) on the NodeMCU. The other side of the first button (the call button) is connected to pin D1, and the other side of the second button (the SMS button) is connected to pin D2. These connections enable the NodeMCU to detect button presses and determine whether to make a call or send an SMS.

Next, we'll handle the connections between the NodeMCU and the 4G module. Connect the D6 pin of the NodeMCU to the RX pin on the 4G module, and the D5 pin of the NodeMCU to the TX pin on the 4G module. We use the software serial library to manage these communications, which is crucial for sending the correct commands to the module for dialing and messaging. Make sure the 4G module is powered appropriately – in this case, via a separate 5V through its USB connection, and make sure that the GND pins of the two boards are connected so the have the same voltage reference.

Arduino Code for the Dialer

To control our emergency dialer and SMS sender, we've implemented a code structure on the NodeMCU using an Arduino sketch. The code primarily utilizes the software serial library to enable communication between the NodeMCU and the 4G module via the designated pins D5 (TX) and D6 (RX).

When the device starts, the initial state of the two push buttons is checked through the digital read function. Depending on which button is pressed, different actions are triggered. For the call button connected to pin D1, when it's pressed and detected as LOW, a specific AT command is sent to the 4G module to dial a predefined caregiver number. If the button is pressed again during an ongoing call, another command is issued to hang up.

For the SMS functionality associated with the second button connected to pin D2, the process is slightly more intricate. Initially, several commands are sent to prepare the 4G module to send an SMS in the correct format, which is generally Unicode to ensure carrier compatibility. Once the module is ready, an AT command along with the caregiver number and the message content (followed by a Ctrl+Z character to signify the end of the message) is sent over.

Besides these operations, there are helper functions within the code to manage the sending and receiving of data efficiently. There’s also a function dedicated to monitoring the call status, crucial for handling actions like terminating a call when the recipient hangs up or when the device needs to disconnect automatically. All these elements work together to make the device functional and responsive to user interactions.

The full code for the device is available on my website.

Testing the Device

MVI_1319.MP4.00_01_25_21.Still001.jpg
MVI_1312.MP4.00_01_52_03.Still003.jpg
MVI_1319.MP4.00_02_27_04.Still002.jpg

To test the functionality of the emergency dialer, I'll demonstrate how the device operates when the call button is pressed. After setting up the prototype on my workbench and ensuring all connections are secure, I begin by pressing the call button connected to pin D1. This triggers the NodeMCU to send a dial command through the software serial communication to the 4G module.

Once the button is pressed, the NodeMCU instructs the 4G module to dial the predefined number that I programmed earlier. I'm using my own phone number for this test. Upon pressing the button, I notice a small delay — this is expected as the module establishes a connection with the cell network. Soon, my phone begins to ring, indicating that the call has been successfully initiated. To validate the functionality, I answer the call and can clearly hear my voice through a connected speaker, confirming the microphone on the device is also working as intended.

To complete the testing, I end the call using the same button, triggering the NodeMCU to send a hang-up command to the 4G module. This successfully disconnects the call, demonstrating that both initiating and terminating the call function as designed.

Next Steps

MVI_1313.MP4.00_00_28_14.Still001.jpg

We've successfully explored and demonstrated how the emergency dialer and SMS sender prototype operates, showcasing its potential as a vital tool for elderly care or individuals requiring immediate assistance. The integration and functionality of the Crowtail 4G SIM A7670E module have proven effective for the purpose of this project, enabling both impactful communication through calls and SMS, as well as the possibility of integrating GPS functionalities for additional tracking purposes.

Looking ahead, there's room to expand and tailor this prototype to meet more specific needs or environments. For instance, incorporating sensors that could trigger alerts based on environmental changes or personal health crises could further enhance its applicability. Additionally, refining the user interface, perhaps by adding more intuitive button labels or even voice feedback, could make the device even more user-friendly, especially for its target demographic.

Adding a separate speaker to this device can significantly improve its functionality by enabling clearer and louder audio output, which is especially useful for users with hearing impairments or in noisy environments where important calls or alerts must be heard promptly and clearly.

If you have thoughts or suggestions on how we might further develop this project, or if you have ideas for other uses of the 4G module in similar DIY projects, please share your thoughts in the comments.

If you found the article useful, you can subscribe to my YouTube channel for more DIY electronics projects and tutorials.