Dirk Gently and the Tweetbox of Doom

….is probably the name of the book Douglas Adams would write about this whole IoT business.

What is IoT anyway?
The Wikipedia boffins (ie. anyone) define IoT as:

IoT

You can think of it as giving some rudimentary form of telemetry to everyday objects. But if you use this data to affect the behavior of these objects, to make them more ‘intelligent’ in the broadest sense of the word, you can do some pretty interesting things.

I wanted to make my foray into this Internet of Torture thing, cause everyone seems to be doing it and it seemed easy enough. I had an Intel Edison lying around from an Instructables contest. That simplifies a lot of things as it has inbuilt Wifi and supports Arduino code. Just add a sensor (to taste, this is a recipe after all) and voila! You have an intelligent, internet connected device.

I referred to this Instructable to get the Edison Tweeting. The initial setup for the Edison is pretty straightforward and can be found on the Intel page here. There is an issue with the latest image for the Edison, which doesn’t allow the Arduino program to run at startup. There is a patch for it and that’s found here.

After you get your Edison tweeting, the next step is to add a sensor, any sensor, and make it send a tweet as a reaction to a change in it’s environment. I used an infrared reflectance sensor from Seeed Studio, another remnant of the Instructables contest. You need to follow the instructions given to tune the sensitivity of the sensor to your liking. But this is just an example. You could use any sensor you have lying around, even a contact switch made of aluminum foil, if you’d like to take the completely ghetto route. I prefer to not go full ghetto when I’m unsure of my contraptions working.

I used the following code to get  it up and running: (the code was looking hideous in the WordPress editor so I took a screenshot, and uploaded the code as a text file at the end of the post)

code_sublime

In the above code, I’ve used pin 13 as a status LED to know when it’s tweeting and pin 2 as the input pin from the IR sensor. This is not very good code as it keeps polling the sensor pin waiting for the state to change. A better code would be to attach an interrupt to the pin so that it wakes up and sends a tweet only when the sensor state changes. I couldn’t get the interrupt to work so I just used this one for basic testing.

I attached the sensor inside a dark box, so every time someone open’s the box, it tweets.

And that’s it! As simple as 1,2,3…….(100). You too can make your refrigerators and toasters tweet!

Screenshot_2016-02-07-22-43-01

With all this IoT hype, people forget that there’s going to be an explosion of data from a lot of unexpected sources (I’m sure we’re going to have socks, that post how smelly they are to the interwebs to let us know that they need to be washed, pretty soon). Whether we have the infrastructure to handle this onslaught of data (mostly pointless data, but ML and big data nerds are going to love it), still remains to be seen.

listen_to_yourself

I think this comic applies to IoT too 😛

Is IPv6 going to be enough? Will we need quantum addresses to address every molecule known to man? Is the internet of dust motes going to be the end of all humanity as we know it? And on that bombshell, we leave you to your regularly scheduled program, Mick and Rorty.

Get the code here.

PS: I have nothing to do with Dirk Gently, except being a die-hard fan of anything Douglas Adams wrote. That guy was a bawss.

 

Advertisements

One thought on “Dirk Gently and the Tweetbox of Doom

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s