Every summer, I read tragic stories of children that die because they were left in a hot car. And every summer, my heart breaks because of the senselessness of the deaths.

So I decided to build a solution.

Today, I want to show you how easy it is to build a Help! Button that a child in a hot car could press in order to alert someone that they are in danger and need assistance.

As an aside, while I was building this project, it occurred to me that children dying in hot cars is actually two problems, not one. It is two problems because:

Toddlers have the cognitive ability to recognize they are in danger and take some action to get out of the situation. Babies are not capable of recognizing danger, nor capable of taking any action. So a different solution is necessary for each scenario.(I’ll tackle how to save babies in another post.)

The solution I’ve built here is an answer to the first problem: A button for a toddler to press, when they are in danger.

The tech stack: prerequisites for the IoT Help Button

The app we are going to create will use an unlocked cell phone, the Python programming language, AWS Lambda function, an AWS IoT button, a physical Twilio product, and Twilio SMS API:

Python version 3.6: The language for our code

AWS IoT button: The trigger that calls the Lambda function

AWS Lambda: The serverless environment to hold our function

Twilio SIM: To be a radio relay, and carry the signal from the AWS IoT button to the cloud

Twilio SMS: Send a text message

IoT help button flow

Let’s walk through how the safety notification system will work when finished:

You will attach the completed button to a child’s car seat. Should the situation ever arise, they will be able to push the button and alert someone that they need help. The unlocked phone will be placed in the car, equipped with a Twilio SIM card, with the phone’s WiFi Hotspot active. The button will be connected via the phone’s WiFi Hotspot, so when the the button is pushed, it will trigger a Lambda function. The Lambda function will make a request to Twilio’s SMS API to send a text. Grandma/Mom/Dad/Neighbors/Police/Firefighters/whomever you designate will be alerted and come to the child’s rescue.

Create a Twilio account and select your phone number

The first thing to do is sign up for a Twilio account. Next, buy a phone number. Make a note of the phone number you’ve bought, your Account SID , and your Auth Token . You’ll need them all later.

Set up a Twilio SIM

After you’ve created your Twilio account and selected a phone number, you will need a Twilio SIM card to use in your unlocked cell phone.

Navigate to the Programmable Wireless area of the Console. Click on Orders, and then the big red plus to order new SIM cards. I ordered the “SIM Starter Pack,” which comes with three SIMS.

Once you have your new SIM cards, you will need to register at least one of them, since Starter SIMs are not pre-registered to a Twilio account.

On the SIMs portion of the Console, click on the big red plus, and select Register a SIM.

First, enter the Registration Code on the back of the SIM card, and click the “Register SIM Card” button.

Second, give your SIM card a unique name.

Third, set up a Rate Plan. Click on the big red plus (as seen in the below screenshot) to add a new rate plan.

Fourth, Activate your SIM card.

Make sure that when you create your rate plan, you enable Data, or your phone won’t be able to act as a WiFi Hotspot for your IoT Button.

An important note here: The Twilio SIM card pops out in three different sizes. For the BLU C4 phone, (details below) the medium sized SIM is used.

Acquire an Unlocked Cell Phone

Now that your SIM card is activated, and you set up a Rate Plan, you are ready to use your new Twilio SIM card, but you need a phone to put it in.

For this, you will need an unlocked cell phone. It’s important that the phone is unlocked, because you can’t put the Twilio SIM card into just any phone.

If you have a spare and unlocked cell phone laying around, feel free to use it for this app. If you don’t have an extra, you can do what I did and buy one from Best Buy. I bought the least expensive one I could find.

Put your SIM card into the phone.

You need to enable your phone to access the Twilio network, which means you need to configure your APN (Access Point Name).

To do this (instructions will vary based upon the phone you buy), go to Settings ---> Network & Internet ---> Mobile Network ---> Advanced ---> Access Point Names ---> add an APN (which is the blue plus sign in the top right corner) ---> Name: Twilio ---> APN: wireless.twilio.com

Once you’ve done this, you should be able to access the internet. Note there was a little bit of a lag time between the time I configured mine and the time I was able to get on the internet. (Don’t be discouraged if it doesn’t work for an hour or two.)

Navigate to a site like YouTube, or Google to ensure you have an internet connection.

Create an AWS Account

Even if you already have an Amazon account or Prime membership, you will need to create a new AWS login, because it is separate from the rest of Amazon.

Go ahead and create your account now; we will come back to the configuration shortly.

Set Up an AWS IoT Button

Once you have your Amazon IoT Button, you need to configure it as the Help Button trigger. First, download the AWS BTN Dev app from the app store onto your Twilio phone.

Configuring the button couldn’t be easier, and the app will walk you through the steps. You can also check here for more info.

One important item to note is that you want to ensure your button is connected to the phone’s WiFi hotspot, so that the button can be used anywhere. To ensure your hotspot is on, go to Settings ---> Network & Internet ---> Hotspot & Tethering ---> Wi-Fi hotspot (click on it to turn it on).

Create a Lambda Function

Now it’s time to come back to configuring your AWS Lambda function.

When you configured your IoT button in the previous step, it automatically set up an empty Lambda Function for you, which is a really neat feature that we will piggyback off of:

Click on the IoT button function. That will bring you to the designer screen:

Click on the Lambda function (right above where it says “Layers” in the picture above).

Now we are going to need some code inside our Lambda. Either copy the below into your Python editor, or clone the repository via GitHub.