Arduino
January 30, 2017 | Author: piyushji125 | Category: N/A
Short Description
arduino...
Description
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 2.
the
pre-assembled.
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 easyto-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);
//
digitalWrite(pin, LOW); delay(1000);
// //
pauses for one second turns 'pin' off 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
digitalRead(pin);
„pin‟
to
input
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
View more...
Comments