There's an Arduino for that!
Written by Harry Fairhead   
Article Index
There's an Arduino for that!
Hello World of Arduino

The Arduino is an ideal way to delve into the realm of embedded programming. Here's a fun introduction to the basics that will get you started without fear of creating any burning electronic components.

 

Programming is a powerful tool but many programmers miss the simple fact that with the right hardware you can do almost anything with a program - create a radio, a phone, a dishwasher, a refrigerator, a toaster...  You get the idea. Add a programmable core to almost any machine you can name and you can often make the physical machine much simpler and you can always make if more flexible. Of course this takes us into the world of "embedded" programming and as such a black art to many programmers who think that electronics is the work of the devil.

In fact electronics is just program design using hardware implemented logic and with a few simple extra rules to make sure that you don't destroy a component or put any humans in danger (only when working with high voltages) then its just programming.

The problem is always how to get started. The professional world of embedded design uses custom electronics and custom printed circuit boards which are eventually manufactured by the thousands if not millions. This is not the place to start. There are a wide range of off the shelf development boards that support different processors and offer different capabilities.

However, at the moment one stands out as being different. The Arduino is an open source hardware development and it is programmed in a nice friendly language that looks like almost any modern block structured language. For most uses the fact that the Arduino is open source will be fairly irrelevant in practice as you aren't likely to want to engineer your own hardware or software using it. What it does mean however is that there are multiple sources for the hardware and there is a thriving community turning out software, projects and so on to keep it all going.

There are also a lot of add-on boards or "shields" that you can buy to turn the basic Arduino into anything from a motor controller to a web server. The majority of these are also very reasonably priced.

So while Arduino isn't the only development system in town it has a lot going for it.

Using the Arduino UNO

In this article we are going to use an Arduino UNO board which is the latest design. It is compatible with the previous best selling version and a lot easier to say (for non-Italian speakers at least) than the Duemilanove board.

It costs around $30 and you can buy it from a range of companies. Notice that all you get is the circuit board with the electronics mounted on it. It is all ready to go the only extra you will need is a USB A to B cable - but you can probably find one connecting a printer that you can use on a temporary basis.

Although the UNO has a socket for a power adaptor you don't need to worry about this initially as it runs perfectly well from the USB connection. It also has lots of different inputs and outputs and at some point in the future you will want to connect to these. In other words, you will need some additional electronics - wires, LEDs, relays, transistors and so on. You can buy Arduino experimenters kits that are designed to get you started but for the moment just get hold of an Arduino UNO and a USB A to B cable - this is all the hardware you need for your first program.

What about software?

Well the good news is that there is a complete development environment based on Processing and a language based on Wiring.

The only downside is that they use some strange terminology - such as a program being a sketch and a folder containing programs is a sketchbook. Don't worry what we have is a perfectly standard IDE and programming language.

Installation

To get started you first have to download the software http://arduino.cc/. Next you simply unzip it to a suitable location - it doesn't really matter where as long as you can find it.

The next step is to get the drivers installed. The official documentation makes this sound hard and it has to be admitted that there are lots of variations on a step-by-step installation of the drivers. All you really need to know is that the Arduino Uno communicates via an interface that looks like a USB COM port. So the most direct way is to install the driver manually. Plug in the Arduino UNO and then use the manual installation route to select a the folder where you stored the Arduino software and select Arduino UNO in the drivers sub-folder. Also ignore warnings about the driver being signed etc. When the driver is finished installing you can use the Device Manager to view the Ports section where you will see a new serial port called Arduino UNO - take note of the port number (COM 3 in this case) you will need it later.

 

ports

 

Next you can start up the Ardinuo software. Simply click on the Arduino icon - or drag it out to the desktop to create a short cut and click on that. The software doesn't need any sort of installation - just unzipping it does the job. 

arduino

To make the IDE work with the Arduino hardware you have connected there are two simple configuration tasks. The first is to select the menu options:

Tools, Board, Arduino Uno

this tells the IDE the type of board you are using. Next select:

Tools,Serial Port, COM3

or whatever port the Arduino is connected to.

 

Now we are ready to write our first Arduino program.

 

<ASIN:B0046ANZ9S@UK>

<ASIN:B004CG4CN4@COM>

<ASIN:0596802471>

<ASIN:1430231831>

<ASIN:0596155514>



Last Updated ( Monday, 12 September 2011 )
 
 

   
RSS feed of all content
I Programmer - full contents
Copyright © 2014 i-programmer.info. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.