Communication is more important than ever during difficult times, and when your mouth is covered, and your hands and devices must be kept clean to reduce the risk of infection, communication can become incredibly difficult. The LILYGO TTGO T-Watch-2020 is an extremely inexpensive, ESP32-based wearable, which thanks to built-in Wi-Fi and Bluetooth, has the potential to enable wearable communication at a tiny fraction of the cost of an Apple Watch and iPhone. Out of the box, however, none of this potential is leveraged, but by connecting the watch - as well as other devices - to AWS IoT Core using MQTT, a communication network can be established, empowering workers who can't easily reach for their phones, and without having to spend hundreds of dollars to equip each team member! โ๐ฌ
AWS IoT Core provides a ton of great functionality, but as is often the case with AWS, the number of services and jargon-laden interface can be overwhelming. Thankfully, however, AWS devrel superstar Moheeb Zara has put together a really excellent blog post on how to get an ESP32 working with AWS IoT Core and MQTT. Instead of reproducing that content here, just follow the steps in Moheeb's blog post, up to but not including "Creating an IoT thermal printer".
So that's the watch set up - but a network with only one device isn't very interesting, so let's add more! The Arduino NANO 33 IoT is a great candidate for this, thanks to its built-in Wi-Fi capabilities (they don't go out of their way to reveal this, but the NINA-W10 inside is actually ESP32-based too!). And Arduino has a great write-up on how to set up AWS IoT Core and MQTT too - it says it's for MKR WiFi 1010, but since that's NINA-based as well, the steps detailed apply to both! Follow this guide in its entirety to get your NANO 33 IoT set up, although - spoiler - you can use the MQTT esp32/pub
and esp32/sub
topics - or better still, invert them, so that the two devices are pub'ing and sub'ing to each other!
That was a lot of setup due to all of the security and complex services involved - but the good news is that the next bit is easy! Clone this repo:
https://github.com/ishotjr/COVID_Communicator
for the TTGO T-Watch. It comes with an example secrets file, which you should rename as secrets.h
and fill with values from your ESP32 setup above. Once that's done, flash it to the T-Watch as you did during setup. You'll see a button labeled "Security", and for now, nothing else!
For the NANO 33 IoT, clone this repo:
https://github.com/ishotjr/COVID_Sensor
and similarly, rename the example file as arduino_secrets.h
, and populate it with the values from your original setup above.
OK, now this is the cool part! You can push messages to MQTT in a number of ways - the easiest might be using the AWS MQTT client (you may need to adjust the region in this URL if it does not match the region in which you did the above setup), but you can also use curl
on the CLI:
curl -d '{"message":"testing"}' -H "Content-Type: application/json" -X POST https://YOUR_ENDPOINT.execute-api.us-east-1.amazonaws.com/Prod/publish
It's pretty magical the first time you see a message show up on the watch using either of these techniques, but what's really cool is, every minute, the NANO is also publishing a message, to which the watch subscribes! Using the magic of AWS IoT Core and MQTT, the two devices are able to talk to each other!
This is just a simple proof-of-concept to demonstrate the idea - the Arduino could be used to send any number of sensor values to the watch or other nodes, and the button, which sends a "security event" to DynamoDB, could trigger any number of responses, the idea being that a restaurant/grocery/retail worker could succinctly initiate this via their watch when a customer is being difficult and refusing to wear a mask, or any of the other outrageous behavior that seems to be on the rise at present.
Field Testing ๐จโ๐ฌ๐๐งResults and Conclusions โ๏ธ ๐Amazon's AWS IoT Core, while perhaps seeming complex and inaccessible at first, can be used to provide an incredibly powerful MQTT-based network, enabling communication between all kinds of devices. Thanks to great documentation, it was easy to add wearable and sensor nodes, providing a proof-of-concept for a far larger and more powerful implementation.
Next Steps/Future Enhancements ๐ ๐ฎMy original project idea for this contest was very different - I had intended to monitor, aggregate, and respond to environmental conditions in restaurants and other public places, in order to reduce disease transmission rates, but unfortunately, the system was LoRaWAN-based, and my The Things Uno, despite having shipped on June 4th, has yet to arrive almost a month and a half later. When my tracking finally updated 4 days ago - for the first time since shipment - it became clear I would need to pivot in order to participate, so I grabbed what I already had around me and came up with this quick - but powerful - proof-of-concept for enabling communication between people and sensors in an environment where phones are off-limits and buying all employees an expensive smartwatch is cost prohibitive (and would still require a bunch of custom development!).
With the basic functionality in place, I can begin to add all kinds of sensors to the network, provide insight to T-watch-wearers by updating the UI to display/interact with this data, set up various triggers in response to sensor values, and create web-based visualization and management tools. The possibilities to enhance communication and safety for restaurant, grocery, and retail workers - and more - feels limitless!!! ๐ก๐คฏ
Comments