Introduction: Getting Started With Arduino : Blinking Led

About: For more project and tutorial visit my YouTube Channel Smart Technology

A decade ago,working around electronics involved knowledge in physics and math, expensive lab equipment, a laboratory type setup and important of all, love for electronics. But the picture has changed over the decade or so where the above-mentioned factors became irrelevant to work around electronics except for the last part: love for electronics.

One such product which made use of the above specified and many other reasons and made electronics be able reach anyone regardless of their background is “Arduino”.

Arduino is a microcontroller based prototyping board which can be used in developing digital devices that can read inputs like finger on a button, touch on a screen, light on a sensor etc. and turning it in to output like switching on an LED, rotating a motor, playing songs through a speaker etc.

The Arduino board can be programmed to do anything by simply programming the microcontroller on board using a set of instructions for which, the Arduino board consists of a USB plug to communicate with your computer and a bunch of connection sockets that can be wired to external devices like motors, LEDs etc.

Step 1: Main Features of Arduino Uno

Microcontroller ATmega328

Operating Voltage 5V

Input Voltage (recommended) 7-12V

Input Voltage (limits) 6-20V

Digital I/O Pins 14 (of which 6 provide PWM output)

Analog Input Pins 6

DC Current per I/O Pin 40 mA

DC Current for 3.3V Pin 50 mA

Flash Memory 32 KB of which 0.5 KB used by bootloader

SRAM 2 KB

EEPROM 1 KB

Clock Speed 16 MHz

Step 2: Board

Step 3: Power

The Arduino Uno can be powered via the USB connection or with an external power supply. The power source is selected automatically.

The power pins are as follows:

• VIN. The input voltage to the Arduino board when it's using an external power source (as opposed to 5 volts from the USB connection or other regulated power source). You can supply voltage through this pin, or, if supplying voltage via the power jack, access it through this pin.

• 5V. The regulated power supply used to power the microcontroller and other components on the board. This can come either from VIN via an on-board regulator, or be supplied by USB or another regulated 5V supply.

• 3V3. A 3.3 volt supply generated by the on-board regulator. Maximum current draw is 50 mA.

• GND. Ground pins.

Step 4: Input and Output

Each of the 14 digital pins on the Uno can be used as an input or output, using pinMode(), digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each pin can provide or receive a maximum of 40 mA and has an internal pull-up resistor (disconnected by default) of 20-50 kOhms.

The Uno has also 6 analog inputs, each of which provide 10 bits of resolution (between 0 and 1023 values). By default they measure from ground to 5 volts.

Step 5: All Following Steps Are Explained in This Video

Step 6: Installing the Arduino Software

1. Download the Arduino IDE(currently version 1.8.5). Download it here https://www.arduino.cc/en/Main/Software

2. Unzip the file that you just downloaded

You are now ready to write your arduino code.

Step 7: Blinking LED

One of the basic project to start is with blinking an led using an Arduino Uno.

Pick up the supplies required :

1. Arduino UNO

2. LED

3. 220 Ohms resistor

4.Bread Board

5.Power supply cable or other suitable adapter

6.Wires

Step 8: Software Code

The basic structure of the arduino code is fairly simple and runs in at least two parts.These two required parts enclose block of statements.

void setup() {

Statements;

}

void loop() {

Statements;

}

Where setup() is preparation,loop() is the execution.Both functions are required for the program to work.

The setup function should follow the declaration of any variables at the very beginning of the program. It is the first function to run in the program, is run only once , and used to set pinMode or initialize serial communication(i.e serial.begin(9600) ).

The loop function follows next and includes the code to be executed continuously-reading inputs triggering outputs.

Semicolon must be used to end a statement and separate elements of the program.

Curly brace : each curly brace must always be followed by a closing curly brace.

Variable is a way of naming and storing a numerical value in order to be used by the program.

Before your ‘void setup’ though, we want to assign pin thirteen a name so that we know what we are controlling on it later one. Write before ‘void setup’:

For example:

int LED = 13;

This assigns the name ‘led’ the integer 13. Now every time we write ‘LED’ in our code, Arduino will interpret that as 13.

digitalWrite(pin,value)
Outputs either logic level HIGH or LOW at (turns ON or LOW) a specified digital pin.

HIGH/LOW

These constants define pin levels as HIGH or LOW and are used when reading or writing to digital pins. HIGH i defined as logical level 1,ON, or 5 volts while LOW is logical level 0, OFF, or 0 volts.

For example:

digitalWrite(13,HIGH);

INPUT/OUTPUT

These constants are used with the pinMode() function to define the mode a digital pin as either INPUT or OUTPUT.

For example:

pinMode(13, OUTPUT);

delay(ms)

In order to make LED blink we should write delay(period of time), It pauses your program for the amount of time as specified in milliseconds,where 1000 equals 1 second.

delay(5000); // waits for five seconds

Your final code should look like as follows:


int LED = 13;

void setup() {

pinMode(LED, OUTPUT);

}

void loop() {

digitalWrite(LED, HIGH);

delay(1000);

digitalWrite(LED, LOW);

delay(1000);

}

LED Contest 2017

Participated in the
LED Contest 2017