Hi everyone, this is Mark. I guess this is a guest blog post of sorts. A ton of stuff has been going on lately, and so I thought I might take a moment to share it. Really though I’ve been planning on writing this thing for weeks, but I never got around to it – now Joe’s making me :)
(skip down if you’re just here for the margaritas)
First release from the new build system! 1.1.16 beta
Let’s start with the new beta release. I released the 1.1.16 beta (round 2) on August 30th. The new beta is much like the old one, but with about a dozen bug fixes, 4 new analyzers, and – most importantly – it was built with our entirely new build system! Steve is the hero of that story. Head over to our downloads page, hit the link for the beta, and sign in or create an account if you haven’t already. All the info, release notes and side notes are there. I would love to write up a whole blog on the new build system, but so many blog-worthy things have happened since then I’ll paraphrase. The new build system is based on c-make. The old one was all custom (Joe’s work) and would parse the visual studio project to get the files list and then generate command line statements to build the software in release mode with gcc. Debugging on anything other than Windows was so hard that I only tried it once. The new system no longer uses the visual studio project as the master project configuration. Instead, everything for the project is in cmake, which can be used to either build the software on any platform or generate the project files for any IDE. Now we can (and I have) debug(ed) on any platform with ease! The system also includes scripts to build our dependent libraries, both SDKs, and unit tests. The icing on the cake is a SSH based network build controller which lets me build the entire thing, and even package it, from one command. In short, it takes all the pain out of building. Also, now that we’ve moved to git and have started using branches properly, we can easily build versions of our software one-off with minor tweaks. I’ve already posted a version that counts the transitions between the timing markers. We can also build third party analyzers for all the platforms pretty easily too, so I’ve extended this offer on our forum.
Of Hack-a-thons and Margaritas!
Ok, so that wasn’t as short as I intended. Next though, I would love to share with you something I built at a hackathon two weeks ago with some of my friends. If you don’t know what a hackathon is, stop here and hit up Wikipedia if you’re interested. The short version is that it’s something between a party and a completion where everyone makes something they think is cool (usually with code) and sometimes there’s prizes. They tend to go on all day and all night. Techcrunch.com hosts a big one here in SF every year, and at the last second I decided to go.
Specifically, we decided to make an iPhone controlled Margarita maker. Why? Just google search for “siri margarita” without quotes, and you will find out why.
Basically, the plan was to buy a margarita maker, attach a motor to the spout handle, connect relays to the blender controls, and then interface those devices to a microcontroller connected to the internet.
Now, we could have just made it controlled from a mobile webpage or an iPhone app, but we wanted to take it one step further. The iPhone 4s (and now the iPhone 5) has a virtual assistant named SIRI. Siri is really cool; she can find restaurants, look up stuff on the internet, update your calendar and more all from voice control. We decided we wanted to use SIRI to control our contraption, so that we could just say “SIRI, tell margarita to pour me a margarita.” Now, the specific syntax/wording of that command is derived from our need to use SIRI’s text messaging capabilities. There is no SIRI api, so we needed to find a way to use what features she already had to help us get drunk. In this case, you can tell Siri to send a message to one of the contacts in your phonebook. We created a contact called margarita, and added a phone number.
The next step was to go from text message to sweet sweet tequila bliss, so we signed up for a Twilio developer account and added a phone number for receiving text messages. When this number gets a text, a message is sent to a web server of our choice. Next, we built a quick python app and loaded it on Google App Engine to receive our text. We still need to get that message to the margarita maker though, which was going to require some sort of internet connected gadget. We started with an Arduino and a wireless module, when we had the good fate of a visit from Eric from Electric Imp. Electric Imp is a wireless module and processor in a tiny package shaped exactly like an SD card. However, it is not an SD card, nor is it anything like the Eye-Fi wireless SD cards for cameras. This little guy can be programmed with a wireless network name and password – optically. That’s right, there is a mobile app where you type in the ssid and password of your wireless network and it blinks out the info into the electric imp. We were all impressed, but that’s just the beginning of what makes it awesome. Like the Arduino, the Eclectic Imp isn’t programmed in some hard to use language like C or assembly – which is critical when you’re at a time limited hackathon. Instead, you can program for it in squirrel, a simple scripting language that looks like C++, and acts like C#. That being said, I never heard of it before this moment. Turns out it’s super easy to learn.
There was one last missing piece – the connection from the python script on App Engine and the Electric Imp module. Turns out the Electric Imp service includes some nice HTTP post and get features which let you call a function in your code from a http request! That solved it. The complete loop is:
SIRI assistant on iPhone -> SMS to Twilio -> Google App Engine Python -> Electric Imp’s cloud service -> Electric Imp -> Motors and relays.
We wanted to add a few more intermediate steps just to pad the presentation, but this was long enough. On a side note, I should mention that every single one of these steps was a push operation. Nothing was polling for new requests.
Video of it in operation:
http://www.youtube.com/watch?v=bVyffzc_D1I
TechCrunch decided to interview us right after our 60 second demo!
Also, here is our 60 second demo. The first time we tried to make the margarita, SIRI didn’t interpret the command properly. I used the single use manual override to pour the first drink. I poured the second drink my manually sending the activation text message instead of using SIRI. (SIRI was too slow given the time frame for a second try)
http://techcrunch.com/events/disrupt-sf-hackathon-2012/sound-bites/?snapid=35436
Obviously a Logic16 was used during the development of this product, making it officially supported by Saleae. Woot!
Boats, Batteries, and DustBusters
This would be the end of the blog post if I managed to write it last week, but one more thing happened in the meantime. Let me start by saying that Joe bought a boat a few weeks ago – an older Catalina 30, in amazing shape. It’s a super fun boat which I will let him talk about in his next blog post. I just want to mention what happened Saturday night.
So skipping ahead, we decide it’s time to head in, but the motor won’t start – both batteries are dead. Not good. Although we are on a sailboat and should be able to get around on wind power, we have two problems. First, the channel into the marina is dead up wind and very narrow, and at this point there is barely a whisper of wind left at all. After a half dozen failed attempts at tacking our way into the marina, we backed off and dropped the anchor to brainstorm some ideas. After contemplating making James swim to shore, trying to dock at a peer that was 20 feet out of the water, and making oars out of materials around the boat, I stumbled upon the cordless dustbuster we had on board, which read 15.4 Volts on the back. At first I dismissed the idea because A) the battery pack was not removable and B) it was stupid, but later Joe asked, what about the dustbuster battery? At this point I was bored and willing to try anything, so I set to work disassembling the dustbuster with the tools on board while Joe accessed some wires connected to battery #2.
Note: We could have also called vessel assist and gotten a tow for a few hundred bucks. We could have also tried harder to hail a boat for a lift. Our plan was to spend the night on the boat and sail in the next day when we had enough wind to make it easily. We had working phones and a VHF marine radio the whole time.