Yet another introduction to Arduino

No DIY blog is complete without mentioning a word about Arduino – a small open source microcontroller prototyping board which born to revolutionize the embedded world.

Today, I’m trying to briefly introduce Arduino to complete beginner. I know you can find thousands of introductory articles about Arduino out there over the Internet. I really don’t want to add one more, but I’m planning to write more project specific posts about Arduino in future. So I don’t want my fellow readers go out of my blog for an introductory tutorial about Arduino before start reading my project specific posts.

A quick introduction to Arduino

Arduino

Arduino is a small electronic circuit similar to a computer which will work under your control. You can program it to do anything. You can automate your home, or can make a cute illumination system for your home, or can even make a robot. Applications are endless; Only thing you need is to get an Arduino and start play with it. You can find a few great Arduino projects here.

Things required

Latest Arduino board (I use UNO) – Here is the list of worldwide Arduino vendors.

USB cable (Type A male to Type B male – to connect it to a Computer)

Connecting wires, LEDs.

A computer (Windows, Linux or Mac) installed with latest free Arduino IDE.

 How Arduino Works?

Brain of Arduino is a microcontroller – Here ATMega328 in UNO. Microcontroller is an inexpensive electronic chip similar to Microprocessor in a Computer. So as in a computer, you can write your program to control microcontroller. So as simplest explanation, microcontroller is inexpensive version of Microprocessor. But working with a Microcontroller is also not too easy for a beginner.  A programmer circuit is required to interface a microcontroller to the computer. Here’s where Arduino comes to play. The only thing you need to do to start working in Arduino is power it up by connecting the Arduino to your computer with USB cable. Write your program and burn it into Arduino (means transfer the code to the microcontroller -it’s as simple as a mouse click), done. Your Arduino is then ready to work. There are a lot of boards like Arduino, but compared to other microcontroller boards, Arduino is much simpler to operate.

I hope you are ready with all components required.  Then we will go step by step.

Let’s begin

arduino_IDE

Install the latest Arduino IDE (Download it from here). Install means, just unzip the downloaded file and that’s it. You can find an executable named ‘Arduino’ in the unzipped directory. Just double clicking it will launch the Arduino IDE. Creating a shortcut of Arduino executable in your Desktop is a good practice, if you use it often.

Now you have to set up your IDE to work with your Arduino UNO. First select your hardware from Tools – Board – Arduino UNO (or your exact hardware name. If it is not listed, try to download the latest version).

arduino_11

Next, select your serial port from Tools – Serial Port. Serial port is a 9 pin port used to connect Modems in old computers. Now serial ports are almost disappeared in new computers. Here we use our USB port as a virtual serial port. So even if you are connecting your Arduino to a USB port, your computer will treat it as serial or COM device. Selecting serial port is in different way in different Operating systems.

Linux

If the ‘Serial Port’ menu (Tools->Serial Port) is not active, probably, your device is not connected properly. Try to reconnect. If more than one serial ports are shown in the menu, we need to find out which is the correct one. To do that, disconnect your arduino first. Then you probably need to restart the IDE. Then look at the ‘Serial Port’ menu and note down the listed COM ports. Then reconnect your device and track the newcomer. This is the easiest way.

Select proper serial port.

MS Windows

In Windows, just after connecting your device to the PC, a device driver wizard appears and try to find the appropriate device driver for the device. It will take a while and end up in a notification that, Windows failed install proper driver for the device.

arduino_1

Close the wizard and go to ‘Device Manger’ (Either via Control Panel or by right clicking ‘My Computer’ then ‘Manage’ and Choose ‘Device Manager’ from the left pane). Then you can find Aduino UNO as the unknown device.

arduino_2

Right click on that and choose the option to update driver software.

arduino_3

Then locate the directory where you have installed Arduino IDE.

arduino_5

Then the system install the driver and will notify you once installation is successfully completed.

arduino_7

Now you can see your device on the list named ‘Ports’ in the Device Manger. In parenthesis, there will be the respective COM port number (eg: COM 25) .

arduino_9

Then choose that COM port in the Arduino IDE(eg: Tools->Serial port -> COM25).

arduino_10

Start with ‘Hello World’

So we are starting our first and simplest experiment with Arduino. Make an LED ON and OFF continously for a second. There is an example in the IDE itself. Open the file from File – Examples – Basics – Blink

/*
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
}

Look at the program. For an average C programmer, the program seems self-explanatory. To compile your program, choose Sketch -> verify/compile. Then to upload the executable to your device, choose,File -> upload to I/O board (or click Upload button). The program simply tell the Arduino to turn ON and OFF the 13th terminal repeatedly. You can use simple digital load needed to be controlled by Arduino, say an LED (anode(+) on 13th terminal and cathode(-) on GND terminal. Use a 330Ohm Resistor to reduce excess current). But Arduino has a built in LED inside it already connected to pin 13. So for testing purpose, no problem even if you don’t connect an LED. This is very useful when you check whether your Arduino is faulty or not.

arduino_uno

If everything you have done is correct, you will get your Arduino programmed and starts working just after burning the program using the USB power. Disconnect it from USB and use in your standalone applications.

Finally you are done with your first Arduino Project.

Read more..

Getting started tutorial and Language Reference in Arduino Help menu is useful for beginners

Arduino Playground

ATMega328 Datasheet

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

4 thoughts on “Yet another introduction to Arduino

  1. Nice article.
    Can you help me to build a robot? Actually I dont know where to start. I am newbie in this area.

  2. മിസ്റ്റർ ടോം – കിടിലൻ ആർട്ടിക്കിൾ ! പറയാതെ വയ്യ. മലയാളത്തിൽ ഇതു വരെ എന്തുകൊണ്ട് ആർഡ്വിനോയെപ്പറ്റി ആരും എഴുതിയില്ലാ എന്നു വണ്ടറടിച്ചിരിക്കുകയായിരുന്നു ഞാൻ. തികച്ചും പ്രശംസനീയം. കൂടുതൽ പ്രോജക്റ്റുകളെപ്പറ്റി എഴുതാമോ ?

    1. Reply to MisterNiceGuy:
      നന്ദി സുഹൃത്തേ. കഴിഞ്ഞ കുറച്ചു മാസങ്ങളായി ബ്ലോഗെഴുത്തിൽനിന്നും വിട്ടുനിൽക്കുകയായിരുന്നു. ഇപ്പോൾ വീണ്ടും എഴുതിത്തുടങ്ങിയിട്ടുണ്ട്. കുറെ പോസ്റ്റുകൾ അണിയറയിൽ ഒരുങ്ങിക്കൊണ്ടിരിക്കുന്നുണ്ട്. താങ്കളെപ്പോലെയുള്ളവരുടെ വിലയേറിയ കമന്റുകളാണ്, പോസ്റ്റെഴുതുമ്പോൾ എനിക്ക് ഊർജം നൽകുന്നത്.

Leave a Reply

Your email address will not be published.


+ four = 10

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>