Arduino is a rapid electronic prototyping platform composed by the Arduino board and the Arduino IDE.
So, let’s have a look at it!
- It is an open-source project, software/hardware is extremely accessible and very flexible to be customized and extended
- It is flexible, offers a variety of digital and analog inputs, SPI and serial interface and digital and PWM outputs
- It is easy to use, connects to computer via USB and communicates using standard serial protocol, runs in standalone mode and as interface connected to PC/Macintosh computers
- It is inexpensive, around 30 euro per board and comes with free authoring software
- Arduino is backed up by a growing online community, lots of source code is already available and we can share and post our examples for others to use, too!
I should also note that most of the developers of Arduino are based in Ivrea, just 40 minutes from Torino where we are located: contacting, networking and collaborate with them in the future should be pretty easy.
What can we do with Arduino ?
Arduino is a great tool for developing interactive objects, taking inputs from a variety of switches or sensors and controlling a variety of lights, motors and other outputs. Arduino projects can be stand-alone or they can be connected to a computer using USB. The Arduino will be seen by the computer as a standard serial interface (do you remember the COM1 on Windows?). There are serial communication APIs on most programming languages so interfacing Arduino with a software program running on the computer should be pretty straightforward.
The Arduino board is a microcontroller board, which is a small circuit (the board) that contains a whole computer on a small chip (the microcontroller). There are different versions of the Arduino board: they are different in components, aim and size, etc. Some examples of Arduino boards are: Arduino Diecimila, Arduino Duemilanove, Freeduino, Arduino NG and lot more. Arduino schematics are distribute using an open licese so anyone is free to build his own Arduino compatible board. The Arduino name is a registered trademark so you won’t be able to call your hacked board Arduino.
My university provided me with an Arduino Duemilanove board which is, according to the Arduino developers, the simplest one to use and the best one for learning on.
Arduino Duemilanove connectors: interfacing Arduino with the world
A key aspect of the Arduino board is the amount of connectors available. These are the components which permit wiring the Arduino boards to other components (sensors, resistors, buttons, etc..) so that it can interact with them: reading, writing, moving, etc.
As you can see from the picture above, an Arduino Duemilanove board has the following connectors (listed clockwise starting from the top left ):AREF: Analog Reference PinThe voltage at this pin determines the voltage at which the analog to digital converters (ADC’s) will report the decimal value 1023, which is their highest level output. This means that using this pin you’ll be able to change the maximum value readable by the Analog In pins: this is a way to change the scale of the analog in pins.The AREF pin is, by default, connected to the AVCC voltage of around 5 volts (unless you are running your Arduino at a lower voltage).GND: Digital GroundUsed as Ground for Digital inputs/outputs.DIGITAL 0-13: Digital PinsUsed for digital I/O. Digital pins have different usages:TX/RX Pins 0-1: Serial In/OutThis pins can be used for digital I/O just like DIGITAL pins 2-13 but they can’t be used if Serial communication is used. If your project use Serial communication you might want to use those for Serial communication instead of using the USB to serial interface. This can came handy while using the serial interface to interact with a non PC device (eg another Arduino or a Robot Controller)External Interrupts Pins 2-3This pins can be configured to trigger an interrupt on different input conditions. I still did not experienced using this pins but more informations are available on the the attachInterrupt() function reference.PWM Pins 3, 5, 6, 9, 10, and 11Provide 8-bit PWM output with the analogWrite() function.LED: 13There is a built-in LED connected to digital pin 13. When the pin is HIGH value, the LED is on, when the pin is LOW, it’s off.ICSP: In-circuit Serial ProgrammerArduino comes with a bootloader which enable program uploading trhough the USB to serial interface. Advanced users can also directly upload programs to the Arduino board using an external programmer. This is done using the ICSP header. This might be cool because by doing so you save the ~ 2KB of memory used for the uploading sketches logic. Anyway I don’t plan to use this feature right now. More informations here.ANALOG IN 0-5: Analog input pins
Used to read from an analog source (eg potentiometer or a pression sensor)POWER PinsUsed to get or provide power to the Arduino boardVin:when using an External Power Supply (see External Power Supply In), this provide the same current which is arriving from the power supply. It’s also possible to provide voltage trough this pin.Gnd (2 Pins):Used as ground pins for your projects.
Actually, while searching for the differences between digital ground and the other 2 Ground pins (See Power below), I found a forum posts which says that all 3 ground pins on the Arduino board are actually connected togheter thus the digital ground pin and the 2 ground pins under the power section are actually the same. I didn’t checked on the Arduino Duemilanove internal design on this though.5V:This is used to get 5V power from the board. This is the same current that powers the microcontroller. This can came either from Vin (External Power Supply In) or from the USB.3V3:A 3.3V power supply which is generated from the FTDI chip. The maximum current draw is 50mA. While reading on the forum it seems that the FTDI chip is pretty a delicate component which can easily burns if subjected to shorts or to much current draws. General consensum is to avoid using this pin power source.RESET:By bringing this line to LOW it’s possible to reset the board: there is also a button for doing so on the board but, as additional shields (eg Ethernet Shield) might make the button unreachable, this can be used for resetting the board.External Power Supply In:With this we can connect an external power supply to Arduino. A 2.1mm center-positive plug connected to a battery or an AC-to-DC adapter. The current range can be 6 to 20 volts but, in order to prevent overheating and stability problems, the recommended range is 7 to 12 volts.USB:Used for uploading sketches (Arduino binary programs) to the board and for serial communication between the board and the computer. Arduino can be powered from the USB port.
The Arduino Board itself is pretty useless unless we plug it to various other electrical components. Usually, coupled with an Arduino board, shops also sell Arduino KITs which contains lot of useful components for developing circuits with Arduino.
My University provided me with an Arduino Base Workshop KIT which contains:
- 1 x Arduino Duemilanove Board
- 1 x USB cable
- 1 x Straight single line pinhead connectors 2,54 40×1
- 5 x 10K Ohm Resistors 1/4W (brown, black, orange, gold)
- 5 2.2K Ohm Resistor 1/4 W (red, red, red, gold)
- 10 x 220 Ohm Resistors 1/4W (red, red, brown, gold)
- 5 x 330K Ohm Resistors 1/4W (orange, orange, yellow, gold)
- 5 x 100nF capacitor polyester
- 5 x 10nF capacitor polyester
- 3 x 100uF electrolytic capacitor 25Vdc
- 1 x 4,7K Ohm Thermistor
- 1 x 10..40K Ohm LDR VT90N2
- 3 x 5mm RED LED
- 1 x 5mm GREEN LED
- 1 x 5mm YELLOW LED
- 1 x 10Kohm linear potentiometer, pcb terminals
- 2 x BC547 Transistor in TO92 Package
- 1 x Piezo buzzer
- 5 x PCB Pushbutton, 12x12mm size
- 2 x 4N35 Optocoupler DIL-6 package
- 1 x Set of 70 breadboard jumper wires
- 1 x Breadboard, 840 tie points
- 2 x Tilt sensor
- 1 x Diode 1n4007
- 1 x MOS Irf540
Being quite unexperienced with electronic components, at the beginning, I had some problems identifying all these components. It took some reading and time to identify all of them.
Anyway I finally did it and here it is a picture of the whole kit with the corrispondent number (see the list above).
The other component of the Arduino platform is the Arduino IDE. This contains all the software which will run a computer in order to program and communicate with an Arduino board.
The Arduino IDE contains an editor which we can use to write sketches (that’s the name of Arduino programs) in a simple programming language modeled after the Processing language.
Using the IDE the program we wrote is converted to C language and then compiled using avr-gcc. This process produce binary code wich the microcontroller on the Arduino board will be able to understand and execute.
When the Arduino board is connected to a computer using the USB cable, by using the IDE we are able to compile and upload to the board the program.
Arduino and Linux
My Archlinux system had no problems in seeing the Arduino board. Once I connect it to my PC a new Linux device called /dev/ttyUSB0 is created. This is done thanks to the usbserial and ftdi_sio Linux kernel modules.
If you have other devices connected using USB which actually uses serial communication (eg a 3G UMTS USB dongle) you should carefully check the device name that your arduino gets (you can use dmesg for this). Other USB devices will also get a /dev/ttyUSBX device so your arduino might end up using a different device name (eg /dev/ttyUSB5) if /dev/USB0 is not available (use dmesg after plugging Arduino in to check how Arduino is being named). In this case you might want writing a udev rule so that the Arduino board always ends up called with the same name. I’ll plan to do this soon, so keep an eye on this pages.
It took me some time, but I now know the basics of the Arduino board. Some of the concepts are still pretty foggy to me but I have time to document myself more.
OK! I think we have enough informations to start writing our first Arduino program!
- Getting Started With Arduino by Massimo Banzi
- Envision Art 01: the responsive screen: Arduino Workshop – Prof. Fabian Winkler
- Arduino Duemilanove specs at arduino.cc
UPDATE 2011-11-06: Comments to this article have been disabled due to massive spamming. If you have comments or questions get in touch with me directly.