open source

Open Source Physical Computing for Beginners
Physical computing is not as intimidating as it sounds. Enter the arduino platform—a platform for physical computing for the beginners

Siddharth Mankad

ust like chef Gusteau said in the movie Ratatouille, “Anyone can cook!” we could say, “Anyone can prototype!” Let’s begin by simplifying the term physical computing. It definitely sounds too techie to a newbie. According to Wikipedia, physical computing, in the broadest sense means building interactive physical systems by the use of software and hardware that can sense and respond to the analogue world. In other words, we can make devices that use sensors as input and perform some action (physical or virtual) as output.


What is the arduino platform?
Arduino (pronounced as aar-do-weknow) platform is a small and efficient AVR development board for hobbyists. It has been developed by Massimo Banzi and the Arduino team. AVR is the series of 8-bit RISC microcontrollers based on a modified Harvard microcontroller architecture. The chips used on the Arduino board include the ATmega AVR family—ATmega8, ATmega168, ATmega328 and the ATmega1280. Since the Arduino platform is Open Source, there have been many clones, and many of these clones use

other processors too apart from the ones listed above. The Arduino board comes in many sizes for a varied number of applications, the most common being the Arduino Duemilanove. The Diecimila is the older version of the Duemilanove. Other form factors include Arduino LilyPad (for wearable computing; it can be sewn onto/into clothes), Arduino Nano (for use with breadboards), Arduino Mega (a more powerful variant of the Duemilanove), Arduino Pro (a cheaper version of the Duemilanove meant for advanced users), Arduino Pro mini, Arduino Fio and Arduino BT (for wireless applications; BT uses Bluetooth) and Arduino Serial (unlike the other boards, it uses a serial/RS-232 interface instead of the USB for hook-up to the computer). The Duemilanove board is suitable for starters. It is easy to use since it’s USB-based.

the fundamentals
The first thing is to get hold of the hardware. In India, you can get the board from feemo or rhydoLABZ. The cheapest way to assemble an Arduino is to use the breadboard. Here, a blank Arduino PCB with serial COM port is used and the components are soldered onto it. The parts list is available on the official Arduino site with the schematic. It is fairly easy to assemble. The Arduino board with serial COM port requires power (unlike the Duemilanove where
w w w. e f y m Ag . co m

Fig. 1: The Arduino board 1 0 0 • Au g u s t 2 0 1 1 • e l e c t ro n i c s f o r yo u

The setup(). The Arduino hardware is shown in Fig. wait for a second } // // // // { // initialize the digital pin as Fig. The LED is an output component. The first argument is the pin number. LOW). The FTDI USB drivers are with the Arduino IDE in the ‘drivers’ folder. using the Duemilanove. The analogue input pins are where input sensors and analogue input devices like potentiometers (pots) can be connected. co m 1 0 2 • Au g u s t 2 0 1 1 • e l e c t ro n i c s f o r yo u . Even if the serial COM port version is used there will hardly be any difference per se. // as long as the Arduino has power void loop() Fig. The code for blinking LED is listed below: int ledPin = 13. Duemilanove users can just plugand-play after installing the drivers. when the sketch starts void setup() an output: pinMode(ledPin. wait for a second digitalWrite(ledPin. Start the IDE and go to Arduino source code contains the following sections: 1. Other user-defined functions. w w w. 2: The Arduino hardware { digitalWrite(ledPin. Extract it. you will require an FTDI cable (serial-to-USB) if you do not have a COM port in your computer. In any program. the first line sets an integer variable with the value of the pin at which we have connected the LED. Mac and Linux. You can connect an AC-DC adaptor (~12V. HIGH). which runs only once (automatically) when the program starts running. touchscreens and sensors for input. The Arduino can be programmed from Windows. The board can take up to 25V DC. OUTPUT). e f y m Ag . Let’s get our hands wet Here. with centre pin positive). Coming back to the LED blinking example. // LED connected to digital pin 13 // The setup() method runs once. 2. hence pinMode’s second argument would be output. } // the loop() method runs over and over again. set the LED on delay(1000). the program ‘Blink’ is used to explain. 3. The digital input/output (I/O) pins are where you can connect output devices like motors. The loop(). Any extra libraries used will have to be imported using the ‘import’ statement before the setup(). set the LED off delay(1000). which is an infinite loop that is triggered once setup() completes. Also. Download the Arduino IDE from the website and install it in your system if you haven’t already done so. LCDs. 2. 3: Connecting the LED external power is an option). The processor—ATmega—is the brain of the entire operation. The ‘pinMode’ function tells the ATmega whether the pin 13 (‘ledPin’ variable’s value) has an input or an output device connected to it. the setup() and loop() are source File→Examples→Digital→Blink.

The bootloader on the ATmega kickstarts your loaded program. co m 1 0 4 • Au g u s t 2 0 1 1 • e l e c t ro n i c s f o r yo u .feemo. It can interface with XBee (wireless) and bluetooth modules too. references and links are below:  www. make a program that dims the LED if the LDR is subjected to less light. etc. The resources.arduino. that you could mashup and combine sensors to come up with interesting new (The Arduino Homepage)  www. 4: The Arduino IDE able to help you out if you run into any issues—Open Source Community! People have used this in (Feemo)  www. Examples of what people have done include making an unmanned aerial vehicle (UAV) and weather stations.rhydolabz. After compilation. The possibilities are immense. This turns the LED source Now we come to the loop(). gyroscopes. Connect an LED to the board as shown in Fig. Press File→Upload To I/O Board (or CTRL+U).arduino. hobby projects and new media applications. You can now experiment with various sensors like the light dependent resistor (LDR) and say. The first line in loop(). accelerometers. and again (line 4) waits for a second. though we did not use any input. stepper motors. All of this with an easy to use IDE and programming pattern. 3. After that the ‘low’ argument (line 3) turns off the current and voltage on the ledPin. The Arduino can control servo motors. Then it gives a delay of 1000 milliseconds.  The author is associated with the National Institute of Design w w w. Once the code is written.guilhermemartins. humidity sensors. The (Paperduino—make Arduino on a cardboard) ture sensors. e f y m Ag .cc/en/Main/StandaloneAssembly (Breadboard Arduino)  http://lab. and vice versa. hit the ‘Play’ button (or CTRL+R) to compile it. tempera- Related stuff and resources Arduino has a large community and good support and documentation available on the internet. LCD screens. ‘digitalWrite’ sends voltage and current to the ledPin (pin 13) using the ‘high’ argument (‘high’ means ‘on’). taking it forward The example is a simple demonstration of physical computing. The limit is purely your imagination. What’s more is. The programmer section handles the burning of code into the ATmega chip. GPS modules. aeromodeling. Lots of interesting combinations of sensors and outputs. These four lines will run infinitely. Connect the positive of the LED (the longer leg) to digital pin 13 of ATmega chip and the other leg to the GND digital pin. This means that the LED remains on for 1000 milliseconds or 1 second. the generated hex file has to be uploaded to the ATmega. actions and reactions and a whole gamut of interactive devices can be built. Even a basic touchscreen (from the Nintendo DS) can be used for interaction. The result is a blinking LED. It can take inputs from pressure sensors. The screen is available readily and is cheap at close to Rs (rhydoLABZ)  http://www. etc. documentation and forums are avail- Fig.

Sign up to vote on this title
UsefulNot useful