ariejan de vroom

Getting started with Arduino

27 August 2012

I’m a software engineer. I don’t do hardware.

Well, that used to be the case. I did build some PC’s back in the day, but that’s where my involvement with electronics hardware ended. That’s all changed after I purchased an Arduino.

Arduino

Arduino is an easy to use hardare and software platform for designers, developers and tinkerers. What?

Well, Arduino is more than just a small piece of electronics hardware. It does include hardware. This is the Arduino Uno, the latest incarnation and the board you’ll most likely purchase if you want to break into the world of Arduino

The Arduino Uno

This Arduino has some nice features you should know about. At its core it has the Atmel Atmega328 chip. It has 32Kb of flashmemory and usually runs at 16MHz. Now this may not sound like much, but note that this is not like your average Intel Core i7 processor. This chip does several things for you, but the most important part is that you can program it to interact with the outside word through its 14 I/O pins. It gets its power over USB or from a battery that can supply 7-12V.

As I said earlier, Arduino is more than just the hardware board. It also contains software. Software on the Atmega328 chip, called the bootloader, allows you to easily interact with the Arduino from your computer. Then there is the Arduino IDE, which you can install on Mac, Linux and Windows. This is the tool you write your code with and which allows you to upload that code to the Arduino.

Now the great part is that both the hardware designs and the software are open-source. This means that you’re free to buy all the separate components for an Arduino board and solder one yourself . You may even sell it if you like. The only catch is that you can’t use the name Arduino.

An example

The most basic thing you can do with Arduino is hook up a LED and resistor and make the LED blink.

This is what that would look like if you’d build it:

Arduino Blink Setup

This is the electrical schematic for this setup. It’s very straight forward, as you can see, but enough to get you started. Even if you don’t yet know how LED’s work or what a resistor does, you can make this easily enough.

Note: if you do want to build this, I recommend you check out the Blink tutorial and buy an Arduino Starter Kit, which includes all the components to get started.

For those a bit tech-savvy, here’s the electrical schematic for the Blink tutorial. I’m not going to explain it in to detail, but note that the led and resistor are connected to D13 or pin 13 on the Arduino.

Arduino Blink Schematic

With the following, relatively simple code, you can make that LED blink.

int led = 13; // This refers to pin 13.

// setup() is run once during start-up
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
}

After making this first step you’ll get to know more components and features of Arduino. You’ll start using sensors (buttons, light sensors, sound sensors, GPS, magnetometers, gas sensors) and you’ll start using actuators (motors, steppers, relais, LED matrixes). The possibilities are endless.

The next step

The great thing about Arduino is that it’s designed to be easy to use. But is also offers great possibilities.

For one, the Arduino Uno has only got 14 digital and 6 analog I/O pins. When you start using more other components you’ll run out of I/O pins quickly. Enter the Arduino Mega which sports 54 digital and 16 analog I/O pins. Need something smaller: Arduino Nano, Need something to integrate into clothing: Arduino Lilypad. Need something custom: it’s frickin’ open-source, so design your own PCB, add the Arduino components you need and you’re good to go.

The things that are being doing with Arduino are amazing. The most important thing is that it makes electronics tinkering available to more people. It’s pretty cheap to get started and learn about electronics. Then there are hundreds (if not more) possibilities to use Arduino, ranging for fancy LED matrix animations to the full-grown Lawn Bot 400:

Lawn Bot 400

What’s got all this to do with Ariejan.net?

Of course, I’m a Rails web developer, but Arduino has sparked my interest.

Over at Kabisa we’ve already done a small side-project using Arduino to scan and log RFID-tags - we’ll be deploying this at a Rails conference later this year (and we’ll be using it to give away some awesome prizes).

In the scarce spare-time I have I’m planning on going beyond the blinking LED and build a 4WD Robot. I’ll post my progress here at Ariejan.net. Keep an eye on the Arduino section for updates.

It’ll take me some months to get my robot driving and doing the stuff I want it to do. But my dream project is building a Quadcopter.

What about you?

You are still reading this? And you didn’t get started with Arduino yet? Come on, find your local Arduino distributor or head over http://arduino.cc and get one. Start doing the tutorials and be ready to be pulled into the world of tinkering and hobby electronics. It’s fun!

Images have been taken from arduino.cc with not so much permission.