Software apps and online services
Hand tools and fabrication machines
This project shows how to build a "smart emergency button," which sends a Pushbullet notification to pre-determined devices anywhere in world when pressed. This project uses as main board a Raspberry Pi Zero Wireless, a great board for prototyping small, powerfull and Internet of Things projects.
The motivation for making this project came from a story told me by a friend (Douglas Vieira), in fact a sad story. Douglas has told me that one of his relatives had a serious illness, and was alone in a day that has collapsed. Douglas' relative wasn't familiar with technology and had some difficulties to use cellphones/smartphones, what made the situation worse: help couldn't be called. Unfortunately, Douglas' relative has been found some hours after collapse only, and even going to hospital / emergency hasn't survived. Douglas told me that if his relative had a device really easy-to-use to call for help, maybe had a chance to survive. Also, considering that another one of Douglas' family members are in similar condition (serious illness and/or elderly people), the idea of a emergency device made more sense.
This project must be as easy-to-use as possible, able to trigger a emergency alert in a button-press event. Plus, it must have Internet connectivity, as long as the people who receive the alert can be located everywhere in the emergency trigger moment. Also, the project should allow improvements for future requirements (i.e. more emergency triggers, more possibilities of notifying people who can help, etc.). Considering this requirements, Raspbery Pi Zero Wireless fits well. This board has built-in wi-fi connectivity, powerful computational resources for an embedded device (powerful processing, good RAM memory amount and a bunch of GPIOs), small size (comparing to another popular Single-Board Computers available), can run Linux OS (a very reliable and powerful operational system, what allows great future improvements on project) and, last but not least, has a very competitive cost.
So, once defined the the requirements and main hardware board of the project, it's time to define how it should work. For this, consider the topics below:
- Raspberry Pi Zero W needs to initialize the project program after boot process, automatically
- The project program will check continuously a GPIO that has a button connected to. As this button is pressed, a notification is sent to whom must receive the emergency alert.
- Also, after sending the notification, the project program waits for the button release, to ensure only one emergency alert is sent per button press.
- Last, the notification send/receive platform must be defined. For this, this project uses Pushbullet (https://www.pushbullet.com/), a free push notification system that has clients for smartphones and tablets and very well documented APIs, allowing send notification from many ways.
To sum up, the project should work like shown in animated GIF below:
Getting deeper into project development itself, it's time to setup the hardware for the project. The hardware for this project includes:- Raspberry Pi Zero W. You will need to solder pin headers in it- A round arcade button (hole: 34mm)- Two male/female jumpers- A 5V micro-USB power source (I would like to recommend a 5V/2A power source).
Once you've got all the hardware parts required, put them all together according to project schematics (located in Schematics section of this post).
IMPORTANT: when wiring the round arcade button, NO (Normally Open) contact must be used. Otherwise, this project won't work as it is.
To enclosure all the project and make it looks cool, another friend of mine (Tiago Justino) developed a case / enclosure to use in this project. The full project with case can be seen in the pictures below:
This case was developed in Tinkercad and the stl files of the case are available in this GitHub repository: https://github.com/phfbertoleti/BotaoDeEmergencia
Once hardware is set, now it's time to start setting up the things for software part, and the first thing to do is to create an Pushbullet free account and get the Access Token of your account. To do this, follow the procedure below:
1. Go to the app stores of your devices (devices that must receive the emergency alert/notification sent by this project) and install Pushbullet app.
2. In one of the devices you installed Pushbullet app, open it and create your free account (it's pretty easy to do, and you can use your social networks to register your account if you want to).
3. Now, from a computer access Pushbullet website (https://www.pushbullet.com/) and log with account created in step 2.
4. Once logged in, click on "Settings", then "Account" and then in "Create Access Token" button (as shown in picture below).
5. Your Access Token will be revealed. Copy it and save in a safe place (you will need this Access Token further on this project).
Software setup - putting project source code onto Raspberry Pi Zero W
The project program / script is available in source-code section of this post. It's written in Python programming language, in order to make it simple to read, understand and future improvements.
Access Raspberry by local (HDMI monitor, keyboard and mouse) or remote (VNC or SSH) access and create a Python folder inside /home/pi folder and enter in it. To do this, use the commands below:
cd /home/pimkdir Pythoncd Python
Once in /home/pi/Python folder, using nano text editor create a file called emergency_button_notify.py. To do this, use the command below:
In nano text editor, paste the source-code, replace access_token variable content with you Pushbullet Access Token and exit and save.
Software setup - making project automatically starts after Raspberry Pi boots
The project is almost done! The only remaining thing is to ensure the project code / program starts after Raspberry Pi Zero W boot. There are some ways to do that, which I find these two the easiest ones:
A- Use cron to start project right after boot. This can be done by opening cron tab file in editing mode using the command below:
sudo crontab -eAnd adding a the following line to it. @reboot sudo python /home/pi/Python/emergency_button_notify.py &After add the line, exit and save and reboot Raspberry Pi using command below. sudo rebootAfter reboot, just press the button and see the notification popping-up in the devices logged with your account in Pushbullet.
sudo nano /etc/rc.local
And add the following line (in the line before "exit 0"):
sudo python /home/pi/Python/emergency_button_notify.py &
After this, exit and save and reboot Raspberry Pi Zero W:
After reboot, just press the button and see the notification popping-up in the devices logged with your account in Pushbullet.