The "Doggie Talkie"


Scenario: you're at the office, working your tail off to put chow on the table for your new labrador Skip... But sweet little Skip is home alone and has to go to the bathroom.What does Skip do? He relieves himself right on the living room rug!

Wait a second, now there is a way to avoid this problem: the Doggie Talkie. Imagine now—when your dog has to go outside, he gets near the smart dog-door you've installed and it senses Skip. You get a notification on your phone ("Skip has to go outside!"), and with the push of a button, you can decide whether to let your dog out or keep him inside.

During my last semester at UConn, I developed a prototype for this system with my roommate and fellow engineer Kristian Schif (website here).

The prototype took the form of a Raspberry Pi embedded in a 3D-printed casing and an iOS app to go with it. Below, you can see what the initial prototype looked like.



There are two sheets of metal. One of the Pi's GPIO pins is connected to the bottom layer, which is supplied a constant voltage of 5V. A different GPIO pin is connected to the top layer, and the voltage at this pin is sampled every 100ms to detect a button press. If the voltage jumps to 5V, the Raspberry Pi knows that the two sheets of metal are in contact and someone pressed the button.



One of the most difficult challenges of the project involved getting the product to work "out of the box," i.e. anyone can quickly and easily plug it in and set it up. For this, I developed a custom solution using Bluetooth Low Energy (BLE) communication between the Raspberry Pi and the iOS app to connect the Doggie Talkie to a nearby WiFi network.

The Raspberry Pi is configured to run a Node.JS app every time it boots. This program will perform a multitude of functions: it will configure the GPIO pins and sample every 100ms to detect a button press, it will use Amazon SNS + Apple Push Notifications to send a notification to registered devices if a button press does occur, and it will act as a BLE peripheral device.

As a peripheral device, the Raspberry Pi scans for nearby WiFi networks every minute and for each network discovered, creates a "Characteristic" (using the Node.JS library Bleno) which contains information such as the network's SSID and encryption type. These characteristics are bundled into a primary service which the Pi can advertise (think UDP broadcast) to the iOS app. When you open the iOS app, you have the option to configure your Doggie Talkie device. The app will scan for advertising BLE services and attempt a connection to the Doggie Talkie. It will then read the network characteristics and display them to the user:





If the network is encrypted, the user will be prompted to enter a password for the network. Then the iOS app will act as a BLE central and will write to the network characteristic which was selected, sending the user-provided password if necessary. The network characteristics in this application are read/write. The Raspberry Pi will attempt to connect to the network and will send a SUCCESS code if it was able to connect, or an ERROR code if it was unsuccessful.

In my opinion, the push notifications and GPIO circuitry in this project are cool, but the headless WiFi setup is cooler. The reason being that this this type of WiFi configuration solves a common issue with small "Internet of Things" (IoT) devices: how can the customer easily connect his or her device to the Internet? The Bluetooth Low Energy protocol described here offers a solution.