open source 100 • August 2011 • electronics for you www.efymAg.com Siddharth Mankad Open Source Physical Computing for Beginners Pyscl compug s os mg s sous. Eee auo plfom—plfom fopyscl compug foe beges Ws e auo plfom? Arduino (pronounced as aar-do-we- know) platform is a small and efcient AVR development board for hobbyists. It has been developed by Massimo Banzi and the Arduino team. AVR is the series of 8-bit RISC microcon- trollers based on a modied Harvard microcontroller architecture. The chips used on the Arduino board include the ATmega AVR family—ATmega8, ATmega168, ATmega328 and the AT- mega1280. Since the Arduino platform is Open Source, there have been many clones, and many of these clon es use other processors too apart from the ones listed above. The Arduino board comes in many sizes for a varied num- ber of applications, the most common being the Arduino Duemilanove. The Diecimila is the older version of the Duemilanove. Other form factors in- clude 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 us- ers), Arduino Pro mini, Arduino Fio and Arduino BT (for wireless applica- tions; 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. te fumels The rst 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 ofcial Arduino site with the schematic. It is fairly easy to assemble. The Arduino board with se- rial COM port requires power (unlike the Duemilanove where J ust like chef Gusteau said in the movie Ratatouille, “Anyone can cook!” we could say, “Anyone can prototype!” Let’s begin by simpli- fying the term physical computing. It denitely sounds too techie to a new- bie. According to Wikipedia, physi- cal 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 de- vices that use sensors as input and per- form some action (physical or virtual) as output. Fig. 1: The Arduino board
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
104 • August 2011 • electronics for you w w w . e f y m A g . c o m
Related stuff and resources
Arduino has a large community and good support and documentation available on theinternet. The resources, references and links are below: www.arduino.cc (The Arduino Homepage) www.feemo.in (Feemo) www.rhydolabz.com (rhydoLABZ) http://www.arduino.cc/en/Main/StandaloneAssembly (Breadboard Arduino) http://lab.guilhermemartins.net/2009/05/06/paperduino-prints/ (Paperduino—make
Arduino on a cardboard)
Fig. 4: The Arduino IDE
Now we come to the loop(). The
rst line in loop(), ‘digitalWrite’ sends
voltage and current to the ledPin (pin
13) using the ‘high’ argument (‘high’
means ‘on’). This turns the LED on.
Then it gives a delay of 1000 millisec-
onds. This means that the LED remainson for 1000 milliseconds or 1 second.
After that the ‘low’ argument (line 3)
turns off the current and voltage on
the ledPin, and again (line 4) waits
for a second. These four lines will run
innitely.
Connect an LED to the board as
shown in Fig. 3. 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.
Once the code is written, hit the
‘Play’ button (or CTRL+R) to compile
it. After compilation, the generated hex
le has to be uploaded to the ATmega.
Press File→Upload To I/O Board (or
CTRL+U). The programmer section
handles the burning of code into the
ATmega chip. The bootloader on the
ATmega kickstarts your loaded pro-
gram. The result is a blinking LED.
tg fow
The example is a simple demonstration
of physical computing, though we did
not use any input. You can now ex-
periment with various sensors like the
light dependent resistor (LDR) and say,
make a program that dims the LED if
the LDR is subjected to less light, and
vice versa.
Lots of interesting combinations of
sensors and outputs, actions and reac-
tions and a whole gamut of interactive
devices can be built. The references,
documentation and forums are avail-
able to help you out if you run into
any issues—Open Source Community!
People have used this in robotics, aero-
modeling, hobby projects and new
media applications. The Arduino can
control servo motors, stepper motors,
LCD screens, etc. It can take inputs
from pressure sensors, accelerometers,
GPS modules, gyroscopes, tempera-
ture sensors, humidity sensors, etc. It
can interface with XBee (wireless) and
bluetooth modules too. Even a basic
touchscreen (from the Nintendo DS)
can be used for interaction. The screen
is available readily and is cheap at
close to Rs 700.
The possibilities are immense.
What’s more is, that you could mash-
up and combine sensors to come up
with interesting new possibilities. All
of this with an easy to use IDE and
programming pattern. Examples of
what people have done include mak-
ing an unmanned aerial vehicle (UAV)
and weather stations. The limit is
purely your imagination.
The author is associated with the National Instituteof Design