Suppose you acquire a device so powerful it can peer into walls and sensitive enough to watch your chest move while you sleep, what would you make? A theremin of course! It's an instrument that's fun for the whole family, can be programmed to make different sounds and serves as a great introduction to the suite of Walabot functions. With all that said, let's plug Walabot in and get started!
First step is to download and install the Walabot SDK. It currently comes in Windows, Linux, Android and Raspberry Pi flavors. If you're on a Mac, the Linux install is your best bet. Additional instructions and troubleshooting can be found here. I ran the Windows install without issue. Once the SDK is installed you should be able to run the Walabot API Tutorial. This will give you a step by step walk-through on how to connect the Walabot as well as some live sample apps. The short range imaging is closest to what we'll be using.
Because the sound and front-end that we will be using is web based, we'll need a way to convey the data from the Walabot python api to the internet at large. To do this we built a basic RESTful API using flask. You will need python/pip installed.
- Ensure you're Walabot is connected and installed properly
- Clone the API code from GitHub
- Open a terminal and cd to the directory where the code has been cloned
- Run
pip install flask flask-cors flask-autodoc Flask-Testing
- Run
python app.py
- In a browser, open http://localhost:5000/walabot/api/v1.0/documentation
If you see WalabotAPI.WalabotError: WALABOT_INSTRUMENT_NOT_FOUND the Walabot is not connected properly and you may need to go through the Walabot Setup again.
If you see a 500 error or the page does not load, confirm that flask is installed and that app.py is running.
You'll know it's working when you see this...
You should now be able to use each of these endpoints. For example, if you go to http://localhost:5000/walabot/api/v1.0/imageenergy you should see a JSON response similar to { "imageenergy": -0.9186050254651903 }
WSK SetupSo now that we have Walabot connected, running and exposing data through an API we just need to set up the front end. Really, this could be done much simpler with raw javascript and HTML, but I'm using Web-Starter-Kit, largely because it provides support as an offline web app. The site also utilizes PizzicatoJS to generate the different sound waves. For this you will need npm and gulp.
- Clone the WSK web code from GitHub
- Open a terminal in cd into the code directory.
- Run
gulp serve
After it is done building you should be able to go to localhost:3000 and see the webpage. The browser may ask for permission to access your mic/speakers, but otherwise you should be hearing sounds. If not, open the developer console and check to see that the api calls to localhost:5000 are successfully returning data.
Now you have your very own portable, configurable theremin! What will you do next? Try moving different objects and making different gestures around Walabot to see what kinds of sounds you can make! Experiment!
There is still much that can be done to improve the Walamin. I plan on linking more of the web interface to the api so that I can recalibrate, adjust the Walabot arena, and provide additional controls for tweaking the sound (tone, effects, etc). With all of that said, I think I'm far more excited about the next project. It could be an invisible thermostat. I thought it would be neat to have Walabot behind a wall looking out, that way you could just place or move stuff on the wall and have Walabot respond. As a chemistry nerd and homebrewer I'd also love to start probing Walabot's analytical potential. Even if it could provide crude ranges I think it would be incredibly useful, especially as it could do it without compromising the beer. The future is Walabot!
Comments