Steffest Digitale Pulptuur

The Zen of Hardware Hacking

The 4th Barcamp in Antwerp - And a great one it was.
I gave a talk about "The Zen of hardware-hacking" , indicating that there's a noticeable shift in my attitude towards hardware and software - I still want high-tech everywhere around me, but at the same time it has to be as invisible as possible, completely out of the way if you don't need or want it.

As a hardware demo - to make it a bit more concrete - I made the fantastic KWISKWAT-O-MATIC ! :-)
The technical part is an Arduino with a wifi shield that holds a little webserver.
The beauty is that - once programmed - it runs completely on it's own with VERY low power consummation.
When you access the webserver you can send little commands to control the physical object (the arduino) - in this case toggling some coloured lights.
Physical devices become a part of the web that way and are easy to connect to any webservice out there.
The KWISKWAT-O-MATIC is connected to the Telenet API I made some time ago: Whenever a new episode of Kwiskwat is aired (and recorded by the Telenet digicorder), the light turns green, if no new unseen episode is available, the light is red.
image image image

Here's the Arduino script - it runs a very (VERY) limited webserver, which is perfect for controlling little hardware devices.



unsigned char local_ip[] = {192,168,1,120};    // IP address of WiShield
unsigned char gateway_ip[] = {192,168,1,1};    // router or gateway IP address
unsigned char subnet_mask[] = {255,255,255,0};    // subnet mask for the local network
//const prog_char ssid[] PROGMEM = {"Wireless"};        // max 32 bytes
const prog_char ssid[] PROGMEM = {"HTC network"};        // max 32 bytes

unsigned char security_type = 0;    // 0 - open; 1 - WEP; 2 - WPA; 3 - WPA2

// WPA/WPA2 passphrase
const prog_char security_passphrase[] PROGMEM = {"12345678"};    // max 64 characters

// WEP 128-bit keys
// sample HEX keys
prog_uchar wep_keys[] PROGMEM = {    0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d,    // Key 0
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    0x00,    // Key 1
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    0x00,    // Key 2
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    0x00    // Key 3

unsigned char wireless_mode = WIRELESS_MODE_INFRA;
unsigned char ssid_len;
unsigned char security_passphrase_len;

int ledPin =  14;

void setup()
        pinMode(14, OUTPUT); 
        pinMode(15, OUTPUT); 
        pinMode(16, OUTPUT);
        digitalWrite(14, 1);
        digitalWrite(15, 1);
        digitalWrite(16, 1); 

// This is the webpage that is served up by the webserver
const prog_char webpage[] PROGMEM = {"HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n"};

void loop()



  Filename:        webserver.h


  Based on the TCP/IP stack and driver for the WiShield 1.0 wireless devices by Async Labs Inc.


#include "uip.h"
#include "webserver.h"
#include "config.h"

static int handle_connection(struct webserver_state *s);

void webserver_init(void)

void webserver_appcall(void)
    struct webserver_state *s = &(uip_conn->appstate);

    if(uip_connected()) {
        PSOCK_INIT(&s->p, s->inputbuf, sizeof(s->inputbuf));


#define ISO_nl      0x0a
#define ISO_space   0x20
#define ISO_slash   0x2f

#define ISO_R   0x52
#define ISO_G   0x47
#define ISO_B   0x42

#define ISO_O   0x4f

unsigned char ch;

const char http_get[5] = {0x47, 0x45, 0x54, 0x20, };    /* "GET " */

unsigned short fill_buf(void* blk)
    unsigned short webpage_len;

    webpage_len = (strlen_P(webpage)>uip_mss())?uip_mss():strlen_P(webpage);

    memcpy_P(uip_appdata, webpage, webpage_len);
    return webpage_len;

static int handle_connection(struct webserver_state *s)

    // read incoming data until we read a space character
    PSOCK_READTO(&s->p, ISO_space);

    // parse the data to determine if it was a GET request
    if(strncmp(s->inputbuf, http_get, 4) != 0) {

    // continue reading until the next space character
    PSOCK_READTO(&s->p, ISO_space);

    if(s->inputbuf[0] != ISO_slash) {
        if(s->inputbuf[1] != ISO_space) {
                if (s->inputbuf[1] == ISO_R){
                   digitalWrite(14, 0);
                   digitalWrite(15, 1);
                   digitalWrite(16, 1);
                if (s->inputbuf[1] == ISO_G){
                   digitalWrite(14, 1);
                   digitalWrite(15, 1);
                   digitalWrite(16, 0); 
                if (s->inputbuf[1] == ISO_B){
                   digitalWrite(14, 1);
                   digitalWrite(15, 0);
                   digitalWrite(16, 1); 
                if (s->inputbuf[1] == ISO_O){
                   digitalWrite(14, 1);
                   digitalWrite(15, 1);
                   digitalWrite(16, 1); 

    PSOCK_GENERATOR_SEND(&s->p, fill_buf, 0);

The slides of my presentation can be found at  (click for the next slide)
They are not very usefull without the talk, but still ...

 The Tech45 podcast was also present and made a special Barcamp Antwerp4 edition (with a little interview with yours truely, hopefully online soon)
Marco Frissen made some nice pictures
More here


Thanks @cubus and @ichoosr for a very nice Barcamp, and thanks to the sponsors GVA, Sw�rl, Stad Antwerpen, Krimson, Just-Eat, Digiti, Belgian Cowboys, iChoosr

Tags: Arduino, in English, TinkeringGeef je reactie (2)