The Walabot is a cool device that uses radio waves to see through walls. In this lesson, we'll do what previously couldn't be done. We will use the Walabot to detect whether or not Shrodinger's cat is dead!
In the process, we'll also take you through getting your Walabot set up. The Walabot SDK doesn't run on Mac, and I am not normally a Windows user. I'll probably over explain things since a lot of this is new for me as well, so bear with me if it's a bit slow.
About WalabotThere are two types of Walabot:
The Maker Walabots
These three Walabots have slightly different prices depending on how many antennas they have. They are available with 18 antennas (the Developer/Pro), 15 antennas (the Creator/Maker), or 3 antennas (the Starter), depending on what application you mean to use it for. The Walabots with more antennas can be used to see through walls and objects, as well as track people and detect falls. The one with only three antennas can be used for breathing monitoring, range measurement, and basic directional info.
The Walabot API makes it simple for you to create your own apps for Walabot. The API exists in both Python, C++, C#, Javascript and C.
The DIY Walabot
The cheapest version of the Walabot, this Walabot is capable of seeing up to four inches through cement, drywall and wood. It's meant for construction workers and people who need an easy way to see through walls. It's basically a high tech stud finder. There's even an android app - you can connect your phone to your Walabot with a provided USB OTG cable and easily check scan your walls with this handheld device!
For this tutorial we'll be using the new Walabot Creator, with 15 antennas. It doesn't support short range imaging, but it can do everything else.
Get set upInstall the SDK.You can grab it from here.
Plug inYou don't need to plug the Walabot into a 2.0 USB hub. 3.0 will work fine. The new Walabot Creator has a single microUSB port. Plug your cable in there. Place the side of your Walabot If your Walabot has a case, place the flat side (the one without the logo) face up.
I had to restart the SDK once before it recognized my Walabot.
CalibrateSensor target detectionMove your hand over the front of the Walabot. As you move your hand, on the left side of the screen you'll see a large blob that looks like a heatmap. It will change position vertically on the screen as you move your hand in and out. The vertical axis is the "R value," or distance. The horizontal axis is the phi.
On the right side of the screen, you'll see a red dot. This means that the Walabot has detected an object and is now tracking it. If you hold your hand steady, you should see the red dot settle at the approximate distance that your hand is from the Walabot, in my case, 0.33m.
Change "# Targets" to 2. Try placing two hands in front of your Walabot and holding them steady. You should now see two red dots, indicating that your walabot is tracking two objects. (the Walabot Creator takes a while to pick up the locations of both dots.)
We can set the arena parameters to control what the Walabot sees.
Change the "R value" to change how far you want your Walabot to look. It's default value is from 10 centimeters to 100 centimeters, but it can go as far as 1000 cm. Change the max R value to 1100cm. Make sure nothing is in front of the Walabot and click "Apply & Calibrate." When you extend the range, you'll see the scale in the X/Y window on the right adjust.
Change the "Theta," which is the width. Click "Apply & Calibrate." Try changing this to 5. You'll see the lines on the X/Y window become more flat as the arena narrows.
Change the "Phi." which is the lengthwise width. Click "Apply & Calibrate."
Change the "threshold." This sets the resolution of the target. The lower the threshold, the better the Walabot's ability to detect weak targets. If you set it to 100, the walabot will only see very large targets.
Click the "Moving Target Indicator." This will only pick up moving targets, and won't pick up static objects in the room. This is one of the dynamic image filtering algorithms, or "filters", currently available in the Walabot API. The other is the dynamic filter that can detect breath.
Put the code togetherInstall PythonOn Windows, if you don't have Python installed, download the latest version of either Python 2 or 3. Run the installer and select "custom install."
Leave everything checked. This will install pip along with Python. Check "install for all users" so that it will be installed in Program Files, rather than AppData (installing it here will cause problems later on.) Check "Add to environmental variables." This will allow you to access python and pip from the command line.
Install the Walabot API for PythonThis is downloaded with the SDK. It needs to be installed before it can be used. Run cmd as administrator. Enter this command:
python -m pip install “C:/Program Files/Walabot/WalabotSDK/python/WalabotAPI-X.X.X.zip”
Change to the version number of the Walabot API you've installed, in this case WalabotAPI-1.1.6
. The Walabot API should now be available on your computer here:
C:/Program Files/Walabot/WalabotSDK/python/WalabotAPI
Include the API headers in your project
Here are instructions for how to include the API in your project. Make sure the headers are included in your code as well.
#include "WalabotApi.h"
#include <iostream>
Install Plugins/PackagesOur Alexa app will be using Flask-ask. Flask-ask is a Python module that makes it easy to develop Alexa Skills. There's a great tutorial for it here that I followed when making this app.
Flask-ask requires Flask. Install Flask.
pip install flask
Install Flask-ask.
pip install flask-ask
I had a lot of trouble installing flask-ask. I kept getting the error "Cannot open include file: 'openssl/opensslv.h': No such file or directory." Flask-ask requires a cryptography module in order to do https, and for some reason it wasn't installing on its own. Here's how I fixed it:
- Install Perl.
- Install openSSL 1.1.0 or greater from a binary (this video helped) and then set the LIB and INCLUDE paths like this:
C:\> set LIB=C:\OpenSSL-win64\lib;%LIB%
C:\> set INCLUDE=C:\OpenSSL-win64\include;%INCLUDE%
C:\> pip install cryptography
I ended up having to uninstall flask-ask (run CMD as administrator):
pip uninstall flask-ask
and reinstall version 0.9.1, since it was giving me an error "TypeError: Can't compile non template nodes jinja."
(run CMD as administrator):
sudo pip install -Iv flask-ask==0.9.2
Install tinydb
Tinydb lets us make a json database for our app. We'll use the database to store different values (0, 1, and 2) according to whether the cat is present and moving. We'll then query tinydb each time we ask Alexa how Schrodinger's cat is doing.
pip install tinydb
Install ngrok
You can just install this from the binary.
ngrok exposes a local server behind a NAT or firewall to the internet. This lets us test our skill without deploying it.
Set up your Alexa AppI started by planning what I would want to ask Alexa, and what I wanted her to respond.
Questions you can ask Alexa:
- Alexa, is Schrodinger's cat alive or dead?
- Alexa, Schrodinger's cat?
- Alexa, is Schrodinger's cat dead?
- Alexa, is Schrodinger's cat alive?
- Alexa, how is Schrodinger's cat?
Go to https://developer.amazon.com/edw/home.html#/skill/create/ to start creating your skill.
Below are screenshots of the setup process:
Skill Information
My skills name is Schrodinger's Cat, with an invocation name of "schrodinger's cat."
Interaction Model
Intent Schema :
{
"languageModel": {
"intents": [
{
"name": "AMAZON.CancelIntent",
"samples": []
},
{
"name": "AMAZON.HelpIntent",
"samples": []
},
{
"name": "AMAZON.StopIntent",
"samples": []
},
{
"name": "SchrodingersCatIntent",
"samples": [
"alive or dead",
"are you alive or dead",
"Is Schrodinger's cat alive or dead",
"Is Schodingers cat dead",
"Is Schrodinger's cat alive",
"How is Schrodinger's cat",
"How is your cat"
],
"slots": []
}
],
"invocationName": "schrodinger's cat"
}
}
Configuration
- Choose HTTPS as the endpoint. Find where you downloaded and saved ngrok.exe and double click to run. Enter the following in cmd:
ngrok http 5000
- Copy the output here for forwarding https (in this case https://56514fdf1.ngrok.io) and paste it into the default endpoint.
- Choose "No" for account linking in the Amazon console.
Note that if you move to a different WIFI or change ports, you'll have to re-run ngrok and paste the values into your default endpoint again.
SSL Certificate
Ngrok uses a wildcard certificate, so select the second option, "My development endpoint is a sub-domain of a domain that has a wildcard certificate from a certificate authority."
Run the appTest just the Walabot code- Navigate to the "SchrodingersCat/client" folder and run:
python SchrodingersCat.py
If your Walabot is on and sensing, you should get a result that says that the Walabot was configured and calibrated and is ready. It should then start telling you whether or not there is a cat in the box and if it's alive or dead.
- To make sure the data is being imported to your database, navigate to the folder where cat_db.json lives.
If your Walabot isn't working correctly, you may get the following errors:
- WALABOT_OUT_OF_RANGE: A provided parameter value was out of its allowed range. Check your parameters on lines 11-18 in SchrodingersCat.py.
- WALABOT_ERR_IN_INITIALIZATION: Error during initilization process. I got this error frequently when I was using an older, buggier version of the Walabot.
- WALABOT_ERR_PROTOCOL: Internal Error. This typically means there is something wrong with your code.
If your Walabot starts up and calibrates, you're ready to run the server.
- Run cmd as administrator. Navigate to the "SchrodingersCat/server" folder and run:
python main.py
You should see the server start up.
Run schrodingerscat.py to get data. If your walabot is working correctly, you should see it updating with new data.
If you shut it down in the previous step, you'll have to run "ngrok http 5000" again and re-paste the new https value into Amazon.
Test Alexa
Now that your server is running, you can test your utterances by typing them on the "Test" page, or by saying them to https://echosim.io/. You'll get a JSON response that tells you whether or not your app worked.
Note that if your edit your app, you'll have to shut down the server process and re-run "python main.py" in order for the changes to go into effect.
Add test data
If your Walabot isn't working or you don't have one on hand, you can test your Alexa app by adding fake data to the database:
In the Schrodinger's Cat folder:
- Run python
- Run
import json, socket
- Run
s = socket.socket()
- Run
s.connect(("127.0.0.1", 9999))
- Run
s.send(json.dumps({"cat_status_field": 1}).encode('UTF-8'))
If successful, it will give the response "23"
- If you get this error:
Only one usage of each socket address (protocol/network address/port) is normally permitted
- Or this error:
An attempt was made to access a socket in a way forbidden by its access permissions
Try again and make sure you're running cmd as administrator.
- If you get a thread error, you're probably already running main.py in a different cmd prompt.
Comments