Hackaday Connected World Follow Up

Recently Hackaday announced the results of the Connected World contest. It made my day when I read Sophi’s email telling me that ConnectedRoomba was one of the OSHPark certificate recipients. What may have seemed like a small announcement meant a lot to me. I’m still fairly new to this area of computing, and without formal training. Instead I spend a lot of time reading, listening and building to learn everything I can. Validation and success no matter how big or small help us all stay motivated to continue in our pursuits. Thank you to everybody at Hackaday for setting up a community and contest for us all to continue learning, sharing and hacking together.

Postgres Advisory Locks with Asyncio

Recently, here on the Cloud team at Elastic we started working on building a new service in Python 3.7. This service fetches data from a Postgres database, transforms it, and then submits that data to another service. Like many cloud-based services, ours runs in an orchestrated container environment where N instances can be running at any time. Often that’s a good thing, but our service has a few critical sections where only one instance should be able to process data. Since we are retrieving data from Postgres, we decided to go ahead and make use of advisory locks to control these critical sections. In this article I want to explain what advisory locks are, provide an implementation, and test to verify functionality.

Connected Roomba - Wrapping Up

With everything working I wanted to make sure I didn’t have to reset everything anytime an odd decode error occurs, something loses and regains power, etc. For the Feather attached to the Roomba handling this is pretty straight forward. Everything is already running in a super loop, so all I need to add is a try/exceptblock to the while loop and discard errors. Doing the same thing for the Pi was again straight forward, but since it is running Linux I needed to make sure the applications handled failures, and that the scripts restart if the board restarts, the OS bounces, etc.

Connected Roomba - SMS

As I mentioned before one of the primary reasons for starting this project was to let my wife and I start the Roomba when we are not at home. One device that most of us take everywhere is our phone. An easy way to to send information from your phone without a custom app, stack and hassle is SMS. While it’s easy to broadcast receiving that message can take a little work.

Connected Roomba Remote - LoRa

With a basic setup working the next thing I wanted to do was make communication wireless. Thinking about my options I ruled out using WiFi pretty quick since I didn’t want to worry about discovery and router issues. I thought about Bluetooth since I could send commands from my phone to the board on the Roomba, but decided against it due to my lack of mobile programming experience and not wanting to add yet another new thing to learn. (Side note I’ve since learned about the Bluefruit app) Looking at the other Feather options I decided to make use of LoRa for my communication layer since it would be easy to use, my packets are tiny and I didn’t have to worry about software beyond CircuitPython.