GETTING START WITH AURDINO DIGITAL I/O:
ABSTRACT:
This documentation deals getting start with digital I/O’s in Arduino.
DESCRIPTION:
Arduino is an open source microcontroller board. Totally it has 20 I/O pins among that 14
I/O’s used for digital and 6 I/O’s for analog. The aim of this article is to give a start in Arduino,
and to see the first visual digital output in real time. We connect an external LED to the board.
We use pin number 13 in our tutorial because it is being followed by the pre defined example
provided by Arduino Community. Also there is an internal LED present on board.
So we can view the output without using an external LED. We refer Arduino Duemilanove
for your tutorial.
DIRECTION TO GET START WITH ARDUINO
Step by step procedure for getting start with Arduino.
STEP 1: Choose the operating system that you are going to download the Arduino software.
STEP 2: Download the software from http://arduino.cc and install the drivers.
STEP 3: Get an Arduino board with USB cable.
ARDUINO – DUEMILANOVE BOARD
USB (a to b type) connector cable
STEP 4: Double click the Arduino icon. A A JAVA application window will open as shown in the below figure.
STEP 5: Next click tool in the menu bar and select COM3 this is your dynamic com number (from our demo system).
This com number will vary from system to system and it is hardware dependent too.
We will be uploading soon regarding the installation of drivers; wherein we go depth into com number for our board.
STEP 6: Next click open (indicated as down arrow) and then select Blink in digital category.
STEP 7: Blink program will open and upload it in the Arduino. LED will start blinking.
PROGRAM:
int ledPin = 13; // LED connected to digital pin 13
// The setup() method runs once, when the sketch starts
void setup() {
// initialize the digital pin as an output:
pinMode (ledPin, OUTPUT);
}
// the loop() method runs over and over again,
// as long as the Arduino has power
void loop()
{
digitalWrite(ledPin, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(ledPin, LOW); // set the LED off
delay(1000); // wait for a second
}
In this program the output pin is 13th pin .we can change the output pins.
Example:
int ledPin = 8;
int ledPin = 5;
The on time and off time of the LED can be varied by varying the delay. It is applicable for digital I/O’s.
Example:
delay (5000);
Notable delay for human eye is 15ms.
LED
The luminance the LED can be varied by varying the current flowing through the LED. Maximum current
for a led is about to around 20mA.LED should be connected in series with a resistor. If we want to connect
the LED in parallel, we have to connect resistors with each LED. Voltage applied may vary from 1.6V to 4V.
Resistors are connected with LED’s to prevent them damage from excess current. High density LED does
not require resistors, when used it will not glow.
CIRCUIT SYMBOL:
Anode
Cathode
FEW DIFFERENT COLOURS OF LED AVAILABLE:
CALCULATION FOR RESISTANCE:
R = (VS – VL) / I
VS = supply voltage
VL = LED voltage (usually 2V, but 4V for blue and white LEDs)
I = LED current (e.g. 10mA = 0.01A, or 20mA = 0.02A)
Make sure the LED current you choose is less than the maximum permitted and convert the
current to amps (A) so the calculation will give the resistor value in ohms ( ).
To convert mA to A divide the current in mA by 1000 because 1mA = 0.001A.
TECHNICAL DATA FOR LED:
Here are some technical data for certain plastic body(nature of material they were made) LED.
IF max. | Maximum forward current, forward just means with the LED connected correctly. |
VF typ. | Typical forward voltage, VL in the LED resistor calculation. This is about 2V, except for blue and white LEDs for which it is about 4V. |
VF max. | Maximum forward voltage. |
VR max. | Maximum reverse voltage You can ignore this for LEDs connected the correct way round. |
Luminous intensity | Brightness of the LED at the given current, mcd = millicandela. |
Viewing angle | Standard LEDs have a viewing angle of 60°, others emit a narrower beam of about 30°. |
Wavelength | The peak wavelength of the light emitted, this determines the colour of the LED. nm = nanometre. |
SCHEMATIC:
BREAD BOARD: