You are on page 1of 20

MAJOR TRAINING REPORT ON

ARDUINO MICROCONTROLLER

HARDWARE & SOFTWARE

WORKSHOP

NAME:-

LOCATION:-

TRAINING DURATION:- 4 WEEKS


CONTENT

1. Chapter 1
a) Location and duration of training
b) Set up
c) Lesson Plan
2. Chapter 2
d) Brief History and advantages of Arduino IDE
e) Various ARDUINO compatible MCU boards available in serial and USB interface
f) Brief description of board and its schematic
g) Details of MCU used and its brief features
3. Chapter 3
h) Brief features of ARDUINO IDE
i) Various commands
j) Basic structure of a Program
k) Various functions
4. Chapter 4
 Description of programs with source code

 LED Blinking
 Buzzer Ringing
 Led Fading
 Buzzer Controlling using switch
 LCD Display using Potentiometer
 LCD Display and Cursor blink
 LCD Autoscroll
5. Conclusion
CHAPTER 1

Location :- K.C.B. TECHNICAL ACADEMY, INDORE

Training duration :- 4 weeks

Set up :-

 Desktop
 ARDUINO IDE Software
 Arduino Compatible Microcontroller Board
 Peripherals :-
1. Buzzer
2. LCD Display
3. Potentiometer
4. LED
5. Switch

LESSON PLAN :-

1ST WEEK :-

In this week, we have learned the theoretical concept regarding the microcontroller and
arduino board. The board which we have used in our training is Sanguino.

2nd WEEK :-

In this week, we have learned the concept of basic programming used in our board. For
this, we have used Arduino software which uses C coding.

3rd WEEK :-

In this week, we have done general examples based on C coding like, LED blinking,
Buzzer ringing, on and off of LED and Buzzer using Switch etc.

4th WEEK :-
Here, we have concluded the training with various examples done on the combinations of
different peripherals like, data acquition system etc.

CHAPTER 2

HISTORY:-

#1100A.D.

 Arduin of Italy: the name of an ancient Italian king. Circa 1100 AD.

#1100A.D.- 2004A.D.

 No microcontrollers named after King Arduin for about 900 years. It took a while for this
to catch on.

#2005- 2007

 Arduino: the name of the bar where the Arduino team cooked up their original plan for the
Arduino microcontroller, circa summer 2005.
 Boarduino: ladyada's standalone Arduino-compatible, circa early 2007.
 Freeduino: our contribution, born September 2007.
 Uduino: an early one from back in 2007.

ADVANTAGES OF ARDUINO IDE :-

1. Inexpensive - Arduino boards are relatively inexpensive compared to other


microcontroller platforms. The least expensive version of the Arduino module can be
assembled by hand, and even the pre-assembled.
2. Cross-platform - The Arduino software runs on Windows, Macintosh OSX, and Linux
operating systems. Most microcontroller systems are limited to Windows.
3. Simple, clear programming environment - The Arduino programming environment is
easy-to-use for beginners, yet flexible enough for advanced users to take advantage of as
well. 4. Open source and extensible software- The Arduino software is published as
open source tools, available for extension by experienced programmers. The language can
be expanded through C++ libraries, and people wanting to understand the technical details
can make the leap from Arduino to the AVR C programming language on which it's based.
ARDUINO Compatible MCU Boards:-

1. Arduino Uno - This is the latest revision of the basic Arduino USB board. It connects to
the computer with a standard USB cable and contains everything else you need to
program and use the board.
2. Mega2560 - The version of the Mega released with the Uno, this version features the
Atmega2560, which has twice the memory, and uses the ATMega 8U2 for USB-to-serial
communication.
3. Sanguino – This is latest version of ARDUINO series. This board can be connected to
computer through USB cable.

Description of Board (SANGUINO) :-

Schematic of Arduino :-
Pin Diagram :-

Brief description of board :-

Sanguino is a 40 pin DIP MCU. It is a ATmega644P MCU with 64 KB


ROM, 4096 B RAM and 2048 B EEPROM. It has 32 Input/Output lines in which there
are 8 Analog and 24 Digital lines with 6 PWM pins. It costs us an extra signal cable, a
USB to serial converter board (FTDI) and a USB cable. Its main feature is that it has
JTAG debugger and a serial to parallel interface (SPI) and there are 2 Universal
Synchronous Asynchronous Receiver and Transmitter. Sanguino can be powered in two
ways.
1. 9V DC Power Adapter Jack (sold separately).
2. Via FTDI USB Break out board.

Features of Arduino :-
High-performance, Low-power AVR® 8-bit Microcontroller
Memory segment
- 16/32/64K Bytes of In-System Self-programmable Flash program
memory
- 512B/1K/2K Bytes EEPROM
- 1/2/4K Bytes Internal SRAM
Peripheral Features
- Two 8-bit Timer/Counters with Separate Prescalers and Compare Modes
- One 16-bit Timer/Counter with Separate Prescaler, Compare Mode
- Six PWM Channels
- 8-channel, 10-bit ADC
Differential mode with selectable gain
- Two Programmable Serial USART
- Programmable Watchdog Timer with Separate On-chip Oscillator
- Interrupt and Wake-up on Pin Change
Special Microcontroller Features
- Power-on Reset and Programmable Brown-out Detection
- External and Internal Interrupt Sources
- Six sleep modes: Idle, ADC noise reduction, Power-save, Power-down,
Standby, Extended Standby
I/O and Packages
- 32 Programmable I/O Lines
- 40-pin PDIP, 44-lead TQFP, 44-pad VQFN/QFN/MLF.
- 44-pad DRQFN (ATmega164P)
Operating Voltages
- 1.8 - 5.5V for ATmega164P/324P/644PV
- 2.7 - 5.5V for ATmega164P/324P/644P
CHAPTER-3

FEATURES OF ARDUINO IDE :-

The Arduino IDE is a cross-platform application written in java which is


derived from IDE made for the processing programming language and the Wiring project. It is designed to
introduce programming to artists and other
newcomers and other newcomers unfamiliar with software development. It includes a code editor with
features such as syntax, highlighting, brace matching, and automatic indentation, and is also capable of
compiling and uploading programs to the board with a single click. There is typically no need to edit
makefiles or run programs on the command line. The Arduino IDE comes with a C/C++ library called
“Wiring”, which makes many common input/output operations much easier.

Basic Commands :-

Using this two commands, we can compile and execute program.

1. Verify – In this command, the compiling of the written program happens.

2. Upload – This command is used for uploading the program in our arduino board, so
that we can execute the program uploaded.

STRUCTURE:-

The basic structure of the Arduino programming language is fairly simple and runs in at least two parts.
void setup()
{
statements;
}
void loop()
{
statements;
}

Where setup() is the preparation, loop() is the execution. The setup function should follow the declaration of
any variables at very beginning of the program. It is the first function to run in the program, is run only once,
and is used to set pinMode initialize serial communication. The loop function follows next and includes the
code to be executed continuously reading inputs, triggering outputs, etc.

setup() :-
The setup() function is called once when your program starts. Use it to initialize pin modes, or begin serial.
It must be included in a program even if there are no statements to run.
void setup()
{
pinMode(pin, OUTPUT); // sets the 'pin' as output
}
}

loop() :-
After calling the setup() function, the loop() function does precisely what its name suggests, and loops
consecutively, allowing the program to change, respond, and control the Arduino board.
void loop()
{
digitalWrite(pin, HIGH); // turns 'pin' on
delay(1000); // pauses for one second
digitalWrite(pin, LOW); // turns 'pin' off
delay(1000); // } pauses for one second

FUNCTIONS:-
A function is a block of code that has a name and a block of statements
are executed when function is called. Custom functions can written to
perform repetitive tasks and reduce clutter in a program. Functions are
declared by first declaring the function type.

Variables :-
A variable is a way of naming and storing a numerical value for later use
the program. As their namesake suggests, variables are numbers that can
continually changed as opposed to constants whose value never changes.
Variable needs to declared and optionally assigned to value needing to
stored. The following code declares a variable called inputVariable and
then assigns it the value obtained on analog input pin 2:
int inputVariable = 0; // declares a variable and assigns value

digitalWrite(pin, value) :-
Outputs either logic level HIGH or LOW at a specified digital
pin. The pin can be specified as either a variable or constant (0-13).

digitalWrite(pin, HIGH);

digitalRead(pin) :-
Reads value from a specified digital pin with the result either HIGH or
LOW. The pin can be specified as either a variable or constant (0-13).

value=digitalRead(Pin); //sets the value of pin

analogWrite(pin, value) :-
Writes a pseudo-analog value using hardware enabled pulse width
modulation (PWM) to an output pin marked PWM. The value can be
specified as a variable or constant with a value from 0-255.

analogWrite(pin,value); //writes ’value’ to analog pin

A value of 0 generates a steady 0 volts output at the specified pin; a


value of 255 generates a steady 5 volts output at the specified pin. For
values in between 0 and 255, the pin rapidly alternates between 0 and 5
volts – the higher the value, the more often the pin is HIGH (5 volts).

analogRead(pin) :-

Reads the value from a specified analog pin with a 10-bit resolution.
This function only works on the analog in pins (0-5). The resulting
integer values range from 0 to 1023.
value = analogRead(pin); // sets value equal to pin

pinMode(pin, mode) :-
Used in void setup() to configure a specified pin to behave either as an
INPUT or an OUTPUT.

pinMode(pin,OUTPUT); //sets ‘pin’ to output


pinMode(pin,INPUT); //sets ‘pin’ to input
digitalRead(pin);
CHAPTER – 4

PROGRAMS :-

(1) LED BLINKING :-

Objective :-
Write a program for blinking led for 1 second.
Operation :-
This program set the led pin to high for 1 second and
low for 1 second. Here led pin is connected to pin
number 0 of sanguino.

Source Code :-
int ledPin = 0; // LED connected to digital pin 0 in
// sanguino
void setup() // The setup() method runs once at starting
{
pinMode(ledPin, OUTPUT);
}
void loop() // the loop() method runs infinitely
{
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
}

(2) BUZZER RINGING :-

Objective :-

Write a program for ringing buzzer for 1 second.

Operation :-
This program set the buzzer pin to high for 1 second &
low for 1 second. Here buzzer pin is connected to pin
number 0.
Source Code :-
int buzPin = 0; // BUZZER connected to digital pin 2
// sanguino
void setup() // The setup() method runs once at starting
{
pinMode(buzPin, OUTPUT);
}
void loop() // the loop() method runs infinitely
{
digitalWrite(buzPin, HIGH); // set the BUZZER on
delay(1000); // wait for a second
digitalWrite(buzPin, LOW); // set the BUZZER off
delay(1000); // wait for a second
}

(3) LED FADING :-

Objective :-
Write a program for LED fading.
Operation :-
This program shows how to fade a led using
analogWrite() function. Here led is connected between
pin number 3 and ground.

Source Code :-

int ledPin = 3; // LED connected to digital pin 3


void setup()
{
// nothing happens in setup
}
void loop()
{
for(int fadeValue = 0;fadeValue<=255;fadeValue ++)
{
// sets the value (range from 0 to 255):
analogWrite(ledPin, fadeValue);
delay(1000); // wait for 1 second to see the dimming
//effect
}
}

(4) BUZZER CONTROLLING USING SWITCH :-

Objective :-
Write a program for on and off buzzer using switch.
Operation :-
Using switch, we can control the on and off of buzzer.
When switch is closed, buzzer will be off and vice-
versa.
Source Code :-
int buzpin=0; // Buzzer connected to pin 0
int swpin=6; // Switch connected to pin 6
int sw;
void setup()
{
pinMode(swpin,INPUT);
pinMode(buzpin,OUTPUT);
digitalWrite(swpin,HIGH);
}
void loop()
{
sw = digitalRead(swpin);
if(sw==0)
{
digitalWrite(buzpin,LOW);
}
}
(5) LCD DISPLAY USING

POTENTIOMETER :-

Objective :-
Write a program for LCD Display using Potentiometer.
Operation :-
In this program, we uses potentiometer to control the
display of LCD. By rotating potentiometer from 0 to
255, we can display the exact value of potentiometer
using LCD.
Source Code :-
#include <LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);
int i;
int potpin=0;
void setup()
{
lcd.begin(16,2);
lcd.print("potentiometer v");
delay(11000);
}
void loop()
{
i=analogRead(potpin);
lcd.clear();
lcd.setCursor(0,1);
lcd.print(i);
delay(100);
}
(6) LCD DISPLAY AND CURSOR BLINK :-

Objective :-
Write a program for LCD display and cursor blink. Operation :-
In this program, a message will be printed on LCD
display and we can on and off the blinking of cursor
using this program.
Source Code :-
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
// initialize the library with the numbers of the
// interface pins
void setup()
{
// set up the LCD's number of rows and columns:
lcd.begin(16, 2);
lcd.print("hello, world!"); //Print a message to the
//LCD.
}
void loop()
{
lcd.noCursor(); // Turn off the cursor:
delay(500);
lcd.cursor(); // Turn on the cursor:
delay(500);
}

(7) LCD AUTOSCROLL :-

Objective :-
Write a program for LCD Autoscroll.
Operation :-
In this program, we can justify right and left data entry
using Autoscroll() function. The message which we will
print on LCD display can be autoscrolled i.e. scrolling
of right and left.

Source Code :-

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
// initialize the library with the numbers of the
//interface pins
void setup()
{
lcd.begin(16,2); //set up the LCD's number of
//columns and rows:
}
void loop()
{
lcd.setCursor(0, 0); // set the cursor to (0,0):
for (int thisChar = 0; thisChar < 10; thisChar++)
{ // print from 0 to 9:
lcd.print(thisChar);
delay(500);
}
lcd.autoscroll(); // set display automatically scroll
lcd.setCursor(16,1); // set the cursor to (16,1):
for (int thisChar = 0; thisChar < 10; thisChar++)
{
lcd.print(thisChar);
delay(500);
}
lcd.noAutoscroll(); // turn off automatic scrolling
lcd.clear(); // clear screen for the next loop:
delay(500);
}
CONCLUSIONS :-

Arduino is an open source electronics prototyping platform based on flexible, easy-to-use


hardware and software. It can sense information by receiving the value from various sensors and can
control motors, actuators and many more. The programming on this microcontroller board is done by
Arduino IDE software i.e. Arduino programming language. Since the Arduino IDE is a cross-
platform application which is programmed in java and it includes a code editor with features such as
syntax highlighting, brace matching and automatic indentation and is also capable of compiling and
uploading programs to the board with a single click, so this Arduino IDE software is better than any
other AVR systems.

You might also like