rat pack remote control – an internet of things basics hands on workshop by sven kräuter
DESCRIPTION
“Frank, Sammy & Dean were a great team known as the “Rat Pack”. What’s true for these fellows is also true for Sinatra, Ruby and Arduino: put them together for instant awesomeness. Awesomeness as in: turn plain objects into social objects, a.k.a. the Internet Of Things ™. But what is the much quoted IoT exactly, and: how does it work? To answer these questions Sven will give you some birds eye view insights concerning what the IoT is followed by presenting a simple technical approach with free and open source tools to get things going yourself. This alone should be inspiring enough to discuss questions and ideas provoked by the talk, but here’s a little hint anyways: asking Sven what IoT maker artifacts are in his bag that day usually results in a little life demo.”TRANSCRIPT
Rat Pack Remote Controla technical Internet of Things (tm) basics primer
Sven Kräuter - @SVEN_KR Codemotion Berlin | 05/2013
please tweet using:
@making_de#makingde
making things happen.
who is sven kräuter?
sven Kräuter is an agile & lean coach, software developer and a maker.
what is THE INTERNET OF THINGS?
THE INTERNET OF THINGS IS...
making things happen.
the internet of things (Iot)
objects
communicating
via the internet
build the iot.
making things happen.
the Iot
good bye
„one size fits all“.
making things happen.
the Iot
hello
„dedicated devices“.
video Source:https://vimeo.com/21387481
SPOTIFY BOX.making things happen.
video Source: sven‘s smartphone
M&C BULLI.
making things happen.
making things happen.
Category A Iot
interaction with existing
online services.
making things happen.
Category A Iot
representation of
known information
in a new way.
video Source: http://vimeo.com/45980092
GOOD NIGHT LAMP.making things happen.
making things happen.
Category B Iot
establishing new
online services.
making things happen.
Category B Iot
representation of
new information
in a new way.
nice but what‘s the purpose?
let me elaborate...
making things happen.
trend Always On
increasing amount of
real time data &
screens do not scale.
making things happen.
screens do not scale
representation of data
on a screen
is just one possibility.
making things happen.
screens do not scale
it is not necessarily
the best possibility.
video Source: https://vimeo.com/49425556
NO PLACE LIKE HOME.making things happen.
what THE INTERNET OF THINGS is
THE INTERNET OF THINGS IS enabling you to communicate beyond the boundaries of screens and keyboards.
what THE INTERNET OF THINGS is
it IS enabling you to communicate online in a more intuitive & more effective way.
Nice. But HOW DOES IT WORK?
Surprisingly simple...
making things happen.
The Internet
THE INTERNET (TM)
Hello there! SendHello there!
HTTPHTTP
HTTP
making things happen.
The Internet OF Things Category A
THE INTERNET OF THINGS (TM)
I want to go to.... Send
HTTPHTTP
HTTP
Photo Source: flickr.com/photos/bike/5153033439/in/photostream/
making things happen.
The Internet OF Things Category B
Photo Sources: flickr.com/photos/foxtongue/3235806474, flickr.com/photos/batterypower/398209685
THE INTERNET OF THINGS (TM)
HTTPHTTP
HTTP
So - What‘s This Rat PAck Thing?
IT‘s Surprisingly simple, too.
making things happen.
The ORIGINAL RAT PACK
Frank Sinatra,
DEAN Martin &
Sammy Davis (Jr.).
making things happen.
The IOT‘s RAT PACK
The Sinatra GEM,
The ARDUINO System &
The Ruby Language.
making things happen.
The RAT PACK System
THE INTERNET OF THINGS (TM)
The switchis on!
HTTPHTTP
HTTP
Rat PAck REmote Control. live demo.
making things happen.
Rat Pack Remote Control.
Source: github.com/5v3n/ratpack
WHAT‘S THE VALUE PROPOSITION?
Probably nothingBUT FUN. during the first three usages.
making things happen.
Talking Of FUN, Part I
Let‘s have a look atthe code.
the (whole) Sinatra Server.making things happen.
require 'sinatra'require 'json'require 'haml'
class RatPackServer < Sinatra::Application configure do set :activated, 0 end get '/' do haml :index, :locals => {:activated => settings.activated, :indicator_class => indicator(settings.activated)} end get '/status.json' do render_status_response end put '/status.json' do request.body.rewind data = JSON.parse request.body.read settings.activated = data['activated'] render_status_response endprivate def indicator(state) state == 0 ? :off : :on end def render_status_response "{\"activated\": #{settings.activated}}" endend
the Arduino Client, PT 1.making things happen.
#include "WiFly.h"#include "SPI.h"#include "Config.h"
WiFlyClient client(HOST, 80);
void setup(){ pinMode(buttonPin, INPUT); Serial.begin(9600); WiFly.begin(); if (WiFly.join(ssid, passphrase)) { Serial.println("associted with wifly network."); } else { Serial.println("Association failed."); while (1) { } } }
void loop(){ if(digitalRead(buttonPin) == LOW){ connectClient(generateHttpPut(HOST, RESOURCE, '0')); client.stop(); } else if(digitalRead(buttonPin) == HIGH){ connectClient(generateHttpPut(HOST, RESOURCE, '1')); client.stop(); } }
the Arduino Client, PT 2.making things happen.
char* generateHttpPut(char* host, char* resource, char occupied){ char postString[255]; sprintf(postString, "PUT %s HTTP/1.1\r\nUser-Agent: %s\r\nHost: %s\r\nContent-Length: 16\r\nContent-Type: application/json\r\n\r\n{\"activated\": %c}" , resource, USERAGENT, host, occupied);
return postString;}
void connectClient(char* http_request){ if (client.connect()) { client.print(http_request); client.println(); } else { Serial.println("connection failed"); }
while(!client.available()){ Serial.print("."); }}
Talking Of FUN, Part II
Let‘s have a look atthe Hardware.
the Arduino Hardware.making things happen.
THE BOTTOM LINE
Connecting plain old objects with the internet is easy.
THE BOTTOM LINE
Using the rat Pack system makes it actually dead easy.
THE BOTTOM LINE
So go get it & try the rat Pack system yourself.
Talking Of FUN, Most Important
It‘s all on GITHUB - Play with it, Fork it, Mod it. Enjoy!
github.com/5v3n/ratpack
Modding: Wearable Rat PAck.making things happen.Photo Source: flickr.com/photos/arduino_cc/8726021014
now let‘s share thoughts!
if you have experience in these fields: what do you think?
now let‘s share thoughts!
if you haven‘t any experience in these fields: what do you think?
making things happen.
let‘s keep in touch
@sven_kr @making_demakingthingshappen.desven@makingthingshappen.deMaterialS: github.com/5v3n/ratpack