0% found this document useful (0 votes)
12 views

9 Arduino

Uploaded by

123102037
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

9 Arduino

Uploaded by

123102037
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Arduino UNO board

Arduino UNO board

2
Arduino UNO

Arduino is a microcontroller-based open source


electronic prototyping board which can be
programmed with an easy-to-use Arduino IDE.
There are other boards like Arduino Lilypad, Arduino
Mini, Arduino Mega, and Arduino Nano.
However, the Arduino UNO board became more
popular than other boards in the family because it has
documentation that is much more detailed.
This led to its increased adoption for electronic
prototyping, creating a vast community of electronic
geeks and hobbyists.
3
Major components of Arduino UNO

The major components of Arduino UNO board are as


follows:
USB connector
Power port

Microcontroller

Analog input pins

Digital pins

Reset switch

Crystal oscillator

USB interface chip

TX RX LEDs

4
Major Components

5
USB connector

• This is a printer USB


port used to load a
program from the
Arduino IDE onto the
Arduino board
• The board can also be
powered through this
port.
6
Power port

The Arduino board can be powered through


an AC-to-DC adapter or a battery.
The power source can be connected by
plugging in a 2.1mm center-positive plug into
the power jack of the board.

7
Microcontroller

• It is the most prominent black


rectangular chip with 28 pins
• Brain of Arduino
• Microcontroller used on the UNO board
is Atmega328P by Atmel (a major
microcontroller manufacturer)

8
Microcontroller
• Atmega328P has the following components:
• Flash memory (Flash ROM) of 32KB: Stores the application
code to be run
• RAM: 2KB
• CPU: Fetches the program instructions from flash memory
and runs them with the help of RAM
• Flash memory
• EEPROM of 1KB: Store small amount of data like states of
input or output devices so they it can be retained even if the
Arduino loses power

9
Analog input pins:
• The Arduino UNO board has 6 analog input
pins, labeled “Analog 0 to 5”
• These pins can read the signal from an analog
sensor like a temperature sensor and convert it
into a digital value so that the system
understands
• These pins just measure voltage and not the
current because they have very high internal
resistance. Hence, only a small amount of
current flows through these pins
• Although these pins are labeled analog and are
analog input by default, these pins can also be
used for digital input or output
10
Digital pins:
 Pins labeled “Digital 0 to 13”
 Used as either input or output pins
 When used as output, these pins act as a power
supply source for the components connected to
them
 When used as input pins, they read the signals
from the component connected to them
 When digital pins are used as output pins, they supply 40 milliamps of
current at 5 volts, which is more than enough to light an LED
 Some of the digital pins are labeled with tilde (~) symbol next to the pin
numbers (pin numbers 3, 5, 6, 9, 10, and 11)
These pins act as normal digital pins but can also be used for Pulse-Width
Modulation (PWM), which simulates analog output like fading an LED in
and out..
11
USB interface chip:

• Think of this as a signal translator


• Converts signals in the USB level to a
level that an Arduino UNO board
understands

12
TX – RX LEDs:

• TX stands for transmit


• RX for receive
• These are indicator LEDs which blink
whenever the UNO board is
transmitting or receiving data

13
Temperature Sensor

14
void setup() {
pinMode(3, OUTPUT);
pinMode(5, OUTPUT);
pinMode(7, OUTPUT);
pinMode(A0,INPUT);
pinMode(A1,INPUT);
Serial.begin(9600);
}

void loop() {
int sensorValue = analogRead(A0);
float voltage = sensorValue * (5.0 / 1023.0);
float temperatureCelsius = (voltage-0.5)* 100;
Serial.print("Temperature: ");
Serial.print(temperatureCelsius);
Serial.println("\xB0 C");

int Hsensor = analogRead(A1);


Serial.print("Humidity: ");
//float humidity = (float)(sensorValue - minValue) / (float)(maxValue - minValue) *
(maxHumidity - minHumidity) + minHumidity;
float humidity = (float)(Hsensor - 0) / (float)(1023 - 0) * (100);
Serial.print(humidity);
Serial.println("%");
//Serial.print(map(Hsensor, 0, 1023, 0, 100));

15
if (temperatureCelsius >= 45) {
digitalWrite(3, HIGH);
digitalWrite(5, HIGH);
digitalWrite(7, HIGH);
}
else if (temperatureCelsius >= 35 && temperatureCelsius < 45)
{
digitalWrite(3, HIGH);
digitalWrite(5, HIGH);
digitalWrite(7, LOW);
}
else if (temperatureCelsius >= 30 && temperatureCelsius < 35)
{
digitalWrite(3, HIGH);
digitalWrite(5, LOW);
digitalWrite(7, LOW);
}
else
{
digitalWrite(3, LOW);
digitalWrite(5, LOW);
digitalWrite(7, LOW);
}
delay(1000);
}

16
Thank you

17

You might also like