Basics of arduino uno

8,168 views 29 slides Apr 20, 2018
Slide 1
Slide 1 of 29
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29

About This Presentation

some basic concepts of arduino


Slide Content

Basics of Arduino uno BY RAHAT SOOD B.TECH (ECE) 6 TH SEM ROLL NO – 14BTD5060237

Contents: WHAT IS MICROCONTROLLER ? WHAT IS ARDUINO ? ARDUINO UNO BOARD ANALOG TO DIGITAL CONVERSION GETTING STARTED WITH ARDUINO PROGRAMMING PRACTICAL APPLICATIONS

INTRODUCTION

MICROCONTROLLER : A small microcontroller on a single chip containing a Central Processor Unit (CPU), Flash Memory, RAM and input/output interface. Used for control purposes ,and for data analysis. Popular manufacturers are Intel, Atmel, Microchip.

What is the Arduino todbot.com/blog/bionicarduino

An open source Electronics Platform based on easy-to-use hardware (electronic board) and software(IDE).www.Arduino.ccd. A Electronic Board , with on-board regulated power supply,USB port to communicate with PC , and an Atmel microcontroller chip. Anyone can details of its design and modify it or make his own.

Arduino Uno BOARD

Sample Specs: Arduino Uno Microcontoller: ATmega 328 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 (ATmega328) EEPROM 1 KB (ATmega328) Clock Speed 16 MHz

What is analog ? It is continuous range of voltage values (not just 0 or 5V) Why convert to digital ? Because our microcontroller only understands digital . Analog to Digital Coversion

ADC in Arduino Uno

Converting Analog Value to Digital

Quantanization the signal

The Arduino Uno board contains 6 pins for ADC 10-bit analog to digital converter This means that it will map input voltages between 0 and 5 volts into integer values between 0 and 1023 ADC in Arduino

analogRead (A0); // used to read the analog value from the pin A0 analogWrite (2,128 ); Reading/Writing Analog Values

Getting started with Programming

C++ libs C++ libs C++ libs Arduino C/C++ (READABLE CODE) ASSEMBLY (READABLE CODE) MACHINE LANGUAGE (BINARY CODE)

Integer : used with integer variables with value between 2147483647 and -2147483647. Ex: int x=1200; Character : used with single character, represent value from - 127 to 128. Ex. char c=‘r’; Long : Long variables are extended size variables for number storage, and store 32 bits (4 bytes), from -2,147,483,648 to 2,147,483,647. Ex. long u=199203 ; Floating-point numbers can be as large as 3.4028235E+38 and as low as -3.4028235E+38. They are stored as 32 bits (4 bytes) of information. Ex. float num =1.291; Data Types and operators

Statement represents a command, it ends with ; Ex: int x; x=13; Operators are symbols that used to indicate a specific function: - Math operators: [ +,-,*,/,%,^ ] - Logic operators: [ ==, !=, &&, || ] - Comparison operators: [ ==, >, <, !=, <=, >= ] Syntax: ; Semicolon, {} curly braces, // single line comment, /* Multi-line comments */ Statement and operators:

If Conditioning: if( condition ) { statements-1; … Statement-N; } else if( condition2 ) { Statements; } Else {statements ; } Control statements :

Switch case: switch ( var ) { case 1: //do something when var equals 1 break; case 2: //do something when var equals 2 break; default: // if nothing else matches, do the default // default is optional } Control statements:

Compound Operators: ++ (increment) -- (decrement) += (compound addition) -= (compound subtraction) *= (compound multiplication) /= (compound division) Statement and operators :

Do… while: do { Statements; } while(condition); // the statements are run at least once. While: While(condition) {statements ;} for for (int i=0; i <= val ; i++){ statements; } Loop statements :

void  setup () {    // put your setup code here, to run once: } void  loop () {    // put your main code here, to run repeatedly: } Bare minimum code

setup : It is called only when the Arduino is powered on or reset. It is used to initialize variables and pin modes. loop : The loop functions runs continuously till the device is powered off. The main logic of the code goes here. Similar to while (1) for micro-controller programming. Bare minimum code

A pin on arduino can be set as input or output by using pinMode function. pinMode(13, OUTPUT); // sets pin 13 as output pin pinMode(13, INPUT); // sets pin 13 as input pin PinMode

digitalWrite(13, LOW); // Makes the output voltage on pin 13 , 0V digitalWrite(13, HIGH); // Makes the output voltage on pin 13 , 5V int  buttonState = digitalRead(2); // reads the value of pin 2 in buttonState Reading/writing digital values

Arduino IDE See: http://arduino.cc/en/Guide/Environment for more information

PRACTICAL APPLICATIONS LIGHT CONTROL MOTOR CONTROL AUTOMATION ROBOTICS NETWORKING CUSTOM PROTOCOLS

THANK YOU
Tags