The Time I Took My 6 Year Old to a Hackathon

My oldest daughter has been helping out with hackathons and startup weekends for the past few years. Usually it’s helping me set up on Friday, and coming to see the demos on Sunday - but she loves the idea of ‘hacking’. I’ve come home to, “Daddy, this is my hack.” more than a few times, so this year I asked Ella if she wanted to come for the whole thing. 

Of course, she said yes. 

lvhack-robot

And I do mean the whole thing. We left the house Friday afternoon to do the supply run, set up for the evening, and didn’t return until almost midnight. Saturday morning, she was up at 6:30, reminding me it was time to leave.

During the setup on Friday, Mark (my fellow hack organizer) and I realized the significance of a detail we had overlooked. The venue was up two flights of stairs, there was no elevator, and it was just the two of us lugging all the drinks and supplies for the weekend up those stairs. Ella helped with the light stuff, and that’s when we ran into the door.

Not yet having entry cards, I told Ella to stay inside and open the door for me. When I tried to get back in, there she was, with all her six years of strength, pushing against the crash bar to no avail. I rang the bell, and someone came down the stairs and opened the door without much effort.

Puzzled by this, we took a closer look.

We found that the crash bar was a deprecated feature no longer in use, even though the user interface remained. The door was now using a magnetic lock wired to a motion sensor. With the direction the motion sensor was aimed, it would not be triggered by a 4-foot mini-hacker pressed up against the door trying to open it. So we looked around a bit more and found a little metal plate next to the door, provided for exactly this kind of situation. One touch to that plate and the door would unlock. 

Bingo. Problem solved.

Well, half the problem solved. There were still the stairs, and Ella took it upon herself to be the keeper of them. All Friday night she ran up and down the stairs - again, roughly two full flights - touching the metal plate and letting people into the event. By the time we were ready to start talking about hack ideas, a device that allowed us to unlock the door without a trip up and down the stairs was jokingly suggested by a few people.

Since no one was interested in the idea I pitched (which was a great idea by the way), Ella and I decided to build what she titled, the “no stair runner”. 

It would have been great to show up Saturday with it built, but after arriving home around midnight sleep seemed of more immediate use. After a breakfast run for the hackers - and Ella, knowing what time I said we needed to leave, made sure to let me know it was a little past 7 and that we were going to be late - we settled down to working on the door. 

I decided to take the obvious route and have a servo touch something to the metal plate (what exactly, I wasn’t sure of yet), emulating the intended use. I just happened to have a Tessel microcontroller and a servo in my hack box. So it wasn’t long until we had the servo arm moving back and forth.
 

console.log('servo setup');
servo.on('ready', function () {
     servo.configure(servo1, 0.05, 0.12, function (err) {
          console.log('setup servo: ' + err);
          servo.move(servo1, 0);
     });

     setTimeout(function(){
          press();
     }, 10000);
});

var press = function(){
     console.log('pressing');
     servo.move(servo1,.50);

     setTimeout(function(){
          servo.move(servo1, 0);
          console.log('unpressing');
     }, 5000);
};

With that we could touch the plate, wait for 5 seconds, then stop touching it. At this point we were touching it only once, ten seconds after the microcontroller loaded the program. We still needed a way to trigger it throughout the day. A really long wire seemed simultaneously too easy and too hard. Too easy because it’s a hackathon, and too hard because it would be a really long wire. 

I had picked the Tessel because it has wifi built in, and it should be trivial to connect it to the internet. But I still needed a way to send it a message. After a little digging I found that PubNub’s NodeJS client should run on the Tessel. That allowed me to subscribe the Tessel to a PubNub channel, and trigger the servo when it received a message.

That was the theory at least. Back in reality I ran into problems with the saturation of the local wireless network, my unfamiliarity with the Tessel - specifically that the red LED meant the network connection had dropped - and the complete absence of error-checking in any of my code (hey, it’s a hackathon, don’t be judgy). Trying to subscribe to a PubNub channel when there’s no internet connection didn’t work out that well.

Before I could finish troubleshooting all that, it was time to run for lunch (hungry hackers can become grumpy hackers). So it was mid-afternoon by the time we were sending a message from the PubNub developer console and having our servo ‘touch’ something. All the while, Ella had been counting her trips up and down the stairs. At least we could quantify the value of this hopeful hack.

console.log('pubnub init');
var pubnub = require('pubnub').init({
    subscribe_key: 'sub...',
    publish_key: 'pub...',
});

pubnub.subscribe({
    channel: channel,
    message: function() {
        console.log("got button press", JSON.stringify(arguments));
        press();
    }
});

Our technology problems somewhat solved, we started work on how to fool the metal pad. I started to overthink things. My initial thought on Friday night was to just ground the thing, the basic concept behind a simple touch switch. But somehow my thoughts drifted to ‘capacitive touch’, the concept that makes the screen on our phones and tablets touchable. So I tried a touch screen stylus, long lengths of wire, even capacitors in different configurations.

Rarely did anything work, and when it did, there was no identifiable reason. Stumped, I called in a few other hackers and the results were the same. Then a guy named ‘Taters’ from the local Makerspace threw some roast beef at it and claimed, “If tossing meat at it doesn’t set it off, it’s not capacitive.” He followed that observation with a string of alligator clips grounding the plate to the nearest potential ground we could find.

Boom. It worked.

Armed with those alligator clips and some wire, Ella and I did extensive testing. It looked like the head of a screw we’d found in a piece of metal conduit worked perfectly. With all the individual pieces solved we just needed to attach the servo near the plate, so the wire touched as the servo arm moved. But alas, we’d blown through dinner, and it was time to clean up the place, break out some ice cream, and send everyone home. 

The full implementation would have to wait until the next day. Which was good, as we realized we’d run into another problem. Though the Tessel was ‘wireless’, the servo board still needed a power supply. I didn’t have a battery, and there was no outlet down the stairs by the door. We planned to figure that out after some sleep. 

While the other hackers were distracted by the ice cream, Ella and I devised a better method of sending the ‘touch the pad’ message than just using the PubNub developer console. A few lines of PHP, and we connected a Nexmo virtual number to the PubNub channel so any inbound SMS triggered a message to the channel.

<?php
$request = array_merge($_GET, $_POST);
if(!isset($request['msisdn']) OR !isset($request['text'])){
    error_log('not inbound message');
    return;
}

error_log('sending message');
file_get_contents('http://pubsub.pubnub.com/publish/pub../sub.../0/hackdoor/0/%22doit%22');

Yes, we could have checked the message for some secret security code, but we just wanted to see this thing work. And it did work, just at our table and not down the stairs at the door. Arriving back at home a little before midnight, I checked again if Ella wanted to get up early and head out with me in the morning.

She did, so before we left I grabbed the uninterrupted power supply under my desk. Perhaps that was a bit overkill, but it solved the power problem and we were on the way to the hackathon. It was Sunday and we planned on catching a church service before picking up lunch for the group, so we only had a couple hours before we had to leave. That seemed like more than enough time. 

While people arrived, we gorilla taped the servo to the side of the panel. Some painters tape (we’re conscientious hackers after all) adhered the Tessel itself to the wall, and we plugged everything into the power supply. Which was of course beeping, because it wasn’t plugged into an outlet. But this was a hackathon, we could deal with that.

I plugged the Tessel into my laptop to check the status, but found there was no network connection. It looked like we were too far from the router for the radio in the Tessel to connect. Or perhaps it was too many people arriving and connecting. Either way, I couldn’t seem to keep an active connection. Fortunately, I had an extra router with me, so we plugged that in, ran it as close to the stairway as possible, and were finally able to connect to the internet.

hack-finished

With it all set up, we did our first test. An inbound SMS to a Nexmo number triggered a web request to our callback URL. The simple PHP script then sent a message over the PubNub channel, and the Tessel - subscribed to the same channel - received the message. The message received, the Tessel had the servo move, causing the grounded wire to touch the metal plate.

And the door was unlocked.

With that, two happy hackers headed up the stairs for what we hoped was the last time. 

Not long after the doorbell rang, and both Ella and I ran to the door at the top of the stairs - I sent the device the command and yelled “It’s open”, hoping that was actually true. 

Turns out they couldn’t hear me yell down the stairs and through the door. They could however hear the beep the backup power supply made every ten seconds or so, and assumed that meant the door was unlocked so they gave it a pull, and it opened.

That worked for me. After all, it’s a hackathon. As we left a little while later, Ella asked: 

“Is it working?” 

I told her of course it was, she was there when we tested it. 

“I thought so, because I heard the doorbell, but I didn’t have to run down the stairs.” 

In my book, a successful hack.

Ella shows of her hack.

Tim Lytle API Guy, Developer Evangelist @nexmo, Sometime Mercenary Developer via @oDesk, @lvtech Wrangler, Host @lvtechradio, Occasional Writer & Speaker

Comments

Comments(1)

freaksauce

That is a fantastic story! Very inspiring, I need to start doing some hacking with my daughter