HCI

You are currently browsing articles tagged HCI.

Little Robot

This is part two of a series.  Part one covered the hardware build.  Part three will cover the python based host software.

Without any further ado:

Firmware

This entire project was based around Objective Development‘s V-USB product — an open source software USB implementation. Among the AVR community, it seems to be reasonably well used, and has a nice selection of reference projects.

From the outset, I knew one robot — the one for my desk — would be talking to a linux or macintosh computer. However, my fiancé’s robot would have be happy in windows. Unfortunately, windows devices require kernel device drivers, with a very few exceptions; the most abused being the Human Interface Device profile. So why buck a trend? HID it is.

With that in mind, two existing projects seem most useful.

  • 1-Key Keyboard — the original hardware base for the little robots — is naturally firmware compatible. In fact the belly switch of each robot does indeed work as a keyboard switch. This is a full bidirectional HID device.
  • The HID-Data example included in the V-USB distribution. This is a much simpler application — it allows a host application to set and read the EEPROM storage in an AVR. It is unidirectional — all interaction is initiated by the host controller.

I chose to build off the HID-Data example as it was somewhat simpler, and did come with example host software. From there, little modification was needed; I integrated the timer calibration code from the 1-key keyboard, and added some hardware PWM support.

Every interaction is controlled from the host. For example, the microcontroller counts individual button presses. The host then sends a request to read that value. The microcontroller returns the value, and then resets the counter.

Full firmware and software is available via GitHub.

Servo Control

Servos are controlled via pulse width modulation. Many microcontrollers do have hardware PWM support, and the ATtiny85 is no exception. However, all of its timers have an 8-bit resolution. For my purposes, this is acceptable, but provides only about 25 steps from one end of the servo’s range to the other. This works out to be about seven degrees a step. Better resolution would require a software timer.

I find with the small servos I have handy, the low end of the servo’s sweep comes in at around 11, and the high end anywhere from 35 to 40.

void pwm_set( int x ) {
    OCR0B = x;
}
 
void pwm_init( void ) {
    // Set non-inverting output mode on pin OC0B.
    TCCR0A = ( 1 << COM0B1 ) | ( 0 << COM0B0 );
 
    // Set fast pwm mode.
    TCCR0A |= ( 1 << WGM01 ) | ( 1 << WGM00 );
    TCCR0B = ( 0 << WGM02 );
 
    // Use /1024 Prescaler.
    // This sets a PWM frequency of ~48Hz,
    // which is just about perfect for a servo.
    TCCR0B |= ( 1 << CS02 ) | ( 0 << CS01 ) | ( 1 << CS00 );
}

Lessons Learned

  • Include a programming header on a development board. For every firmware revision I had to pop the AVR out, reprogram it, and reinstall it. As simple as the process is, it gets old real quick.
  • Chip self-protection features are your friend. For example, under-voltage detection and hardware watchdog timers are very useful. When a computer — especially a laptop — reboots, it may brown out devices on the USB bus. A microcontroller may come back up in an undefined state. One of the robots burnt out a servo when it flaked out on a reboot.
  • Embedded software is actually fun to write! It’s simple, clean and very scope limited. Perfect for a satisfying hobby project.

Tags: , , , , ,

Little Robots

I’m going to be talking these little robots tonight, at DemoCamp Guelph!  Proceedings get underway at about 6:30 at the eBar.

Tags: , , ,

This is part one of a three part series: Part two covers the firmware, and part three will cover the software.

I find interaction design to be pretty fascinating. And lets face it, most of the technology we deal with on a daily basis has not been designed with interaction in mind. Or at least not subtle interaction.

Take telephones: they’re a priority interrupt. When a phone rings, you go through a full context switch. You have to stop what you’re doing to answer. Email doesn’t interrupt, but it’s not priority either. Email doesn’t say “I’m thinking of you” it says “I thought of you twenty minutes ago”. These are great examples of technologies that meet their minimum need; they do work, but do they work well? Is email the best way to get text from one human being to another? My spam filter says no. Is the telephone the best way to tell someone you were just thinking about them?

When you’re in a room with someone, there are many different subtle ways to indicate that you enjoy their presence. Everything from where you sit to how you breath has at least some degree of significance — some degree of communication. This project was my way of performing that communicative act, when I’m not in a room with that someone.

Enough waxing philosophical: I made two little robots. One for my fiancé’s desk, and one for mine. When you poke one in the belly, the other one waves.

Without further ado, here’s part one:

Hardware

The hardware on this project is absolutely informed by the firmware. From the outset I expected to use Objective Development’s V-USB package. It provides a software USB stack capable of running on 8-bit Atmel AVR microcontrollers.

With that in mind, I sought a challenge and picked the smallest AVR I could get on short notice — the ATtiny85, in an 8-pin DIP package. This is a pretty powerful chip, at least for these purposes. Less than $3 Canadian gets 8kB of flash program storage, a half a kilobyte of RAM, two hardware timers, and an internal oscillator.

Not really being one to reinvent the wheel, I found an existing project using the same firmware and microcontroller — the one key keyboard by Flip van den Berg. After some ethical deliberations, I shamelessly took his schematic, and breadboarded out myself:

Prototype USB Layout

To my surprise, it actually ran! You can make a USB keyboard on a breadboard! And it works on any computer that supports HID compliant devices!

The next step was to take the same circuit, and put it on something a little bit more permanent. In this case, some protoboard. The circuit on the left is a programming target board, with a standard programming header. I use it with an Adafruit USBtinyISP programmer. The circuit on the right is the USB controller with a button and header for a servo motor.

Servos are fairly useful beasts. They don’t really need drivers. Supply them with a suitable PWM signal, and they’ll drive themselves. In this case, the servo is powered off the +5v USB supply, even though the microcontroller is running at +3.3v. My servo didn’t seem to care, and quick google searching suggests that this is pretty standard; servos will amplify their PWM signal internally.

ATtiny85 target board and USB test board.

So at this point I found that the electronics basically worked. I was able to control a servo, and read button presses. So now for some larger scale hardware.

I don’t have access to a full shop, so I relied on a low impact sculpting material: Sculpey, a polymer clay, similar to Fimo. A little armature wire, some low-fidelity sculpting and the parts went into the oven at 250° F for about 15 minutes. As easy as sculpey is to work, it is even easy to rework. Hot glue and acrylic paint stick to it quite happily.

Little Robot Parts

Next, I installed the guts with lots of hot glue.

Little Robot Guts

Then I painted the exterior with acrylic spray paint. I touched up the eyes with acrylic paint, and added craft foam tank treads and covers for the belly-switches.

Little Robots

And here’s what they look like from the back.

Little Robot Innards

Next up: The firmware!

Update: This article was featured on Make: Online.

Tags: , , , ,

Arduino Duemilanove

At the next Guelph Coffee and Code. I will give a short demonstration of the Arduino platform. This will be a variation of a talk I gave while TA-ing the Human Computer Interaction course at the University of Guelph. It’s not going to be technically heavy — there will be lots of pictures, lots of live demonstrations and a little bit of fire, all in the name of science!

If you are in Guelph, and curious about the Arduino platform, or hardware hacking in general, please come on out to the Synnema, next Thursday (the 21st)!

Tags: , , , , ,

Little Robots

For our wedding save-the-date cards, I drew two little robots.

For Christmas, I made little robots for Sheena.

Little Robots

They’re USB powered — one for her desk and one for mine. When you poke one, the other will wave, wherever they happen to be.

These are powered by an ATtiny85, Objective Development’s V-USB and python.

More details to come soon.

Tags: , , , ,

I’ve had an urge lately to post some of the nifty projects I’ve done over the last few months. Hopefully it will help me put some of my experiences in context. Not to mention actually taking notes lets me find them later.

As long as computers have existed, we’ve tried to represent the physical world in the virtual one.  This trend goes as far back as the punched cards and tabulating machines used in the 1890 United States Census, but it doesn’t end there.  When computers became common enough that regular people — without specialized training — may use them, interface designers went straight for spacial metaphors.  We pulled more of the physical world into the machine.

What I find fascinating about hardware hacking and platforms like the Arduino is that we can reverse that trend.  We can interact with computers through the physical world, rather than interpreting the physical world through a virtual one.  And we can do it trivially.

Here’s my own humble first effort:

This is a bot that monitors an IRC channel. When I announce a mood, it moves the needle accordingly. It’s not very complicated at all — some cardboard, marker, sticky tape, a ~$10 hobby servo, and two pieces of code.

The first, runs on a host computer, monitors the IRC channel, and tells the arduino where to point the needle. Ruby is very terse — but it’s also very expressive. It is easy to make very functional object oriented programs in very little space.

#!/usr/bin/env ruby
 
require 'rubygems'
require 'net/irc'
require 'serialport'
 
# This is an IRC Bot that also
# talks to an arduino microcontroller.
class ToneOMeter < Net::IRC::Client
  # What emotions should this bot respond to?
  # These are passed directly to the arduino.
  @@emotions = {
    'sarcastic' => '20s',
    'sardonic' => '60s',
    'acerbic' => '135s',
    'cynical' => '180s'
  }
 
  def self.emotions
    @@emotions
  end
 
  def initialize(*args)
    super
 
    # Connect to the arduino.  This will work on linux, other
    # platforms may require some adjustment.
    @sp = SerialPort.new "/dev/ttyUSB0", 19200
  end
 
  def on_rpl_welcome(m)
    # We've connected to the server, join a channel.
    post JOIN, "#tone-o-test"
  end
 
  def on_privmsg(m)
    # Someone has entered text into the channel.  Who was it?
    name = /^(.+)!/.match( m.prefix )[1]
 
    # If it was my owner (tony), and it's an action...
    if name =~ /tony/ && m[1] =~ /ACTION/
      # Extract the action, and send the canned result to the arduino.
      action = /\01ACTION is (.+)\01/.match( m[1] )[1].strip.downcase
      @sp.write( ToneOMeter.emotions[ action ] )
    end
  end
end
 
# Instantiate a new bot, and start it.
ToneOMeter.new("test.server", "6667", {
        :nick => "Tone-O-Meter",
        :user => "Tone-O-Meter",
        :real => "Tone-O-Meter",
}).start

The second set of software is taken from the Arduino Playground and runs on the microcontroller itself. It uses Arduino’s servo library to set the servo to a given angle. This isn’t my code, but it’s trivial enough (and useful enough) to repeat here.

#include 
 
Servo servo1;
 
void setup() {
  pinMode(1,OUTPUT);
  servo1.attach(14); //analog pin 0
  //servo1.setMaximumPulse(2000);
  //servo1.setMinimumPulse(700);
 
  Serial.begin(19200);
  Serial.println("Ready");
}
 
void loop() {
  static int v = 0;
 
  if ( Serial.available() ) {
    char ch = Serial.read();
 
    switch(ch) {
      case '0'...'9':
        v = v * 10 + ch - '0';
        break;
      case 's':
        servo1.write(v);
        v = 0;
        break;
     }
  }
  Servo::refresh();
}

So there you have it: Physical computing done with little electronics skill, for less than $40, and in less than a hundred lines of code. This is a pretty trivial example, but even just given the context of IRC it suggests some nifty projects. For example, a physical representation of how many users are in a channel? Or how active the conversation is?

With physical interfaces now trivial to prototype, interface designers have yet another tool: Physical, tangible interfaces.

Update: This article was featured on Make: Online.

Tags: , , ,

I haven’t written here in quite some time, but I hope to do so soon — I’ve got a handful of interesting projects from the last few months.  Here’s a quick preview:

So I’ve been playing with some open source microcontroller hardware, namely the arduino. It’s inexpensive, and easy to implement.  This little demo is just a hobby servo motor, an arduino and about fifteen lines of ruby code.
It sits in an IRC channel, and moves whenever I announce a particular mood.

Code and details to come!

Tags: , , ,

Tags: ,

World Builder

Bruce Branit



Microsoft Office Labs Vision 2019

Tags: , , ,

On interfaces.

The End of Cyberspace: Rediscovering the virtues of the manual

Some engineers and designers are realizing that there are losses that come from virtualizing. There have long been stories of students who design things on CAD that are impossible to manufacture, or that are 10 or 100 times too large, because virtualizing the design process divorces it from actual things.

10 Futuristic User Interfaces | Monday Inspiration | Smashing Magazine

And here is where creative ideas and unusual interface approaches become important. Innovative doesn’t mean usable and usable hardly means innovative. As usual, it’s necessary to find an optimal trade-off. And some user interfaces manage to achieve just that.

Mockup Frenzy #3: Game Boy De-Makes!

To sum up, de-makes are the inverse of the “next-gen” game update. Take a new game, and roll it back to an older piece of hardware. Only we’re going to be rolling it WAY back; all the way to the original Game Boy! Goldeneye 2D is a perfect example, and the inspiration for this theme!

Mozilla Labs » Blog Archive » Introducing Ubiquity

Today we’re announcing the launch of Ubiquity, a Mozilla Labs experiment into connecting the Web with language in an attempt to find new user interfaces that could make it possible for everyone to do common Web tasks more quickly and easily.

Surfraw – Shell Users’ Revolutionary Front Rage Against the Web

Surfraw provides a fast unix command line interface to a variety of popular WWW search engines and other artifacts of power. It reclaims google, altavista, babelfish, dejanews, freshmeat, research index, slashdot and many others from the false-prophet, pox-infested heathen lands of html-forms, placing these wonders where they belong, deep in unix heartland, as god loving extensions to the shell.

Tags: , , ,

« Older entries