Sunday, February 8, 2015

"HELLO WORLD" IN ARDUINO - LED BLINKING & WRITING / RUNNING YOUR FIRST PROGRAM

Hello & welcome to the first tutorial on ARDUINO.

This tutorial is focused on imparting basic ARDUINO knowledge to folks interested in beginning in embedded systems & robotics with the ARDUINO open-source hardware platform.

An open- source hardware platform such as arduino  is a great piece of technology to work with.
Its modules/ hardware plans/schematics as well as sample software projects are created under Creative Common License & thus it is accessible by everybody freely for their use.

Thus there has been seen a massive tsunami of Arduino boards/ shield/ many open source sensor & actuator units as well as Software projects compatible with arduino over the past few years.

Its easy to access also because its cross platform. I.e, same arduino can be programmed & used invariably on both mac OS/ linux / & Windows.



The very first post is on the "HELLO WORLD" in Arduino. The first arduino board we gonna talk about is deumilanove.

From www.arduino.cc, you can download the latest version of Arduino software deployment package. Install & open the Arduino IDE (which is a java based Integrated development environment.)

1) Basic View of the Arduino IDE.





































2) Before beginning programming with Arduino, Connect the Arduino board to your desktop & find the newly added device in the Device Manager.
Come back to Arduino & set the Board from the drop down menu, Select the Serial Port(COM Port) to which your Arduino is connected ,(find it from you MY COMPUTER->PROPERTIES->DEVICE MANAGER->COM PORT)



Select the Programmer as AVRISP mkII for onboard Programmer IC available

































Also we will cover Arduino as ISP in upcoming tutorials. It is the method used for programming an AVR on breadboard using Arduino as a burner. It can also be used for burning programs onto an Arduino AVR prototyping shield.

3)Write the following Basic Code in the Notepad & Save it in a new folder
Arduino Projects->Hello World->
void setup() {.....  } includes all the functions & initialization that remain Static During the
whole program Runtime. Eg. you only need to make a pin as input or output Once For a code.

void loop() {....... } includes all the functions & commands the keep running in Loop.
Eg. You can set the output pins "High"(logic 1) or "Low"(logic 0) anytime during the running of code. 











































Arduino is an advancement over the conventional Hierarchy of Microcontroller programming:

Hierarchy of micro-controller Programming For Freshers to Robotics & embedded:
bottom to top
Zeroth level : MACHINE LANGUAGE : As all codes are fundamentally to be converted to this level.
1)A higher level of abstraction was Intel 80xx uc programming using ASM codes
2) A higher level of abstraction was Intel 80xx uc programming using C & structured language codes.
3) A higher level of abstraction was AVR uc programming using C & ASM mixed language codes.
4) A higher level of abstraction was PIC uc programming using Mikro-C language of PIC.
5) A higher level of abstraction is ARM programming using Embedded c.
6) Arduino programming & so onn..

i.e as we go upwards from Zeroth to 6th level, the complexity in technology involved increases. & so does the no. of instructions & routines. As the no. of functions & capability increases, more time is spent of interfacing & faster computation & multitasking capacity of controllers. For which more & more inbuilt functions & command are provided to developers to ease the task of programming.

Thus as we climb higher up the hierarchy, the programming becomes easier & more stress is laid on the effective & efficient use of the inbuilt commands.

4) After successfully compiling the code, connect the board using the USB cable provided with
the board & Click the upload button to burn the sketch onto your Arduino.







































5) Here is how Duemilanove looks like. It has an Atmega 328 (with 10 bit adc input & 6 x (8bit PWM )channels) at heart with 16Mhz XTERN. clock, a reset switch, ISP programming socket. a 12 volt DC input jack. Ethernet port next to FT232 inbuilt for programming the arduino. The & 4 SMD LED's for POWER IN, HARDWARE SERIAL(RX, TX), LED (PIN 13). So all in all i'd say its a compact, development board, with inbuilt burner hardware, & voltage regulator & pin outs.

a preview of arduino deumilanove.

You could also burn a code into an avr using Arduino & later use it on breadboard for your projects.
Below shown is the basic circuit of arduino for every breadboard project


Add caption
Or you could implement it on breadboard in such a way.















Arduino is perfect for hobbyists. It also provides the ease of use as you do not require indepth knowledge of AVR FUSES & SFR's (SPECIAL FUNCTION REGISTERS). There are plenty of interesting projects provided in online arduino forums & www.arduino.cc , youtube , as well as in your arduino software package.
For inbuilt example goto File->Examples & you'll find cool ready to use examples.
Be sure to understand them & their compatibility with your arduino before burning the sketch.

The next step of this could be

  •  interfacing multiple analog/digital sensors to Arduino 
  • Programming avr using Bootloader & Arduino as ISP.
  • Programming Arduino wirelessly using Xbee.


All these will be covered in the coming tutorials.





Also feel free to ask any doubts regarding the projects.







-Abhirup :)

No comments:

Post a Comment