Imagine if you could forget about soldering the crystal and different resistors/capacitors and stop worrying about a serial connection to your computer before using a microcontroller in your next project! What if you had a simple way of doing this, like using the plug-and-play features of the USB.

Imagine a way of taking inputs from variety of things like switches and different types of sensors (light, temperature, etc.) and controlling the movements of motors, LEDs, or animating the physical world around you.

Introducing Arduino…(curtains raised)

 

Design By Numbers Processing Wiring Arduino
1999 2001 2003 2005
Massimo Banzi and David Cuartellis, founders of the Arduino project, named it after King Arduin of Ivrea, Italy. (Pronounced “Hardwin”) which means “strong friend”.Actually, Arduino owes its birth to Design By Number programming language created by John Maeda, at the MIT Media Lab. It allowed artists, designers and non-programmers to easily start computer programming.
Processingis a programming language and development environment that makes sophisticated animations and other graphical effects accessible to people with relatively little programming experience.” – John Maeda, MIT.However, two of his students, Casey Reas and Ben Fry took it even further by developing Processing, to teach computer programming in a visual context.
Next came Wiring, a programming language which allowed to control physical world objects attached to Wiring I/O electronic boards to create interactive objects, like, lighting up an LED when there is no light in the room.It was created by Hernando Barragán as a Master’s thesis at the Interaction Design Institute Ivrea under the supervision of Massimo Banzi and Casey Reas.
Arduinois the descendent of the open-source Wiring platform, designed to make the process of using electronics very easy and accessible to all disciplines.The hardware consists of an open source hardware design for the Arduino board with an Atmel’s microcontroller which can be programmed easily with a Processing-based IDE through a USB cable.
Fritzingis an open-source software environment for designers and artists to document their interactive prototypes and to take the step from physical prototyping to actual product (from Breadboard to Printed Circuit Board).It can be though of as an Electronic Design Automation (EDA) tool for non-engineers.

“Arduino was intended to be an electronics version of Processing that used our programming environment and was patterned after the Processing syntax. It was supervised by myself and Massimo Banzi, an Arduino founder. I don’t think Arduino would exist without Wiring and I don’t think Wiring would exist without Processing. And I know Processing would certainly not exist without Design By Numbers and John Maeda. etc. This is what is exciting to me – the iteration and growth of this community.” – Casey Reas, Rhizome.

At first, there was binary… Long strings of 1s and 0s… Then, assembly language was introduced to make the programmers life less miserable. It was also abstracted into High Level Languages such as BASIC, COBOL, FORTRAN, C, etc.

When electronics prototyping and tinkering reached the hands of common users (us!), there was a need to make the life of a tinkerer even simpler. This was the beginning of Open Source era and Do-It-Yourself (DIY). With the introduction of Processing and Wiring it was easy for a designer or an artist or even a non-programmer to adapt the simple look and feel of the IDE and start writing programs.

The use of Microcontroller in Hobby projects as well as commercial products is not new. It dates back to the era of 80s, the Intel 8051, Motorola 68000 and many more. Later, to BASIC Stamp and PIC, etc. All these had one common caveat to them; their programming.

Earlier, the code was written in assembly language in the Intel HEX format and then burnt onto the Microcontroller using a dedicated programmer board. This programmer board was connected to the computer using Parallel or Serial Port.

Then, it was made even more simpler with the introduction of C-based programming environments like the KEIL uVision compiler which was used to write code for a microcontroller in C language. Assembly was gone. The code written in C was compiled and converted to an Intel hex file and then burnt onto the Microcontroller. (How?) Well, the programmers had to be used still.

Then came Arduino which changed every programmer’s, hobbyist’s view towards electronics prototyping and programming. The programming language was as simple to write code on, as simple was the hardware and connection.

An Arduino board can be connected to a computer using USB cable and code written in the Arduino IDE can be uploaded (burnt) onto the board’s ATMega 328 IC without any hassle (again, the code is converted to Intel HEX file, but behind the scenes and uploaded).

Also, it is a complete development environment in itself. You don’t need anything else. It has got the power supply regulators built-in so that you could plug in the USB cable and forget worrying about any power issues. It has its I/O pins broken out onto female headers so that you could directly connect it with your breadboard without worrying a thing. Also, It has got the coolest feature of Serial Communication made easy using Object Oriented Programming so that you could interact visually with Processing. And finally, because of its open source-ness, Arduino has got the world’s largest community of programmers, designers behind it. Even its Eagle layout and schematic files are available for download (this is the beauty of Open Source).


The Makers of Arduino want you to start head-on with your prototype or the idea you have in your mind and not worry about how you will program the Arduino (actually, the ATMega 328 Microcontroller!). This brings the time to implement your idea way down.

Things you will need:

a.) Arduino Uno (The latest variant available)

b.) USB A to B Cable (Mostly used as Printer Cables)

Thats it!

Arduino Uno gets its power from the USB port of your computer (5V). You could also use a 9V battery or a combination of AA cells to power your Arduino through the barrel jack but it is not needed when you are seated near your computer and learning the basics.

The USB interface is provided for three reasons:

a.) It is easily available on all the computers, notebooks present today as compared to serial port.

b.) It powers the Arduino

c.) It sends the code from the computer to the Uno board.

The following instructions are written for Mac OS X Lion 10.7.4

a.) You need to download the Arduino IDE which can be found here. [Current version as of August 3, 2012 is Arduino 1.0.1]
For users other than the Mac, download the appropriate files: Windows, Linux (32-bit), Linux (64-bit).

b.) Connect USB cable to your Arduino Board. The “ON” LED should light up (above the reset button).
You will get the following dialog box with it:

Select (Network Preferences…) It will open up Network Preferences. Click (Apply) and quit Network Preferences.

c.) The .dmg file which you downloaded would open up as a new window. Drag the Arduino.app file to your Applications folder.


a.) Start the downloaded Arduino IDE (from your Applications folder). You will get an empty sketch with the name as the present date.
 

b.) Go to Tools -> Boards. Select “Arduino Uno” from the Menu Bar on the top.

c.) Go to Tools -> Serial Port. Select /dev/tty.usbmodem621 (or a similar number at the end depending on how many serial devices you have connected at present).

d.) To start off, go to File -> Examples -> 01.Basics -> Blink
It should open up a new sketch named Blink with the following code written in it:

/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.
 
  This example code is in the public domain.
 */
 
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;

// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);     
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
}

e.) Do not worry about the code. We will go through it step by step. First, lets verify if your Arduino board is working or not!

Select File -> Upload or press ⌘ + U or Click on the following button:
 

 
f.) The The Tx and Rx LEDs on the Arduino should blink indicating a successful upload of the ‘Blink’ code to the Board. After some time, LED at pin 13 (built into the Arduino board) will start blinking at the rate of 1 second. So, you have successfully uploaded a sketch to your Arduino Uno Board.
 

Now going back to the code. Lets break it down to understand it completely.

/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.
 
  This example code is in the public domain.
 */

Anything between a /* … */ is treated as a comment by the compiler, i.e., not compiled. It is for the reference of user only.
Also, Each line that has a // prefixed before it is also a comment (a single line comment).

int led = 13;

The LED on Pin 13 (L LED) on the Arduino Board will now be called as led.

void setup()                

Every sketch that you will make from now on will have a setup() function. It is like the init() function for a seasoned programmer for initializing some things before the actual start of the code.

  pinMode(led, OUTPUT);     

pinMode() is a function in which you tell the Arduino about a specified pin and what will be its behavior (Input/Output).

{...}

A curly bracket is used to specify the end of a function. Take a look at the start of void setup() function.

void loop()

Every microcontroller needs an endless loop to perform its function, not only Arduino. If it is not present, a microcontroller will do its work once and then stop. Any code written in this endless loop will start as soon as the microcontroller is turned on and will repeat itself infinitely until the power supply is cut off. The loop function does the exact same task.

  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)

As you can see in the comment, digitalWrite() function will set the pin 13 HIGH, i.e., Turn ON the LED

  delay(1000);               

The delay() function will stop any activity for the specified amount of time (in mili seconds). Here, 1000 ms = 1 second

  digitalWrite(led, LOW);    
  delay(1000);               

Again, the LED is turned OFF and then we wait for a second. Then, again we go back to the start of the loop() function and repeat the steps, i.e., Turn ON then OFF the LED.


The Arduino has taken the world of electronics and microcontrollers by a storm. Due to Open Source, many makers and DIYers are following it and the Arduino community has become one of the largest community of DIYers in the world. The Arduino hardware reference designs are distributed under a Creative Commons Attribution Share-Alike 2.5 license and are available on the Arduino Web site.

There are many different variants of the Arduino board available in the market with the ever increasing number of shields growing day by day.

Arduino is the best example of “Physical Computing” meaning interacting with the real world objects using software and hardware. Physical Computing is a subject taught in many universities across the world.

 
References

Getting Started with Arduino 3rd Release by Massimo Banzi
Arduino – Home Page
Technology Review, MIT
Interview with Casey Reas and Ben Fry

Creative Commons License

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.