The Knocki is a device that released on Kickstarter a while back and has (as of writing this article) received over half a million dollars in funding. The premise behind the Knocki is that it allows us to access different functions around the house using knocks on different surfaces. The Knocki is meant to be something that uses the context of the location to enable intuitive functions, for example knocking on your bedside table in the morning should turn off your alarm, or knocking on your kitchen counter should turn the microwave on. The idea is to reengage ourselves with technology in a more tactile way. Everything sounds good, right?
Not so much. While the idea is terrific, each Knocki costs $69 (at the Kickstarted super-early bird price) and will probably cost almost $100 at retail. The biggest issue with this is it limits someone who doesn’t have $300-$400 of spare cash to a single Knocki (atmost). But a single Knocki cannot deliver the full experience of connecting with technology around the house in a tactile manner. So my friend and I decided to create a DIY version of the Knocki that works just as well, but costs much less. The end product of our design (with miniaturization taken into account) cost approximately $70 for 3 “unKnocki’s” all costs taken into account. Adding each unKnocki only requires $8-$10 because we only add a transmitter module and use a common command center. For those of you interested in building your own, view the full instructable here.
We faced a number of challenges in the week or so that it took us to build the unKnocki. The first aspect we had to design was the detection of the knock. It seemed simple enough to detect one knock using a Piezo Buzzer and the Arduino, using the tutorial on the Arduino website itself! However detecting multiple knocks was slightly harder. Our first approach was to send all the serial data to python and then log the time difference between consecutive peaks. However due to serial connection issues (and other problems we simply didn’t understand) we ditched that idea. In the end, it was a simple “while loop” that ended up working, although it took us nearly 4 hours of work before this (obvious) fact dawned on us.
The second problem we ran into was the transmission of data. Our first idea was to use the 433 MHz radio to send the number of knocks from each transmitter directly to the Raspberry Pi. We tried this at first and were able to get the RFSniffer code from the 433Utils detecting the radio signals, albeit on the Linux terminal. No matter what we tried (which included VirtualWire, pi-switch-python, wrappers for RFSniffer, external libraries), we weren’t able to output this data to a python file for further processing. While this is something I would still love to do, we decided to move on to a simpler solution of having an Arduino connected to the Pi deliver data through the Serial port. This worked like a charm, and ticked another box off our list.
We also made a slight coding mishap in our initial code. We were using the Arduino millis() function to get the current time and store it as an integer to determine the time between knocks. However the program often stopped working after 2 to 3 minutes, because of an integer overflow issue i.e. the integer was no longer able to hold the value of the millis() function. We switched the variable over to an unsigned long which gives us approximately 50 days of runtime before any errors pop up.
The next issue was relatively minor – finding the right IFTTT channel to use for triggering events. We started off with Twitter, which had a 30 second delay between the knock and the event on the phone. We then used the Pi to send a Telegram message which was delivered almost as soon as the table was knocked. However Telegram was not compatible with IFTTT. We finally saw the solution in the form of the Maker Channel for IFTTT, which lets you make PHP requests to trigger actions. This was exactly what we needed!
And that’s it. A weeks work, summarized in four paragraphs and one instructable.
We are not saying a DIY solution is necessarily better than the Knocki. For the average person who may not be interested in electronics, the Knocki is a convenient easy way to get started. We simply offer a much cheaper solution with immense applicability due to our integration with IFTTT. All hail the unKnocki!