Building a Mini Emergency Alert System: PIC, GSM, and a Call for Help
Imagine using your phone’s power for remote access beyond calls and texts. GSM modules unlock that potential, mimicking your phone’s functionality: making/receiving calls, sending/receiving SMS, and even connecting to the internet! They open doors to creative projects, especially when paired with microcontrollers.
This project tackles one such idea: building a mini emergency alert system using a PIC microcontroller and a GSM module. Think silent button presses triggering calls for help, similar to Japanese school devices that alert parents. We’ll guide you through interfacing the PIC16F877A microcontroller with a GSM module (SIM900A or similar), demonstrating how to initiate and receive calls.
Why This Project?
We’ve explored this concept with Arduinos and Raspberry Pis, but the PIC offers an affordable, unique learning experience.
What You’ll Need:
- PIC Microcontroller (PIC16F877A)
- GSM Module (SIM900A or similar)
- 16x2 LCD Display
- 5V Adapter
- PicKit 3 (or compatible programmer)
- Other stuff (Like Push buttons, Resistors, Oscillators, wires, etc.)
Steps in brief
Hardware Integration: The foundation of our project lay in seamlessly integrating the PIC microcontroller (PIC16F877A) with a GSM module (SIM900A). This involved meticulous attention to pin configurations, ensuring stable power and ground connections, and establishing communication protocols between the two components. The harmonious interconnection of hardware elements formed the backbone of our Emergency Communication System, enabling reliable call initiation and reception functionalities.
Refer these:
Software Development: With hardware integration in place, our focus shifted to software development. Utilizing MPLAB IDE, we meticulously crafted code to handle button presses and initiate emergency calls through the GSM module. Error handling mechanisms were implemented to ensure robust communication, and optimizations were made to enhance efficiency. The iterative process of code refinement and testing culminated in a finely tuned software interface capable of seamless interaction with the hardware components. We use Proteus Design Suite for simulations. Please note that GSM functionality is not directly available within Proteus itself. However, there are workarounds and alternative methods you can use to simulate GSM modules and their functionalities within your Proteus environment. We use the GSM Library for that.
MPLAB® X Integrated Development Environment (IDE): https://www.microchip.com/en-us/tools-resources/develop/mplab-x-ide
Proteus PCB Design & Simulation: https://www.labcenter.com/
GSM Library for Proteus: https://www.theengineeringprojects.com/2016/03/gsm-library-proteus.html
Challenges Faced and Solutions: Throughout the project, we encountered several challenges, most notably communication errors between the GSM module and the PIC microcontroller. These issues, stemming from inaccuracies in AT commands, prompted us to adopt a pragmatic solution. Leveraging the versatility of Arduino for real-time debugging and re-programming, we swiftly identified and rectified command discrepancies, ensuring accurate execution and reliable communication.
Future Implications: Our project opens doors to many future implications and possibilities. The potential for further innovation is vast, from enhancing functionality to exploring alternative technologies and integrating with emergency response systems. By sharing our project journey and insights, we hope to inspire others to embark on similar endeavours, pushing the boundaries of technology to create impactful solutions.
Results and Analysis
Simulation
Once you understand how the program works, you can try simulating and making changes to fit your needs. The simulation will save you a lot of time. The simulation is done using Proteus and it looks like below.
Circuit
We have simply interfaced the Tx and Rx pins of the GSM module with the Rx and Tx pins of the PIC MCU PIC16F877A, respectively. This will establish a Serial connection between both. Also, so don’t forget to make common ground for both the GSM and PIC. We have also used an LCD to know the status of our GSM module. Once the connections are done, your hardware will look like something below.
Code
We add project code to GitHub for easy access. We hope to add additional modifications. You can select what version of the code is suitable for you and use it.
Debugging
We encountered several common defects in these types of hardware-related products during the development of this project. Here are the solutions we implemented to address them:
1. Related Code:
While the provided C code for PIC16F877A referenced existing sources (GSM module Interfacing with PIC Microcontroller — Make and Receive Calls), it malfunctioned when we used it. To overcome this challenge, we built our own code, which is available on GitHub(Assignment/Embedded Systems/Mini Project at main · manulthanura/Assignment).
2. SIM900A Module:
After successfully addressing the code issue, we encountered a problem where the circuit couldn’t recognize the SIM900A module. We addressed this by modifying the code to include a method that checks for successful module identification. If the module is not identified, an “Module Not Found” message will be displayed on the LCD.
3. SIM Card:
We faced a similar issue with the SIM card as with the module. This problem was further complicated by the inability to detect the error in simulations. However, using the methods described above, we implemented a successful solution.
4. Other Issues:
In addition to the main points mentioned above, we also encountered the following issues:
- Emergency Button: While a call would be initiated on the first press, repeated presses resulted in malfunctioning. We addressed this by utilizing the Interrupts event concept, leading to a successful outcome.
- Power Source: Using a laboratory power supply for circuit testing was inconvenient. To address this, we implemented a USB port to power the circuit from a laptop. Additionally, the circuit can be powered using a battery for portability.
It’s important to note that you might encounter additional problems during implementation. However, by employing patience and searching for established methods, you can achieve successful results.
Final Outcome
Despite encountering various challenges throughout the development process, we are pleased to report that the project was successfully completed. The final product met the initial objectives of interfacing the PIC16F877A microcontroller with a GSM module (SIM900A) And making our emergency system successful.