Start with arduino


Published on

How to begin with Arduino. Which board to buy and why? How to write first program.

Published in: Self Improvement, Technology
  • Be the first to comment

Start with arduino

  1. 1. Start With ArduinoThe Indian Way - Low Cost and Quick
  2. 2. Kinds of Arduino BoardsThere are Four kind of boards ● With USB port -Arduino UNO, Arduino MEGA ● With Serial Port - Arduino Severino (Lowest Cost) ● Small Size - Arduino Nano, Mini,Lilypad ● With some thing extra - Arduino BT, Arduino Ethernet
  3. 3. Which One Do You NeedDepends upon your need.
  4. 4. Which one do We use and why?We use Arduino Severino.Why? ● It is low cost. Costs less than Rs 600/- for complete board and PCB at just Rs 50/- ● Provide serial interface for use with GSM or GPS boards. ● Has all DIP parts, rework or changes are easy.
  5. 5. And why we do not use others● USB based boards and blank PCBs are expensive.● Double sided boards can not be easily reworked.● If boot loader gets corrupted (and it often does), it is difficult to program further.● Connecting GSM or GPS or Standalone blue tooth boards are difficult (if not impossible)
  6. 6. And how to program itWe use low cost USB ASP programmer which can beconnected to any lap top on USB port.With this programmer you do not even need boot loader andany blank IC can work.USB ASP programmers are also available for less than Rs600/-
  7. 7. So what is the total cost for startingArduino Severino Clone - Rs 599/-USB ASP Programmer - Rs 599/-Serial port cable - Rs 75/-USB Cable - Rs 75/-12V / 300 mAmps power supply - 150/-Total cost - Rs 1498/-
  8. 8. Install driver for USB ASPDownload USB ASP driver from USB ASP, when Windows ask for driver, point to thelocation where you have stored unzipped drivers.On Device Manager, you can check LibUSB device.(Linux and MAC does not need driver and skip this step)
  9. 9. Find Location of preference.txt fileDownload Arduino from arduino.ccInstall on your PC with Windows, Linux or MACUnzip and start.Open Arduino and click on preference in menu
  10. 10. specify programming methodOpen preference.txt file.Search for text uploadif you find a line like thisupload.using=bootloaderchange it to usbasp if you will be using USBASP forprogrammingupload.using=usbaspor leave it as it is if you will be using bootloader forprogramming
  11. 11. What is upload or programmingWhen we write program in C and click on UPLOAD the arduinoconverts C program to machine code and generate a hex file.This hex file will be transferred to micro controller.there are two methods - one is via serial port (this needs microcontroller already burnt with bootloader program)second is using a separate programmer like USBASP. Thisdoes not need a micro controller. Please also note that whenyou get a arduino board, this comes with pre-loadedbootloader. However after you program with USBASP,bootloader is over written.
  12. 12. Write first program
  13. 13. Connect Hardware with USB PortPC + Arduino Severino + USBASP + 12V Power SupplyIf using Windows, check that USBLib is visible in DeviceManager. (If you do not know what is device manager, search ityourself)make sure that preference.txt file hasupload.using=usbasp
  14. 14. Connect hardware with RS232 portPC with serial port + Arduino Sevnerino + 12V Power SupplyYou need to have ATMEGA8 with bootloaderand preference file should haveupload.using=bootloader
  15. 15. Select Board, Verify and Then UploadTo select BoardTools | Boards | Arduino NG or Older w/ATMEGA8To select com port (when using with bootloader)Tools | Serial Port | Select appropriate port numberTo compile(verify the syntax)Sketch | Verify or CompileTo download to the boardFile | Upload to I/O BoardAfter uploading is over LED will start blinking at 1 Hz rate ie halfsecond on and half second off.
  16. 16. Some thing about bootloaderBootloader is a program that allow more programs to beuploaded with using external hardware.At power on if bootloader is burnt into chip then program waitfor few seconds for data from serial port,if data is available in some defined format that this is stored inflash as program.if nothing is coming from serial port then last uploaded programstarts.More details about bootloader are available here
  17. 17. Modify The ProgramYou can change the time in parenthesis after delay and seethe difference in blinking.The first time is time for LED ON and second is time for LEDOFF This LED will blink as per program
  18. 18. Understand pin numbersIC has some physical pin numbers. ATMEGA8 in 28 pinpackage has 20 I/O lines and few pins for oscillator and powersupply etc. Physical pins are usually required for making circuitand when probing using CRO or multimeter.20 lines are given some names like PC6 where PC stand forPort C and 6 is the bit 6 of port c. During programming inC/Assembly we use PC6 and not the physical pin.Arduino board has these 20 lines taken to a connector. Theseconnector pins are marked 0 to 19. In Arduino software werefer to these pins ie 0 to 19 and not port pins or physical pins.
  19. 19. Understanding Pin NumbersSome pins have dual purposeFor example Analog pin 0 is also digital pin 14.Pin 0 is also Received dataNext few pages have more details and mapping of pin numbersie physical - logical - arduino
  20. 20. Understand Pin NumbersThis board has 20 I/O pins marked on pins.all of them are I/O. Some have dual purpose.
  21. 21. Understanding Pin NumbersAll 20 pins can be access as general purpose I/O pinsSome pins have other functions as explained below Pin Number Function 0 RXD 1 TXD 13 On board LED 9,10,11 PWM (Analog Outputs) 14,15,16,17,18,19 Analog Inputs 0 to 5 2,3 Interrupts 0 and 1
  22. 22. ATMEGA to Arduino Pin MappingATMEGA has 28 physical pins.In data sheets they are referred as Port and a number like PC5In Arduino they are referred as numbers 0 to 19.Mapping of all three is as below
  23. 23. SummaryThis document explain the first day of experiments with ArduinoBoard.Total hardware cost of material used in less than Rs 1500/-Not much can be done in this however this is a starting point.Next addons could be relays, IR Sensors, Remote handset,Temperature sensors, Light Sensors. Color LEDs, Buzzers.All this material will cost less than Rs 1000/-
  24. 24. About Open.EmbeddedThis is an initiative of group of professionals, students andhobbyists to share their knowledge among others using lowcost open source software.We think it criminal when students are taught 8085 and 8051 incollege when world is moving forward and technology changesare happening every where in the world.Join us at low cost kits at
  25. 25. Modification HistoryAug 18,2011 - details about bootloader added