Introduction: Talos, Keeping You Safe During Your Commute

About: Maker in the making :-)

Being victim of harassment while commuting is a fairly common thing for many people, especially women. Whatever the country, taking public transports often equals to knowing you can be sexually harassed, or even followed while walking home. In those situations, it's not always easy to react and assess the threat, from a simple scare from a catcall to a real concern something bad could happen. Fear is always a factor, and not wanting to call the potential harasser's attention can prevent us from alerting someone we trust.

Talos is a little device that connects to your phone and allows you to send a text to the person of your choice. The SMS automatically includes your last known location and the pre-recorded text of your choice. With the appearance of a simple keychain, Talos stays clipped to your bag and lets you discretely activate it by pressing it, which triggers the sending of the text message. Its low power consumption means you don't have to charge it everyday and risk forgetting it - or just being reminded everyday of the threat that you face.

There are three parts to this project :

- Physical module : I used a Puck-js module, which is based on the nRF52832 module and can be programmed using Javascript thanks to Espruino
- Android app : I created a simple app that connects to the module
- Keychain cover : I made a simple cover for the Puck JS to look like a simple keychain


- Puck.js module (

- Android Phone with at least version 8.0
- A computer with Android Studio installed

- 3D printer (optional)

Step 1: Overview

This diagram should give you an idea of the different components : the code on the Puck module itself is really simple, and we're letting the Android app take care of the connection rather than have the Puck scan for the phone. We'll be using Bluetooth Low Energy and its characteristics to communicate between the app and the device, in order to preserve battery life

Step 2: Programming the Puck

After having checked on that your browser and computer support Web Bluetooth, go to and connect to your Puck by clicking the plug icon in the top left corner of the page.

You can then copy and paste the code from the attached file into the editor and send it to the Puck.

In the first part of the code, we are defining the Blink and updateCharacteristic function, which we will use later in the code. In the updateCharacteristic function, we are assigning the current date to the characteristic to make sure that it will indeed be seen as a new value. We then notifiy any subscriber of this update.

After those declarations, onto the code that will be executed :

The code on line 56 allows you to retrieve the physical address of your Puck, that you will need to harcdode in the Android app : uncomment this line and you will see the address on the logs on the left hand side of the IDE (see attached screenshot). Once you have this value, you can comment the line or leave it that way.

After that, we are defining one custom BLE service (the UUIDs are random values) with three different characteristics, all of which are notifiable. We will not use the values themselves to convey our message but just the fact that they have changed.

On lines 78 and 79, we set some listeners that will cause the integrated LED to blink whenever the device is connected or disconnected from another Bluetooth device. Finally, on line 81, we are attaching an interrupt to the integrated button so that pressing it will call the updateCharacteristic function


Step 3: Creating the Android App

Since the whole app includes some rather heavy libraries, I've included only the source files and the gradle file for the app inside the attached zip. In order to make it work, you need to launch Android studio and create a new project (choose Empty Activity, see screenshot) . Select 26 (Android 8.0, Oreo) as the minimum version for the app as some of the code I wrote uses APIs that didn't exist before that. Once your project is setup, you will have a build.gradle file for the App (marked build.gradle - Module : App). Open it and copy the content from the zip file : the IDE will prompt you to do a Gradle sync during which it will download the Nordic library that the app relies on. You can then launch the app once and check that it works.

Once the app is installed on your device, go to your settings menu, choose Apps, and find the app in the list. Select it and click on "Autorisations". There, you will have a few radio buttons that will be off by default : check them all to make sure that the app has access to everything it needs.

You can now import the source files from the zip archive : the easiest way to do that is to create new classes (right click, new Kotlin file/class) and give them the same name as the ones from the archive. Once the class file is open, you're free to copy and paste the code in them.

If you only want to use the app, just modify the address on line 31 on the BTService class and input the address you obtained in the previous step instead. You should now be able to compile the app and run it on your device !

If you want to know more about how the app works, read on :-)

The following diagram will give you a better understanding on what happens inside the app :
- The MainActivity is the one that the user will only use once in a while : its main purpose is for them to be able to enter the phone number of the person they would like to contact when using Talos, as well as the text to send them.

- The BTService is a foreground service, which means that whenever it is launched, it creates a persistent notifications that limits the likehood of the service getting killed by Android. This service tries to connect to the Talos using the classic Bluetooth Low Energy process - I have used Nordic's sample code and the other resources I could find. Right now, it looks specifially for the UUID of the Puck : you should change this value (private val remoteMacAddress = "CF:EB:2F:6E:33:30") to match your device's own address obtained in the previous step. After finding the device and checking that it does have the service we are looking for, it subscribes to the notifications for the characteristic that will be updated whenever the user presses the button.

When the BTService does receive an update for this characteristic, it will fire a LocalBroadcast object for the other components of the app to react. It will also call the SMSIntentService for it to send the SMS

- The SMSIntentService will retrieve the phone number and text from the SharePreferences in order to have the last values entered by the user. It will then automatically send the SMS without having the user interact with the app, and add the user's last known location to the SMS.

Step 4: Designing a Case

The current case that the Puck comes with already includes a little loop for it to be attached to a keychain, so we could almost leave it that way. The all white silicon cover that I happened to have still felt pretty weird so in order for it not to attract any suspicion, I designed a simple object to put on top of the Puck. They say that a picture is worth a thousand words, I thought I'd give you 25 images per second : in the following video, you will see how I used Fusion 360 to create the design, including the commands and shortcuts that I used :

Step 5: Putting It All Together

Now that you have the different components, it's time to put them together ! The current case of the Puck module already has a hole that you can use to insert a chain - I happened to have an old keychain that I took apart, but you can buy those easily as well. Take apart the ring using pliers - once you've located the opening of the ring, move each half in opposite directions, one towards you and the other one away from you. You can then insert the ring into the Puck and close it back.

3D print the design you just created - I used some purple PLA and snap in on top on the Puck

IoT Challenge

Participated in the
IoT Challenge