10 November 2010 ~ 0 Comments

What is Arduino?

Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It’s intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments.

Arduino can sense the environment by receiving input from a variety of sensors and can affect its surroundings by controlling lights, motors, and other actuators. The microcontroller on the board is programmed using the Arduino programming language (based on Wiring) and the Arduino development environment (based on Processing). Arduino projects can be stand-alone or they can communicate with software on running on a computer (e.g. Flash, Processing, MaxMSP). [source arduino.cc]

NOTE: One point of confusion for beginning Arduino users is the use of the word “Arduino” and what it refers to. It can actually refer to the language you write in, the environment you type that code into and the physical board itself. So when someone says they used Arduino to do something, they are probably referring to the whole process, not just one part of it.

Read more starting on page 91 of Programming Interactivity

Overview of the Arduino system

We can think of the Arduino system as consisting of three fundamental components: a programming language that allows you to control the behavior and state of the microcontroller, a software environment to type that code into and a hardware platform which you send your code onto. See the following diagram:

The Arduino Programming Language

There is a reason we started this class off with Processing, because the Arduino programming language is based on Processing syntax! Which means, if you know the basics of how Processing sketches are created, you also know the basics of how to make an Arduino sketch!

In both Arduino and Processing, you have a function called setup(), which runs one time when you apply power to your Arduino board. But now, instead of using draw(), you have to use a function called loop(), but it does the same thing.

Just like for Processing, the Arduino website has really awesome documentation: http://arduino.cc/en/Reference/HomePage

Read more starting on page 105 of Programming Interactivity

The Arduino Software Environment

Again, this should part of the Arduino should be very familiar to you, because it is based on Processing. The key difference is that now when you hit the Play button, instead of a window popping up, your program is compiled (turned into very, very low-level code that the Arduino’s microcontroller can understand). The process of compilation will alert you to any errors in your code, so you should use it to check your work as you go.

You can learn a lot of cool stuff at the Arduino site: http://arduino.cc/en/Guide/Environment

Under the Tools menu you will find several important differences that you will need to be aware of:

  • The Tools > Board menu will let you choose the type of Arduino board you will be sending your code onto – older boards have different quirks that the Arduino software environment needs to account for.
  • The Tools > Serial Port menu will let you select the serial port that your Arduino is connected to.
  • The Tools > Serial Monitor tool displays messages that are coming from your Arduino board back to your computer (using the selected serial port). Anytime you print a message in your Arduino code, that message will show up in the Serial Monitor
Read more starting on page 102 of Programming Interactivity

The Arduino Hardware Platform

Finally we come to the coolest part of the Arduino system, the physical board itself. Next class period we will talk a lot more about what is actually on this board and what you do with it, but for now we just need to talk about the basics.

On the board is a large black rectangle with some letters etched into it. The little guy is the brain of the board, and is similar to the CPU inside of your computer. It’s called a microcontroller and it is manufactured to contain lots of neat features, which the rest of the parts on the board support and implement.

For example, the specific microcontroller that the Arduino uses is an ATMega328, which includes USB functionality and is able to store a small amount of programming code for you. There are actual parts on the Arduino board that handle the “in-between” work for you.

Much more information about the hardware platform can be found at: http://arduino.cc/en/Main/ArduinoBoardUno

What’s important to know at this point is that you can write code using the Arduino software environment, then send that code onto your physical board and let it run. I know, its pretty cool.

Read more starting on page 97 of Programming Interactivity

Install the Arduino software

First things first you need to download and install the Arduino programming environment. Head on over to the Download section of the Arduino website and download the software for your platform.

Now extract the contents of this zip file to the location of your choice and click on Arduino.exe – if no errors pop up you’re good to go!

Next you need to make sure the Arduino board is recognized by your computer. Plug it in using the USB cable and make sure it detects and installs the new device.

NOTE: If you are using an older Arduino board (like a Freeduino from our lab) you may have to manually install FTDI drivers to get your board to work. You can find the FTDI drivers you need here.

Make sure everything is set up correctly

How do you know if everything is installed and set up correctly? Well once you’ve got the Arduino software installed (and drivers if necessary), open up Arduino.exe and load a simple example sketch.

Go to File > Examples > Digital > Blink

Now you need to upload this sketch to your Arduino board – so plug in your Arduino and let your computer detect it. In order to successfully upload your sketch to your board, you have to make sure that the Arduino IDE is configured to use the correct serial port.

To do this go to the Tools > Serial Port and make sure that a serial port is selected ( COM[#] ). You may also want to check the Tools > Board menu and make sure your board type is selected (Freeduinos are compatible with Duemilanove 328).

Now hit the Upload button and take a look at your board. If everything is communicating correctly you should start seeing two LEDs on your board flash like crazy for a couple seconds, then stop – the IDE’s console should say “Done uploading”.

For the Blink sketch an LED connected to pin 13 is being turned on and off continuously, and the Arduino board has an LED for this exact purpose directly on the board, so you should see an LED on the board now turning on and off over and over.

What you can do with Arduino

Build your own laser harp
Make a lo-fi guitar effect pedal
Trigger your camera’s flash for high-speed photography
Build a modular musical step sequencer
Detect seismic activity

Tags:

Leave a Reply