ARDU: Physical Computing with Arduino – An Introduction

Filed in AVR , Articles , CEShop 14 comments

Article by: Asad Memon, FAST-NU

What is physical computing?

Physical computing is very similar to computing but you are not bounded within the hardware provided to you i.e. keyboard, monitor, mice etc.

Physical computing means building a physical system that uses both software and hardware to sense and interact with the real world. It is like building your own gadget that works how you want it to work. It can be a simple continuously blinking light or a line following robot or making a MP3 player or a complete and independent web server!

What is Arduino?

“Arduino is a tool for making computers that can sense and control more of the physical world than your desktop computer. It’s an open-source physical computing platform based on a simple microcontroller board, and a development environment for writing software for the board.
Arduino can be used to develop interactive objects, taking inputs from a variety of switches or sensors, and controlling a variety of lights, motors, and other physical outputs. ”

– [Source: www.arduino.cc ]

Arduino with pins and components labeled.

How to get one?

You have two options; either make your own Arduino or order one. I chose to to solder my own because I could not find a vendor for Pakistan at that time, but now Creative Electron Shop is selling Arduino Duemilanove for a good price.

If you opt to make your own board, check the resource at the end of article.

Getting started

Without going into much details, let us see how Arduino works. Arduino is like a computer on which you can plug different sensors and devices and then download the code on the Arduino from your desktop computer. The code you write will decide how the device you connected should be controlled. For example, if you want an LED to blink after each second, you can do that by connecting the LED in one of the digital pins on Arduino and writing the code in the IDE provided by the Arduino website. The code for this scenario will be:

int ledPin = 13;                // LED connected to digital pin 13
void setup()                    // run once, when the arduino starts
{
pinMode(ledPin, OUTPUT);      // sets the digital pin as output
}
void loop()                     // this run over and over again
{
digitalWrite(ledPin, HIGH);   // sets the LED on
delay(1000);                  // waits for a second (1000 ms)
digitalWrite(ledPin, LOW);    // sets the LED off
delay(1000);                  // waits for a second
}

As you can see, programming the Arduino is really easy if you are familiar with the C/C++ language. After you download this code to your Arduino (through parallel, serial or USB ports), you will see that the LED at pin13 will start blinking at an interval of one second.

That’s it for now

My aim with this article was to familiarize you with Arduino, as it is widely being used by hobbyists and students worldwide to get started with physical computing. I have put up some useful tutorials on my Robotronics webpage (including a tutorial on how to solder an Arduino youself). Good Luck and happy hacking ;)

Resources

Robotronics: www.therobotronics.co.nr
Arduino homepage: www.arduino.cc
Buy Arduino at CEShop: www.creativeelectron.net/shop

Posted by hamzaazeem   @   5 July 2010 14 comments
Tags : , , ,

Share This Post

RSS Digg Twitter StumbleUpon Delicious Technorati

14 Comments

  • @Saad:
    Yes atmega is really hard to find around here but try your luck at Axis Electronics in Saddar, Karachi (wwww.axiselectronic.com). I bought some for myself from them. Do update here if they have/don't have the chips.
  • Hey thanks for the reply Asad I did get the atmega168 them though not from axis electronics but from sigma, went to axis a few weeks asked about it they only had atmega8's kept on telling me that 168 will be coming in soon. Got them around a month back.
  • Thanks for the love guys... Hope that this article will help the locals a bit in getting hold of latest electronic prototyping methods used around the world.
  • Saad
    Good article, nice to see that people in pakistan are also using this platform since the whole world is using it. I want to make my own, i got all the parts for the build except i couldn't find the brain of the project the atmega328 or 168 in the market, could you guide me to obtaining the microcontroller so i could finally start working on it. Thanks
  • Hitman_4770
    you can obtain from lahore hall road
  • The comments system seems buggy, I got an email yesterday saying that there is a reply to my comment, here it says 2 months back. Thanks though Hitman already got them btw I'm from Karachi.
  • Faizan Kazi
    well, from experience, how many unique PWM signals do you think you can handle? this obviously depends on processor speed and PWM values and/or available timers...

    suppose you have 4 PWM signals.. 25%, 35%, 100%, 80%
    suppose you just set the leading edge of the 80% signal High and the others have already been set high, you have to set the 25% signal low first, so you have to calculate the time to that by calculating the time remaining, and then switching it low, and then re-doing calculations for the entire list of PWM signals on which needs to be turned on or off first and this is rather messy isnt it? i'm assuming that this is how it works...

    OR you have individual timers for each signal... COSTLY!

    honestly, can't wait for multithreadeding capable microcontrollers. multiple, timed threads, with interrupts are amazing.
  • Faizan Kazi
    thanks for the prompt reply!
    so if i may ask, how do you handle the interrupts for PWM? and how many interrupts/unique PWM signals can be processed "on average" with this development board and a microcontroller of your choice.
  • creativeelectron
    PWM is handled using timer interrupts. Or some microcontrollers have builtin PWM modules. Can you please explain what do you mean by "on average" ?
  • creativeelectron
    For RC Servos you need PWM signal which is a function of digital output. While if you are using high power motors you may need MOSFET-Transistor based drives for DC motors. Again they can be controlled via PWM for speed and position control.
  • nice! well written tutorial! it was very captivating.
    so we've got digital IO and analog input.
    what do you for servo and power motor control?
  • kumail
    Good intrduction
  • I found your post very interesting, I think you are a brilliant writer. I added your blog to my bookmarks and will return in the future. I want to encourage you to continue that marvelous work, have a great daytime!
blog comments powered by Disqus
Previous Post
«
Next Post
»
EXULT designed by ZENVERSE  |  In conjunction with Reseller Hosting from the #1 Web Hosting Provider - HostNexus.