Professional Documents
Culture Documents
Major Training Report On Arduino Microcontroller Hardware & Software Workshop
Major Training Report On Arduino Microcontroller Hardware & Software Workshop
ARDUINO MICROCONTROLLER
WORKSHOP
NAME:-
LOCATION:-
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
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.
#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.
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.
Schematic of Arduino :-
Pin Diagram :-
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
Basic Commands :-
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).
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.
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.
PROGRAMS :-
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
}
Objective :-
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
}
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 :-
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);
}
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 :-