Sie sind auf Seite 1von 15

Block Diagram :

Arduino
Introduction
Arduino is an open-source platform used for building electronics projects. It
consists of a microcontroller and a piece of software i.e. Integrated
Development Environment (IDE) that runs on your computer. This code is
used to write and upload computer code to the microcontroller.

The Arduino board is a microcontroller board, which is a small circuit that


contains a whole computer on a small chip. There are different versions of
the Arduino board: they are different in components, aim and size, etc. Some
common Arduino boards which are being use now a days are: Arduino
Diecimila, Arduino Uno, Arduino Mega and lot more.

It can affect its surroundings by controlling lights, motors, and other


actuators. Arduino can sense the environment by receiving input from a
variety of sensors. The microcontroller on the board is programmed using
the Arduino programming language and the Arduino development
environment. Arduino projects can be stand-alone or they can communicate
with software on running on a computer .

Why Arduino:-
It is very flexible to be customized and extended and it is an open-
source project, software/hardware which is extremely accessible.
It offers a variety of digital and analog inputs, SPI and serial interface
and digital and PWM outputs
It is easy to use, communicates using standard serial protocol, that
connects to computer via USB and runs in standalone mode and as
interface connected to PC.

Aurdino IDE:-
One of the most important component of the Arduino platform is
the Arduino IDE. This contains all the software which will run a computer in
order to program and communicate with an Arduino board.

There is an editor in Arduino IDE which we can use to write Arduino programs
/sketches in a simple programming .

The program we wrote is converted to C language and then compiled using


avr-gcc. This process produce binary code wich the microcontroller on the
Arduino board will be able to understand and execute.

Arduino Types
Arduino Uno (R3)
14 digital input/output pins (of which 6 can be used as PWM outputs)
6 analog inputs
a USB connection
a reset button
a power jack

It contains everything needed to support the microcontroller; simply connect


it to a computer with a USB cable or power it with a AC-to-DC adapter or
battery to get started.

What's on the board?


There are many varieties of Arduino boards that can be used for different
purposes. Some boards look a bit different from the one below, but most
Arduinos have the majority of these components in common:
Power (USB / Barrel Jack)
Arduino board needs a way to be connected to a power source. The Arduino
UNO can be powered from a USB cable coming from your computer or a wall
power supply In the picture above the USB connection and the barrel jack
are labeled (1) and (2) respectively.

This USB connection can also be used to upload code into the
microcontroller.

Do NOT use a power supply greater than 20 Volts ,for most aurdinos the
recommended voltage is between 6 and 12 Volts.

Pins (5V, 3.3V, GND, Analog, Digital, PWM, AREF)

The pins on Arduino are the places where we connect wires to construct a
circuit. They usually have black plastic headers through which we can plug a
wire right into the board. The Arduino has several different kinds of pins.
Each of pin is labeled on the board and each pin is used for different
functions.

Ground: There are several ground pins on the Arduino, any of which can be
used to ground your circuit. These pins are labeled (3) in the above figure.

5V (4) & 3.3V (5): As you might guess, the 5V pin supplies 5 volts of power,
and the 3.3V pin supplies 3.3 volts of power. Most of the simple components
used with the Arduino run happily off of 5 or 3.3 volts.

Analog Pins: The labels (A0 through A5 on the UNO) are Analog In pins.
These pins can read the signal from an analog sensor and convert it into a
digital value. These pins are labeled (6) in the above figure.

Digital Pins: On the board other than analog pins we have the digital pins (0
through 13). These pins can be used for both digital input and digital output.
These pins are labeled (7) in the above figure.

Pulse Width Modulation: Next to some of the digital pins, some pins are
with tilde (~) sign. These pins include 3, 5, 6, 9, 10, and 11 on the UNO.
These pins act as normal digital pins, but can also be used for something
called Pulse-Width Modulation (PWM).These pins as being able to simulate
analog output. These pins are labeled (8) in the above figure.

Analogue Reference: This pin is used when we want to set an external


reference voltage (between 0 and 5 Volts) as the upper limit for the analog
input pins. These pins are labeled (9) in the above figure.

Reset Button: There is a reset button in Arduino. Labeled (10) in the above
figure. By pushing it, connect the both reset pin and ground pin and restart
the code which we had loaded on the Arduino. If we want to test our code
multiple times and if our code doesnt repeat itself this can be very useful.
Power LED Indicator: There is a LED on the board labeled as ON
and (11). When we powered our Arduino, this LED lightens up. If this LED
does not glow, there is something wrong. We have to re-check our circuit.

TX RX LEDs: TX is short form of transmit, RX is short form of receive. These


pins are responsible for the serial communication. In our Arduino, TX and RX
appear two times. Once at the digital pins (0 and 1), and second time next at
the TX and RX indicator LEDs labeled as (12) in the above diagram.
Whenever we are receiving or sending data through our Arduino these LEDs
gives us visual indications. For example these LEDs will glow when we are
loading a new program onto the Microcontroller.

Main IC: There is a black IC with all the metal legs labeled as (13) in the
above figure. This IC act as the brain of Arduino. This IC on the Arduino is
little bit different from board type. Before loading a new program from the
IDE, this is important to know the IC type. This information is written on the
top side of the IC.

Voltage Regulator: The voltage regulator controls the amount of voltage


that is let into the Arduino board. It acts like a gatekeeper; as it will remove
an extra voltage that might harms the board. It has its own limits; do not
power up the Arduino greater than 20 volts. The voltage regulator is labeled
as (14) in the above diagram.

Technical Specifications
Microcontroller ATmega328

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.5KB used


by boot loader
SRAM 2 KB

EEPROM 1 KB

Clock Speed 16 MHz

Features Arduino Uno Arduino Due Arduino Arduino

Mega Leonardo

Processor 16Mhz 84MHz 16MHz 16MHz

ATmega328 AT91SAM3X8 ATmega2560 ATmega32u4

Memory 2KB SRAM, 96KB SRAM, 8KB SRAM, 2.5KB SRAM,

32KB flash 512KB flash 256KB flash 32KB flash

Digital I/O 14 54 54 20

Analogue I/O 6 input, 0 12 input, 2 16 input, 0 12 input, 0

output output output output


DHT11 :
DHT11 digital temperature and humidity sensor is a composite Sensor contains a
calibrated digital signal output of the temperature and humidity. Application of a dedicated
digital modules collection technology and the temperature and humidity sensing
technology, to ensure that the product has high reliability and excellent long-term stability.
The sensor includes a resistive sense of wet components and an NTC temperature
measurement devices, and connected with a

high-performance 8-bit microcontroller.


2Applications

HVAC, dehumidifier, testing and inspection equipment, consumer goods, automotive,


automatic control, data loggers, weather stations, home appliances, humidity regulator, medical
and other humidity measurement and control.

3Features

Low cost, long-term stability, relative humidity and temperature measurement, excellent
quality, fast response, strong anti-interference ability, long distance signal transmission, digital
signal output, and precise calibration.
LCD INTERFACING

3.1 Introduction:
The most commonly used Character based LCDs are based on Hitachi's HD44780
controller or other which are compatible with HD44580. In this tutorial, we will
discuss about character based LCDs, their interfacing with various microcontrollers,
various interfaces (8-bit/4-bit), programming, special stuff and tricks you can do

with these simple looking LCDs which can give a new look to your application .

3.2 Pin Discription:

The most commonly used LCDs found in the market today are 1 Line, 2 Line or 4
Line LCDs which have only 1 controller and support at most of 80 characters,
whereas LCDs supporting more than 80 characters make use of 2 HD44780
controllers.
Most LCDs with 1 controller has 14 Pins and LCDs with 2 controller has 16 Pins (two
pins are extra in both for back-light LED connections). Pin description is shown in
the table below.

25
Pin No. Name Description

Pin no. 1 VSS Power supply (GND)

Pin no. 2 VCC Power supply (+5V)

Pin no. 3 VEE Contrast adjust

0 = Instruction input
Pin no. 4 RS
1 = Data input

0 = Write to LCD
module
Pin no. 5 R/W
1 = Read from LCD
module

Pin no. 6 EN Enable signal

Pin no. 7 D0 Data bus line 0 (LSB)

Pin no. 8 D1 Data bus line 1

Pin no. 9 D2 Data bus line 2

Pin no.
D3 Data bus line 3
10

Pin no.
D4 Data bus line 4
11

Pin no.
D5 Data bus line 5
12

Pin no.
D6 Data bus line 6
13

Pin no.
D7 Data bus line 7 (MSB)
14
TABLE 3.2.A: PIN DISCRIPTION OF LCD

26

DDRAM - Display Data RAM:

Display data RAM (DDRAM) stores display data represented in 8-bit character codes.
Its extended capacity is 80 X 8 bits, or 80 characters. The area in display data RAM
(DDRAM) that is not used for display can be used as general data RAM. So whatever
you send on the DDRAM is actually displayed on the LCD. For LCDs like 1x16, only
16 characters are visible, so whatever you write after 16 chars is written in DDRAM

CGROM - Character Generator ROM:

Now you might be thinking that when you send an ASCII value to DDRAM, how the
character is displayed on LCD? So the answer is CGROM. The character generator
ROM generates 5 x 8 dot or 5 x 10 dot character patterns from 8-bit character codes
(see Figure 5 and Figure 6 for more details). It can generate 208 5 x 8 dot character
patterns and 32 5 x 10 dot character patterns. User defined character patterns are
also available by mask-programmed ROM.As you can see in both the code maps,
the character code from 0x00 to 0x07 is occupied by the CGRAM characters or the
user defined characters. If user wants to display the fourth custom character then
the code to display it is 0x03 i.e. when user sends 0x03 code to the LCD DDRAM
then the fourth user created character or pattern will be displayed on the LCD.

CGRAM - Character Generator RAM:

As clear from the name, CGRAM area is used to create custom characters in LCD. In
the character generator RAM, the user can rewrite character patterns by program.
For 5 x 8 dots, eight character patterns can be written, and for 5 x 10 dots, four
character patterns can be written.

BF - Busy Flag:
Busy Flag is a status indicator flag for LCD. When we send a command or data to
the LCD for processing, this flag is set (i.e. BF =1) and as soon as the instruction is
executed

27

successfully this flag is cleared (BF = 0). This is helpful in producing and exact
amount of delay for the LCD processing.To read Busy Flag, the condition RS = 0 and
R/W = 1 must be met and The MSB of the LCD data bus (D7) act as busy flag. When
BF = 1 means LCD is busy and will not accept next command or data and BF = 0
means LCD is ready for the next command or data to process.

Instruction Register (IR) and Data Register (DR):

There are two 8-bit registers in HD44780 controller Instruction and Data register.
Instruction register corresponds to the register where you send commands to LCD
e.g. LCD shift command, LCD clear, LCD address etc. and Data register is used for
storing data which is to be displayed on LCD. When send the enable signal of the
LCD is asserted, the data on the pins is latched in to the data register and data is
then moved automatically to the DDRAM andhenceisdisplayedontheLCD.
Data Register is not only used for sending data to DDRAM but also for CGRAM, the
address where you want to send the data, is decided by the instruction you send to
LCD.

4-bit programming of LCD:

In 4-bit mode the data is sent in nibbles, first we send the higher nibble and then
the lower nibble. To enable the 4-bit mode of LCD, we need to follow special
sequence of initialization that tells the LCD controller that user has selected 4-bit
mode of operation. We call this special sequence as resetting the LCD. Following is
the reset sequence of LCD.

Wait for about 20mS

Send the first init value (0x30)

Wait for about 10mS


Send second init value (0x30)

Wait for about 1mS

Send third init value (0x30)

Wait for 1mS

Select bus width (0x30 - for 8-bit and 0x20 for 4-bit)

28

The busy flag will only be valid after the above reset sequence. Usually we do not
use busy flag in 4-bit mode as we have to write code for reading two nibbles from
the LCD. Instead we simply put a certain amount of delay usually 300 to 600uS. This
delay might vary depending on the LCD you are using, as you might have a different
crystal frequency on which LCD controller is running. So it actually depends on the
LCD module you are using. In 4-bit mode, we only need 6 pins to interface an LCD.
D4-D7 are the data pins connection and Enable and Register select are for LCD
control pins. We are not using Read/Write (RW) Pin of the LCD, as we are only
writing on the LCD so we have made it grounded permanently. If you want to use it,
then you may connect it on your controller but that will only increase another pin
and does not make any big difference. Potentiometer RV1 is used to control the LCD
contrast. The unwanted data pins of LCD i.e. D0-D3 are connected to ground.

Sending data/command in 4-bit Mode:

We will now look into the common steps to send data/command to LCD when
working in 4-bit mode. In 4-bit mode data is sent nibble by nibble, first we send
higher nibble and then lower nibble. This means in both command and data sending
function we need to separate the higher 4-bits and lower 4-bits.The common steps
are:

Mask lower 4-bits

Send to the LCD port


Send enable signal

Mask higher 4-bits

Send to LCD port

Send enable signal

Das könnte Ihnen auch gefallen