Book Review: Arduino Home Automation Projects

Categories Design, Interaction, Open-source, Programming, Technology

ishot-5

Arduino Home Automation Projects is a practical step-by-step guide to entering into the world of ‘DIY Home Automation’. The benefits of a DIY Arduino based approach to automation that this book puts forth are those of a vastly reduced expense as compared to a commercial fit-out, more control through understanding and an endlesslessly customisable solution.

The book covers real-world examples of use: Motion detection, Controlling lights using a smartphone or tablet, measuring temperature with bluetooth and even explores cloud implementation.

What I find most exciting is the chapter on hacking an existing commercial home automation device. I hope readers find the concept of hijacking existing products with their Arduino’s for their own benefit to be useful in other arenas outside of ‘home automation’ and I can definitely see the skills presented in this book being translated into future projects.

For those strictly interested in ‘home automation’, the book wraps things up with everything you need to build your very own custom solution from scratch – including 3D printed casings and custom PCB’s – which exposes the reader to invaluable skills they can use outside of the subject matter.

ishot-6
The book is well illustrated and documented with photography which is essential for learning. I would recommend this book to students and hobbyists who have experimented with a stand-alone Arduino but have yet to let their Arduino experiment with the world around them.

Synaesynth @ The Bella Union, Melbourne

Categories Design, Interaction, Visuals

Goodtimes Forever Again

I was kindly invited to bring along my interactive colour to sound conversion instrument to “Good Times Forever Again”, a night which originated in Sydney and later made it’s way to (the welcoming open arms of) Melbourne.

The talent there was amazing, each band had a unique and well-explored sound, the entire night was set against a backdrop of wonderful animated illustrations by Meg O’Shea, some nude body painting and a legitimate magician. I’ve never seen someone make objects appear, dissapear and otherwise transmogrify right in plain sight before.

From the event page:

This is the second Goodtimes Forever show in Melbourne after the first big night back in April, making it the third since the event kicked-of started in Sydney.  This night is going to offer you a mix of the (un)usual music, art and goodtimes, but for the first time they’re gonna have a MAGICIAN!

Book Review: Internet of Things with Arduino Yun

Categories Interaction, Open-source, Programming, Technology

Internet of Things with the Arduino Yun

Internet of Things with the Arduino Yun is a well-paced practical introduction to creating and exploring DIY smart devices. Or, as the book phrases it; “projects to help you build a world of smarter things”.

Each example project explores a specific real-world scenario similar to that of existing applications of Internet of Things (IoT) technologies within industry. Each example also exposes the reader to concepts and techniques that should be easily transferrable to many other projects and applications. Covering the subjects of sensing, data collection, automation and long-term presence, the book gives readers a good overview of the broad concerns that need to be considered when designing smart devices.

Power Consumption Data

An example of the kind of data readers might
gather about objects and habits within their home

 

Impressively, the book doesn’t require a great deal of prior knowledge to navigate, though some interest in coding and electronics is of course necessary. Those already familiar with Arduino will benefit from the exploration of the networking aspects of Arduino Yun as they are a bit different to control than what one might be used to with prior versions of the Arduino. The book would make a great companion for those unboxing an Arduino Yun for the first time.

Using Xbee with Arduino Yún

Categories Interaction, Open-source, Programming, Technology

Came across an issue today when upgrading a project I’m currently working on to make use of an Xbee + Arduino Yún stack instead of an Xbee + Arduino Uno stack and found that the solution wasn’t very apparent online. I thought I’d post a short writeup here. Special thanks to Bo for solving this issue.

Firstly, the Yún is amazing in that is has built-in WiFi capabilities, but this also means a few peculiarities with the serial due to the split architecture. If you are trying to use an Xbee with a shield, you will need to make a few modifications to both hardware and code in order to get it working.

Firstly, we cannot use the normal serial communication pins (0,1) and instead need to use alternative pins. I assumed I could use the SoftwareSerial library to allocate another set of pins (for example 10, 11) however for reasons I still don’t fully understand this doesn’t work either.

The solution was suggested by cmaglie in this thread to use AltSoftwareSerial (download the library here). I had not heard of AltSoftwareSerial before, it is an emulated serial comm.

What you need to do is install the above library (read here if you have never done that before) and change your code to include the new serial method. The example code below will recieve packets from another device and print them to serial:

#include <XBee.h>
#include <AltSoftSerial.h>

XBee _xbee = XBee();
AltSoftSerial altSerial;

void setup()
{
  Serial.begin(9600);
  altSerial.begin(9600);
  _xbee.begin(altSerial);
}

void loop()
{
  value="";
  processXBeePackets();  
}

void processXBeePackets()
{
   _xbee.readPacket();
   if (_xbee.getResponse().isAvailable())
   {
      _xbee.getResponse().getZBRxResponse(rx);
      //Serial.println(rx.getDataLength());
      for(int i=0;i<rx.getDataLength();i++){
         value.concat(char(rx.getData(i)));
   }

   Serial.println(value);
   }
}

Then on the hardware side, you need to modify your Xbee shield (or if not using a shield, simply reroute your pin-out). This is as simple as bending out two header pins (we’ve used spacers) so that they don’t actually come into contact with their Arduino counterparts. So, pins 2 and 3 don’t connect to Arduino and we instead use some jumpers to reroute them to 5 and 13 respectively. See the images for reference:

Xbee shield working on Arduino Yun
Rerouting pin 3 > 5 and pin 2 > 13

 

sparkfun xbee shield header pins modified for serial with Yun
The header pins for 2 and 3 need to be bent so that they don’t interface with the arduino.

You should now be able to pass your Xbee communication data on to your Arduino Yún and then pass it on to a server or computer via WiFi.

How to send multiple variables from Processing to Arduino

Categories Interaction, Programming

I wanted to be able to send a set of 4 integers to an Arduino from a Processing application that I am working on, I also wanted to be able to prefix the set with a tag, so that I could deal with different sets of integers in specific ways, for specific purposes.

For instance, I have an LCD screen and some LED’s connected to my Arduino, or maybe I have a servo motor and a speaker that I want to control based on events happening in software running via Processing.

I modified* the code below from the code shown here (Arduino Cookbook @ inkling.com)

*I simply expanded the amount of variables being sent per packet.

Processing Code:

// Processing Sketch

/* SendingBinaryToArduino
 * Language: Processing
 */
import processing.serial.*;

Serial myPort;  // Create object from Serial class
public static final char HEADER    = 'H';
public static final char A_TAG = 'M';
public static final char B_TAG = 'X';

void setup()
{
  size(512, 512);
  String portName = Serial.list()[1];
  myPort = new Serial(this, portName, 9600);
}

void draw(){
}

void serialEvent(Serial p) {
  // handle incoming serial data
  String inString = myPort.readStringUntil('\n');
  if(inString != null) {     
    print( inString );   // echo text string from Arduino
  }
}

void mousePressed() {
  sendMessage(A_TAG, 8,5,20,33);
}

void sendMessage(char tag, int a, int b, int c, int d){
  // send the given index and value to the serial port
  myPort.write(HEADER);
  myPort.write(tag);
  myPort.write((char)(a / 256)); // msb
  myPort.write(a & 0xff);  //lsb
  myPort.write((char)(b / 256)); // msb
  myPort.write(b & 0xff);  //lsb
  myPort.write((char)(c / 256)); // msb
  myPort.write(c & 0xff);  //lsb
  myPort.write((char)(d / 256)); // msb
  myPort.write(d & 0xff);  //lsb
}

You can see in the void sendMessage function that each integer is being split into two bytes, but both the header and tag are sent as a single byte – this means we are sending 10 bytes all up (we will need to reference this in the Arduino code in TOTAL_BYTES).

Arduino Code:

// BinaryDataFromProcessing
// These defines must mirror the sending program:
const char HEADER       = 'H';
const char A_TAG    = 'M';
const char B_TAG    = 'X';
const int  TOTAL_BYTES  = 10  ; // the total bytes in a message

void setup()
{
  Serial.begin(9600);
}

void loop(){
  if ( Serial.available() >= TOTAL_BYTES)
  {
     if( Serial.read() == HEADER)
    {
      char tag = Serial.read();
      if(tag == A_TAG)
      {
        //Collect integers
        int a = Serial.read() * 256; 
        a = a + Serial.read();
        int b = Serial.read() * 256;
        b = b + Serial.read();
        int c = Serial.read() * 256;
        c = c + Serial.read();
        int d = Serial.read() * 256;
        d = d + Serial.read();
        Serial.print("Received integers | a:");
        Serial.print(a);
        Serial.print(", b:");
        Serial.println(b);
        Serial.print(", c:");
        Serial.println(c);
        Serial.print(", d:");
        Serial.println(d);
      }
      else {
        Serial.print("got message with unknown tag ");
        Serial.write(tag);
      }
    }
  }
}

You can see under Serial.available() after the comment “//Collect integers” that each byte is being stored in a variable (multiplied by 256 to reverse the division on the Processing side) and then the second byte is added to that (thus reversing the rejoining the split that took place on the Processing side) – in this way we are reassembling the data that we sent into a useable format to be used.

From here you can do whatever you like with the data, use it for conditionals or set it to analog outputs. The applications are nearly endless.

Make a custom USB button pad [Pt III]

Categories Interaction, Uncategorized

In my previous posts I was modifying a traditional plastic-housed USB Keyboard that had a chip inside it like the one below:

These contact points had to be scraped or sanded clean in order to solder to them, however scraping them made them quite thin on the surface and therefor quite brittle.

The chips inside the cheap, flexible silicone keyboards (above) are actually much easier to work with because they have a line of female headers instead of contact strips. This allowed me to solder up a vero board to act as a breakout shield (below)

I bought some female-female jumper cables which I will be cutting, stripping and placing a n/o button between. This allows me to plug and play the buttons as needed with low-risk. The layout of the header pins on the vero board was determined through shorting sections of the chip with test leads and figuring out the combinations necessary to make a minimum of 25 unique combinations/keystrokes.

 

Getting ready for User Testing

Categories Design, Interaction

I am user testing my interactive instrument tomorrow. I have four participants coming in throughout the day, all of them musicians, each with varying modes of musical expression ranging from more new school beat-makers to borderline analog purists. I am excited to see what they do with the device and whether they could see it fitting into their musical workflow. I will be recording all video, audio and screen activity from the day (as much as I can manage) and will then begin wading through it all to try and analyse the sessions. More to come soon.

Make a custom button pad for Raspberry Pi [Pt II]

Categories Interaction, RMIT

In my previous post I was using a testing cable with an alligator clip on one end and a probe on the other, shorting the circuit board that I took out of a cheap USB Keyboard. The small distance between each contact point made using the alligator clip awkward and prone to bridging nearby contacts. I decided that I would use a section of jumper ribbon cable that I salvaged from an old computer to form a sort of breakout board that I could use as a more robust, exploratory interface.

Firstly, I started stripping two sets of 13 wires for each bank of contacts on the USB circuit.

From there I started soldering each wire to the circuit board. Initially, creating a successful solder joint was difficult and I found that a light sanding of the contact points (to remove some surface coating and presumably add texture) made soldering much easier.

After all the contact points (in actuality, only those that were necessary) were soldered to the ribbon cable, I used jumper cables to open out the pins onto a small breadboard, allowing me to hook multiple jumpers up between points. I used this setup to create a document that outlines which connections produced a useable keystroke within the context of my project (in this case letters, numbers and symbols – no function or conditional keys). In total, I needed at least 25 different keystrokes for use in my 5 x 5 button matrix, with 8 additional keys to account for function keys.

In a later post I’ll show the process of creating the actual 25-key button matrix, solder it all up and test it to make sure that every button on the custom pad triggers a unique keystroke. It’s been a while since I’ve done a great deal of soldering, and my connections on the USB circuit – though functional – aren’t very clean looking, so I’m worried about soldering up 25+ buttons. Ultimately all the ugly electronics will be hidden inside a 3D Printed housing anyway, so no one will ever need to know.

 to be continued

Make a custom button pad for Raspberry Pi [Pt I]

Categories Interaction, RMIT

I needed a button matrix to use as an interface for a new digital instrument that I’m making as part of my undergraduate major project. Something like the monome would probably work quite well, but I cannot justify being lazy and paying for one when I feel like I could probably hack some existing things together and end up with a custom result.

In earlier posts I talked about establishing serial connection between raspberry pi and arduino, because initially I intended to read a button array with the arduino and then send little data packets via usb that told the raspberry pi which buttons were pressed.

Previous design exploration: 16-Digit Keypad connected to Arduino, connected via USB serial to Raspberry Pi using a 3.5″ TFT LCD Screen as display.

For a few reasons, particularly the latency issues, this wasn’t a viable solution. I am vaguely aware that the arduino could be cut out of the process, and the button array read by the raspberry pi directly, but I’m also vaguely aware that to try and figure out how to do that may set me back a month.

The solution was to buy a cheap USB Keyboard, gut it, rip the chip out and hook it up to a custom button array made up of a 5 x 5 grid of N/O buttons.

I like this solution in that it doesn’t really matter which contacts I solder the buttons to, so long as each button triggered a different keystroke. I can then assign each button to it’s specific keystroke and then map each keystroke to it’s corresponding position in my Processing/Python sketch.

Ultimately, the keyboard is controlled by a small chip that communicates via USB. The chip has two banks of 13 contact points. To get any of the ~101 keystrokes available you have to close the circuit between two specific contact points.

So I started blindly shorting the board with alligator clips and a probe with notepad open on my laptop to capture the keystrokes.

Ended up with some glitch poetry

Now I just need to perform the time-consuming task of soldering up an array of N/O buttons to the keyboard chip, based on the combinations that results in 25 useful keystrokes (letters, numbers, punctuation – no function or naviagation keys). Then I need to house it all in a 3D printed case.

continue to Part II

Generative Art & Interaction Design

Categories Interaction, Programming

I find generative art to be a strange concept.

 

I feel the concept is at best too broad in that it would essentially describe all Art and at worst too narrow in that it describes only certain artistic movements in which a generative approach is apparent at a surface level.

 

Marius Watz: Three stills from Electroplastique, 2005.

 

EvoEco, Jon McCormack, 2010.

 

Generative art is created by a seemingly autonomous system, usually a computer algorithm that has room for variance informed by some random element – though analog systems also apply. Some systems are completely chaotic, others enforce various over-arching rules in order to create an artistic focal point, perhaps in order to more faithfully represent existing artistic conventions; abstract paintings, ambient music and light-shows all lend well to this sort of contained generative methodology.

 

Some digital generative art is so complex – or perhaps, some forms of digital art have exhausted themselves into predictability – that we can produce a near infinite amount of “unique” pieces on command from a single source (see “The Infinite Music Machine”). In this way, the algorithm-system itself is the artwork and it’s offspring a kind of sub-art. It’s an interesting development that has parallels in consumer culture. The movement from the naturally imbued variance of artisan-produced objects, through to the precision and conformity of mass-produced objects and moving on now into an era of mass-produced bespoke objects. Though I believe that there will always be a territory of Art that is unable to be mass-produced simply by virtue of that fact that it isn’t – there may be less of a distinction between the lifeless-via-duplication and the lively-via-mutation in regards to new forms of generative Art.

 

We can create things that create things. But the things that we create can only create things that we essentially let them create.

 

If any of the above sounds radical or pointless or removed from reality, consider the humble wind chime.

The wind chime is a generative art object, it’s enforced over-arching rules are defined by the tonality that the relationships between each chime creates (as in, the musical scale that the wind chime adheres to) and it’s random element is the wind itself, an autonomous system (which to discuss further is a philosophical conversation of it’s own).

 

The wind chime is a great example of how simple constructs can lead to complex, “embedded” or “reactionary” behaviours. It’s beautiful, transitory, unpredictable and fairly non-invasive to it’s environment. Besides sporadic melodies, it’s behaviour also contains information about the wind patterns outside encoded within it’s output.

 

I’d like to explore what the wind chime is employing for it’s random element – that is, nature – in the context of a complex digital structure. The everyday world is a constant ever changing source of variables with intrinsic relationships between them. These related variables may yield beauty, simply as a result of having to conform to the physical laws of existence (leading to ubiquitous relationships such as the Golden Ratio and Pi). If we data-mine the world around us using computer systems and use that data to inform generative art objects, we could fabricate simulated synaesthetic experiences.

 

The exploration of this idea is what I am basing my major undergraduate project on throughout 2013. I will be posting about that project on this blog as it progresses.

 

Following from my earlier post Embracing the Digital Landscape, I think generative procedures will be invaluable for creating modern computer-human interfaces and technologies. As defined above, generative art need not be chaotic. It can be a way to condense, rearrange, reform and “perceptify” data. Rather than presenting data as numbers (or equivalent), with singular meanings, we could attempt to create shapes, colours and sounds that contain multiple threads of data, to be understood at a glance.

 


David Eagleman (PhD) talking about colour perception in relation to real-world information
 

Interaction design and UX design often strives to streamline data, present a “cleaner” interface and occasionally to reduce the “depth” of an interface, to bring all the information as close to the user as possible. Generative methods might be useful in this regard.