Arduino

A very good platform for physical computing is Arduino. It is a controller board built around the Atmel ATmega microcontroller and an accompanying development environment (Java/avr-gcc). Various version of the controller board exist and it is also possible to build your own version by just connecting a FT232 USB to RS232 adapter to a ATmega168 CPU. Lots of libraries are provided by the Arduino community, that help with interfacing to various hardware devices like sensors and displays.

 

I also advocate to take a look at Processing. This Java based development environment provides many library functions making it very simple to create programs with which you can conroll your Arduino appliance from your workstation.

 

If you're interested in the field of physical computing and want to learn the basics, you should consider reading the book Making Things Talk. By presenting a series of simple projects, this book provides an introduction to Arduino and Processing.

 

On the following pages I will present my own Arduino/Processing projects and will provide my own extensions for these frameworks.

 

Arduino Libraries

In addition to the vast amount of already provided libraries, i have written some libraries during my projects. I am publishing the library code under the LGPL. Click on the following links for further information and downloads.

 

SRF02

 

Code to read one or more SRF02 ultrasonic distance sensors (I2C/TWI interface). More...

 

CMPS03

 

Code to read a CMPS03 compass sensor (I2C/TWI interface). More...

 

Arduino GrapeLabs

In this picture you can see that it's very easy to build an Arduino board. Essentially you need only a USB to RS232 breakout bord, a ATmega168 CPU and a crystal oscillator (besides some passive components). I also added a 5V regulator, some LEDs, buttons and pin headers for all digital and analog pins to this board.

Arduino GrapeLabs analog port test

The next image shows a simple setup to test the Arduino analog ports. The analog value of a potentiometer is converted to a PWM-signal driving a LED with the following code line:

 

analogWrite (LED_PIN, analogRead (POT_PIN));

Arduino GrapeLabs LCD/Compass prototype

This picture shows a LCD and a I2C compass module (CMPS03) connected to the Arduino. Using the LiquidCrystal library and my own CMPS03 library, the code to read the compass value and display it onto the LCD is extremely simple:

 

#include <LiquidCrystal.h>
#include <Wire.h>
#include <CMPS03.h>

LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);
CMPS03 cmps03;

void setup()
{
  Wire.begin();
}

void loop()
{
  int angle = cmps03.read();
  lcd.home();
  lcd.print("Angle: ");
  lcd.print(angle);
  lcd.print("   ");
}

Tips and Tricks

Albeit Arduino is a project that is almost perfect, there are some quirks and annoyance for which fortunately a solution exists.

 

On this page i collect some of these problems/solutions that i came across during my Ardino development. More...

Copyright (C) 2007-2010