arduino paper about introduction

12
ARDUINO (EASY WAY TO OUR PROJECTS) NAGA SAI ORUGANTI 3 rd year, B.Tech Electronics and Communication Engineering Mail id: - [email protected] Ph.no:- 7661919861 Krishna Chaitanya Institute of Technology and Sciences, Markapur. BIJIVEMULA VIKRAM KUMAR REDDY 3 rd year, B.Tech Electronics and Communication Engineering Mail id: - [email protected] m Ph.no:- 9550223266 Krishna Chaitanya Institute of Technology and Sciences, Markapur. Abstract:- In the days of controller’s world, many boards came into existence and supported to many applications for the people in home appliances, gaming tools etc., though they have many advantages, there is also some disadvantages. The programming and the connections of controller’s is cumbersome. In many real time applications, cost of the components with these controller’s is too heavy. To avoid these, a controller board was introduced in early 21 st (in the year of 2008) century, that is ARDUINO microcontroller based board. It is a single-board microcontroller and a software suite for programming. The hardware consists of a simple open hardware design for the controller with an Atmel AVR processor and on-board I/O support. The software consists of a standard programming language and the boot loader that runs on the board. The following pages have will explain ARDUINO in detail . Introduction:- Most of us know what a computer looks like. It usually has a keyboard, monitor, CPU (Central Processing Unit), printer, and a mouse. These types of computers, like the Mac or PC, are primarily designed to communicate (or

Upload: nagasai547

Post on 12-Jan-2017

26 views

Category:

Engineering


3 download

TRANSCRIPT

Page 1: Arduino PAPER ABOUT INTRODUCTION

ARDUINO(EASY WAY TO OUR PROJECTS)

NAGA SAI ORUGANTI3rd year, B.Tech

Electronics and Communication Engineering

Mail id: - [email protected]:- 7661919861

Krishna Chaitanya Institute of Technology and Sciences,

Markapur.

BIJIVEMULA VIKRAM KUMAR REDDY

3rd year, B.TechElectronics and Communication

EngineeringMail id: -

[email protected]:- 9550223266

Krishna Chaitanya Institute of Technology and Sciences,

Markapur.

Abstract:-In the days of controller’s world, many boards came into existence and supported to

many applications for the people in home appliances, gaming tools etc., though they have many advantages, there is also some disadvantages. The programming and the connections of controller’s is cumbersome. In many real time applications, cost of the components with these controller’s is too heavy.

To avoid these, a controller board was introduced in early 21st (in the year of 2008) century, that is ARDUINO microcontroller based board. It is a single-board microcontroller and a software suite for programming. The hardware consists of a simple open hardware design for the controller with an Atmel AVR processor and on-board I/O support. The software consists of a standard programming language and the boot loader that runs on the board. The following pages have will explain ARDUINO in detail.

Introduction:-

Most of us know what a computer looks like. It usually has a keyboard, monitor, CPU (Central Processing Unit), printer, and a mouse. These types of computers, like the Mac or PC, are primarily designed to communicate (or "interface") with humans. DatabaseManagement, financial analysis, or even word-processing are all accomplished inside the "Big box" that contains the CPU, memory, hard drive, etc.

If we think about it, the whole purpose of a monitor, keyboard, mouse, & even the printer is to "connect" the CPU to the outside world. We call these devices “microcontrollers". Micro because they're

small and controller because they "control" machines, gadgets, whatever. Microcontrollers by definition they are designed to connect to machines, rather than people. They're cool because, you can build a machine or instrument, write programs to control it and then let it work for you automatically. There are an infinite number of applications for microcontrollers. Hundreds of different variations of microcontrollers are available.

Some are programmed once & produced for specific applications, such as controlling your printer. Others are "re-programmable", which means they can be

Page 2: Arduino PAPER ABOUT INTRODUCTION

used over and over for different applications. Microcontroller:-

A Microcontroller is a Microcomputer in a single Chip. That means that a microcontroller chip includes a microprocessor (CPU) as well as some often used peripherals. A controller is used to control some process or aspect of the environment.

As the process of miniaturization continued, all of the components needed for a controller were built right onto one chip The microcontroller could be called a "one-chip solution". It typically includes:

• CPU (central processing unit or the microprocessor)

• EPROM/PROM/ROM (Read Only Memory for the program code)

• RAM (Random Access Memory for the data)

• I/O (input/output) devices (serial, parallel, ADC, DAC etc.)

• Timers• Interrupt controller

Arduino Board:-Arduino is an open source physical

computing platform based on a simple input/output (I/O) board and a development environment that implements the ProcessingLanguage. Figure 1 shows our Arduino board.

Fig -1Power Supply:-

Directly below the USB connector is the 5V voltage regulator. This regulates whatever voltage (between 7 and 12 volts) is supplied from the power socket into a constant 5V. 5V (along with 3V, 6V, 9V, and 12V) is a bit of a standard voltage in electronics. 3, 6, and 9V are standard because the voltage that you get from a

single alkaline cell is 1.5V, and these are all convenient multiples of 1.5V, which is what you get when you make a “battery” of two, three, six, or eight cells. So if that is the case, you might be wondering why 5V? You cannot make that using 1.5V cells. Well, the answer lies in the fact that in the early days of computing, a range of chips became available, each of which contained logic gates. These chips used something called TTL (Transistor-Transistor Logic), which was a bitfussy about its voltage requirements and required something between 4.5V and 5.5V. So 5V became the standard voltage for all digital electronics. These days, the type of logic gates used in chips has changed and they are far more tolerant of different voltages. The 5V voltage regulator chip is actually quite big for a surface-mount component. This is so thatit can dissipate the heat required to regulate the voltage at a reasonably high current, which is useful when driving our external electronics.

Analog Inputs:-

The next section of connections is labeled Analog In 0 to 5. These six pins can be used to measure the voltage connected to them so that the value can be used in a sketch. Note that they measure a voltage and not a current. Only a tiny current will ever flow into them and down to ground because they have a very large internal resistance. Although labelled as analog inputs, these connections can also be used as digital inputs or outputs, but by default, they are analog inputs.

Fig -2

Page 3: Arduino PAPER ABOUT INTRODUCTION

Digital Connections:-

We now switch to the top connector and start on the right side. We have pins labelled Digital 0 to 13. These can be used as either inputs or outputs. When using them as outputs, they behave rather like the supply voltages we talked about earlier, except that these are all 5V and can be turned on or off from our sketch. So, if we turn them on from our sketch, they will be at 5V and if we turn them off, they will be at 0V. As with the supply connectors, we have to be careful not to exceed their maximum current capabilities.

Fig -3

Microcontroller:-

Getting back to our tour of the Arduino board, the microcontroller chip itself is the black rectangular device with 28 pins. This is fitted into a DIL (dual in-line) socket so that it can be easily replaced. The 28-pin microcontroller chip used on Arduino is the ATmega328. Figure 2-4 is a block diagram showing the main features of this device. The heart, or perhaps more appropriately the brain, of the device is the CPU (central processing unit). It controls everything that goes on within the device. It fetches program instructions stored in the Flash memory and executes them. This might involve fetching data from working memory (RAM), changing it, and then putting it back. Or, it may mean changing one of the digital outputs from 0 to 5 volts. The

electrically erasable programmable read only memory (EEPROM) is a little like the Flash memory in that and is nonvolatile. That is, you can turn the device off and on and it will not have forgotten what is in the EEPROM. Whereas the Flash memory is intended for storing program instructions (from sketches), the EEPROM is used to store data that you do not want to lose in the event of a reset or power failure.

Fig-5.ATmega328 block diagram

Other Components:-

Above the microcontroller there is a small, silver, rectangular component. This is a quartz crystal oscillator. It “ticks” 16 million times a second, and on each of those ticks, the microcontroller can perform one operation—an addition, subtraction, etc. To the right of the crystal, is the Reset switch. Clicking this sends a

Page 4: Arduino PAPER ABOUT INTRODUCTION

logic pulse to the Reset pin of the microcontroller, causing the microcontroller to start its program afresh and clear its memory. Note that any program stored on the device will be retained because this is kept in nonvolatile Flash memory—that is, memory that remembers even when the device is not powered. To the left of the Reset button is the serial programming connector. It offers another means of programming the Arduino without using the USB port. Since we do have a USB connection and software that makes it convenient to use, we will not avail ourselves of this feature. In the top left of the board next to the USB socket is the USB interface chip. This converts the signal levels used by the USB standard to levels that can be used directly by the Arduino board.

Fig-6

The Software (IDE):-The IDE (Integrated Development

Environment) is a special program running on the computers that allows to write sketches for the Arduino board in a simple language modeled after the Processing language. The magic happens when the upload button is pressed, that uploads the sketch to the board, the code that written is translated into the C, and is passed to the avr-gcc compiler, an important piece of open source software that makes the final translation into the language understood by the microcontroller. This last step is quite important, because it's where Arduino makes your life simple by hiding away as much as possible of the complexities of

programming microcontrollers. The programming cycle on Arduino is basically as follows:

• Plug your board into a USB port on your computer.

• Write a sketch that will bring the board to life.

• Upload this sketch to the board through the USB connection and wait a couple of seconds for the board to restart.

• The board executes the sketch that you wrote.

Software description is given below.Structure:-

An Arduino sketch runs in two parts:void setup():-

This is where you place the initialisation code—the instructions that set up the board before the main loop of the sketch starts.void loop():-

This contains the main code of your sketch. It contains a set of instructions that get repeated over and over until the board is switched off.Special symbols:-

Arduino includes a number of symbols to delineate lines of code, comments, and blocks of code.; (semicolon):-

Every instruction (line of code) is terminated by a semicolon. This syntax lets you format the code freely. You could even put two instructions on the same line, as long as you separate them with a semicolon. (However, this would make the code harder to read.){} (curly braces):-

This is used to mark blocks of code. For example, when you write code for the loop() function, you have to use curly braces before and after the code.Comments:-

These are portions of text ignored by the Arduino processor, but are extremely useful to remind yourself (or others) of what a piece of code does.There are two styles of comments in Arduino:

// single-line: this text is ignored until the end of the line. /* multiple-line: you can write

Page 5: Arduino PAPER ABOUT INTRODUCTION

a whole poem in here */Constants:-

Arduino includes a set of predefined keywords with special values. HIGH and LOW are used, for example, when you want to turn on or off an Arduino pin. INPUT and OUTPUT are used to set a specific pin to be either an input or an output true and false indicate exactly what their names suggest: the truth or falsehood of a condition or expression.Variables:-

Variables are named areas of the Arduino's memory where you can store data that you can use and manipulate in your sketch. As the name suggests, they can be changed as many times as you like. Because Arduino is a very simple processor, when you declare a variable you have to specify its type. This means telling the processor the size of the value you want to store.Data types:- Boolean:-

Can have one of two values: true or false.Char:-

Holds a single character, such as A. Like any computer, Arduino stores it as a number, even though you see text. When chars are used to store numbers, they can holdvalues from –128 to 127.Byte:-

Holds a number between 0 and 255. As with chars, bytes use only one byte of memory.Int:-

Uses 2 bytes of memory to represent a number between –32,768 and 32,767; it's the most common data type used in Arduino.unsigned int:-

Like int, uses 2 bytes but the unsigned prefix means that it can't store negative numbers, so its range goes from 0 to 65,535.Long:-

This is twice the size of an int and holds numbers from –2,147,483,648 to 2,147,483,647.unsigned long:-

Unsigned version of long; it goes from 0 to 4,294,967,295.Float:-

It is quite big and can hold floating-point values, a fancy way of saying that you can use it to store numbers with a decimal point in it. It will eat up 4 bytes of your precious RAM and the functions that can handle them use up a lot of code memory as well. So use floats sparingly.Double:-

Double-precision floating-point number, with a maximum value of 1.7976931348623157 x 10308. Wow, that's huge!String:-

A set of ASCII characters that are used to store textual information (you might use a string to send a message via a serial port, or to display on an LCD display). For storage, they use one byte for each character in the string, plus a null character to tell Arduino that it's the end of the string. The following are equivalent:

char string1[] = "Arduino"; // 7 chars + 1 null char

char string2[8] = "Arduino"; // Same as aboveArray:-

A list of variables that can be accessed via an index. They are used to build tables of values that can easily be accessed. For example, if you want to store different levels of brightness to be used when fading an LED, you could create six variables called light01, light02, and soon. Better yet, you could use a simple array like:

int light[6] = {0, 20, 50, 75, 100};The word "array" is not actually

used in the variabledeclaration: the symbols [] and {}

do the job.Control Structures:-

Arduino includes keywords for controlling the logical flow of your sketch.if … else:-

This structure makes decisions in your program. if must be followed by a question specified as an expression contained in parentheses. If the expression is true, whatever follows will be executed.

Page 6: Arduino PAPER ABOUT INTRODUCTION

If it's false, the block of code following else will be executed. It's possible to use just if without providing an else clause.

Example:if (val == 1) {digitalWrite(LED,HIGH);}forLets you repeat a block of code a

specified number oftimes.Example:for (int i = 0; i < 10; i++) {Serial.print("ciao");}

switch case:-The if statement is like a fork in the

road for your program. switch case is like a massive roundabout. It lets your program take a variety of directions depending on the value of a variable. It's quite useful to keep your code tidy as it replaces long lists of if statements.

Example:switch (sensorValue) {case 23:digitalWrite(13,HIGH);break;case 46:digitalWrite(12,HIGH);break;default: // if nothing matches this is

executeddigitalWrite(12,LOW);digitalWrite(13,LOW);}

While:-Similar to if, this executes a block of

code while a certain condition is true.Example:// blink LED while sensor is below

512sensorValue = analogRead(1);while (sensorValue < 512) {digitalWrite(13,HIGH);delay(100);digitalWrite(13,HIGH);delay(100);sensorValue = analogRead(1);}

do … while:-Just like while, except that the code

is run just before the the condition is

evaluated. This structure is used when you want the code inside your block to run at least once before you check the condition.

Example:do {digitalWrite(13,HIGH);delay(100);digitalWrite(13,HIGH);delay(100);sensorValue = analogRead(1);} while (sensorValue < 512);

Break:-This term lets you leave a loop and

continue the execution of the code that appears after the loop. It's also used to separate the different sections of a switch case statement.

Example:// blink LED while sensor is below

512do {// Leaves the loop if a button is

pressedif (digitalRead(7) == HIGH)break;digitalWrite(13,HIGH);delay(100);digitalWrite(13,HIGH);delay(100);sensorValue = analogRead(1);} while (sensorValue < 512);

Sensors and Actuators:-

Sensors and actuators are electronic components that allow a piece of electronics to interact with the world. As the microcontroller is a very simple computer, it can process only electric signals (a bit like the electric pulses that are sent between neurons in our brains). For it to sense light, temperature, or other physical quantities, it needs something that can convert them into electricity. In our body, for example, the eye converts light into signals that get sent to the brain using nerves. In electronics, we can use a simple device called a light-dependent resistor (an LDR or photoresistor) that can measure the amount of light that hits it and report it as a signal that can be understood by the microcontroller. Once the sensors have

Page 7: Arduino PAPER ABOUT INTRODUCTION

been read, the device has the information needed to decide how to react. The decision-making process is handled by the microcontroller, and the reaction is performed by actuators.

In our bodies, for example, muscles receive electric signals from the brain and convert them into a movement. In the electronic world, these functions couldbe performed by a light or an electric motor.In the following sections, you will learn how to read sensors of different types and control different kinds of 20actuators.

Arduino Software icons:-

Fig-7: application

Fig-8: main starting window of arduino

Fig-9: Workspace window of arduino

Applications:-Arduino is used in wide range of

applications. These are used due to the easy programming capabilities, simplifies the connections of the peripherals, low cost, space occupying is low. Arduino’s are mainly used in

Robots manufacturing, RFID control systems, Automatic controls, Multicolor Light Display,

Summary:-Arduino use ATmega328

microcontroller which performs specific instruction as per user’s desire. It consists of Quartz Crystal Oscillator, Reset button, DIL socket, USB connector, Power supply socket, Digital I/O pins, Analog inputs pins. The language used in software development is similar with C language. With the help of the Arduino a user can develop many applications.

Acknowledgement:-We sincerely thank to our HOD sri

Dr ANNA RANGANAYAKULU for his encouragement. We are especially thankful to our faculty and friends for their support.

Bibliography:-1. Beginning Arduino Copyright ©

2010 by Michael McRoberts.2. Arduino Cookbook by Mc Robert.

Page 8: Arduino PAPER ABOUT INTRODUCTION

3. https://www.arduino.cc/en/Main/ArduinoBoardUno

4. https://www.arduino.cc/en/Main/Software

5. https://en.wikipedia.org/wiki/Arduino

6.  "Arduino - Introduction". arduino.cc.

7. "How many Arduinos are "in the wild?" About 300,000". Adafruit Industries. May 15, 2011. Retrieved 2013-05-26.

8. "Arduino FAQ – With David Cuartielles". Malmö University. April 5, 2013. Retrieved2014-03-24.

9.  David Kushner (26 Oct 2011). "The Making of Arduino". IEEE Spectrum.

10. Allan, Alasdair (6 March 2015). "Arduino Wars: Group Splits, Competing Products Revealed?". makezine.com. Maker Media, Inc. Retrieved 21 April 2015.

11.  Banzi, Massimo (19 March 2015). "Massimo Banzi: Fighting for Arduino".makezine.com. Maker Media, Inc. Retrieved 21 April 2015.

12.  Williams, Elliot (28 March 2015). "Arduino SRL to Distributors: “We’re the REAL Arduino”". Hackaday.com. Hackaday.com. Retrieved 21 April 2015.

13.  "Arduino Announces New Brand, Genuino, Manufacturing Partnership with Adafruit - Make:". Make:. Retrieved 17 May 2015.