Mark's first update!

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.

[![](http://blog.saleae.com/wp-content/uploads/2012/10/DSC02780-1024x680.jpg)](http://blog.saleae.com/wp-content/uploads/2012/10/DSC02780.jpg)
TechCrunch Disrupt Hackathon 2012
I should take a moment to let you know that most people write software at these events – usually a fun website or iPhone app. Some kind of game, social media thingy or whatever. Almost no one makes hardware. We did.

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.

[![](http://blog.saleae.com/wp-content/uploads/2012/10/DSC02779-1024x680.jpg)](http://blog.saleae.com/wp-content/uploads/2012/10/DSC02779.jpg)
Inside of Electric Imp
The Electric Imp never needs to be connected to your PC to be programmed. Instead, there is an online IDE for it on Electric Imp’s website, which will let you program your device through the internet connection you just set up. This let us scrap the Arduino and the wifi module – and saved us a ton of time.

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.

[![](http://blog.saleae.com/wp-content/uploads/2012/10/DSC02841-680x1024.jpg)](http://blog.saleae.com/wp-content/uploads/2012/10/DSC02841.jpg)
Motor-Spout interface complete! Parts salvaged from Maker-Faire robot
[![](http://blog.saleae.com/wp-content/uploads/2012/10/DSC02847-1024x680.jpg)](http://blog.saleae.com/wp-content/uploads/2012/10/DSC02847.jpg)
Production ready electronics! That’s just 120VAC hanging out the side of a blender, move along!
So, it worked. We were up almost all night, visited [Ace Monster Toys](http://acemonstertoys.org/), a hacker space in the east bay to laser cut one of the parts, we got only 2 hour of sleep, and had more problems with the wifi at the event than I could have imagined (but it did work during the presentation! The second try…).

Video of it in operation:

http://www.youtube.com/watch?v=bVyffzc_D1I

TechCrunch decided to interview us right after our 60 second demo!

http://techcrunch.com/2012/09/09/hackathon-entrant-sirious-margaritas-is-a-margarita-maker-from-the-future/

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!

[![](http://blog.saleae.com/wp-content/uploads/2012/10/DSC02791-700x465.jpg)](http://blog.saleae.com/wp-content/uploads/2012/10/DSC02791.jpg)
Logic16, in the trenches
Last week we took the Margarita Maker to Twilio’s headquarters in downtown SF to show off what we did with their API. Everyone loved it!

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.

[![](http://blog.saleae.com/wp-content/uploads/2012/10/DSC02880-1024x680.jpg)](http://blog.saleae.com/wp-content/uploads/2012/10/DSC02880.jpg)
Teaser photo of Joe’s new boat!
That night we went for a sail with James, my friend and our part time employee. We motored out of the marina, raised the jib (It was dark and I was too lazy to raise the main) and sailed around for about an hour. The whole time we left just about every light on in the boat. At this point I should mention that boats like these have two big lead acid batteries. They are connected to all of the boats systems through a big rotating switch, which lets you select battery 1, battery 2, or ‘All’ where both batteries are connected in parallel. We left the switch in the ‘all’ position after we turned off the motor, when we should have switched it to either of the other positions. Basically we drained the battery – not sure how, but either they were almost dead to begin with, or they are at the end of their life span.

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.

[![](http://blog.saleae.com/wp-content/uploads/2012/10/DSC03262-1024x680.jpg)](http://blog.saleae.com/wp-content/uploads/2012/10/DSC03262.jpg)
DustBuster, or backup starter battery holder? I can’t tell.
Within 5 minutes, I had results. A 14 cell NiCad pack with neat blade connectors poking out one side, measuring around 16 volts. Joe made a makeshift ground connection, and I racked my brain for the worst thing that could happen if we tried to charge a 79 amp hour deep cycle lead acid battery from what couldn’t have been more than a 2 amp hour NiCad pack. After telling James to man the fire extinguisher, we connected the batteries and watched the voltage. After checking the temps on everything with my hands, we started a timer for 5 minutes, while Joe held the power terminals connected. After 5 minutes, we checked the temps again as well as the voltages of both batteries while disconnected, and started the timer for another 5 minutes. By this time, the wires shorting the packs were pretty warm, but still OK. We ran this charge system for about 15 minutes before we decided to try the motor. I think we were all convinced nothing was going to happen, but when Joe turned that key, low and behold, the engine actually budged a few turns. There was hope! Unfortunately, we had discharged the NiCad pretty far and it was now pretty hot. We decided to go to our second plan – connecting the boat batteries in series and starting the boat with that. Joe disconnected everything from battery number one, and tied them in series. Then we connected what we thought was the starter positive cable to the now +24 terminal and crossed our fingers – nothing happened but a bit of sparking. Good, all the electronics on the boat didn’t just spontaneously explode like I had imagined. I should mention that our knowledge of the boat’s wiring greatly improved after we rewired the whole system the next day. I silently held my breath as Joe turned the key to start – and the engine sprung into life! God I was happy, partially because this meant I was going to sleep in my own bet tonight, but mostly because we just used our brains to think up a way out of an otherwise hopeless situation. Also, because now I can proudly answer the age old question, *can you jump start a gas engine with a dust buster?*

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.

[![](http://blog.saleae.com/wp-content/uploads/2012/10/DSC03250-1024x680.jpg)](http://blog.saleae.com/wp-content/uploads/2012/10/DSC03250.jpg)
The boat batteries. 79 amp hours of uselessness.
 
[![](http://blog.saleae.com/wp-content/uploads/2012/10/DSC03255-1024x680.jpg)](http://blog.saleae.com/wp-content/uploads/2012/10/DSC03255.jpg)
The battery that saved our bacon.
[![](http://blog.saleae.com/wp-content/uploads/2012/10/DSC03268-1024x680.jpg)](http://blog.saleae.com/wp-content/uploads/2012/10/DSC03268.jpg)
The little voltmeter that could.