Professional Documents
Culture Documents
LCD
Temperature
sensor pic16f877a
Relay
Fan
PIC microcontroller
This presentation contains illustrations from the book
‘Programming 8-bit PIC Microcontrollers in C’
Input Output
User input Peripherals CPU Peripherals User output
Central
Processing
ROM Unit RAM
Program Read Only Read & Write
download Memory Memory
Program address
EEPROM
Instruction MCU 256 bytes
Decode & control
CPU control lines
Ports, Timers
ADC, Serial I/O
Timing control
Clock Reset
Port A B C D E
003h Status Reg 083h Status Reg 103h Status Reg 183h Status Reg
004h File Select 084h File Select 104h File Select 184h File Select
006h Port B data 086h PortB direction 106h Port B data 186h PortB direction
Output Output
CPU Data Bus
Data Current
Latch Driver
Write data bit
Input
Data
Read data bit Latch
Analogue input
multiplexer
Capture signal
Capture register
Timer
Instruction Clock Overflow/
Clock Pre-scaler Post-scaler
Timeout
Source (clock Binary Counter (output
(Interrupt)
Select divide) divide)
Flag
External Pulse
Vc+
Compartor
status bit
Vc- Vc+ > Vc-
The comparator simply sets a bit if one input is higher than the other
Figure 1.8 Parallel Slave Port operation
EXTERNAL INTERNAL
Data x 8 Data x 8
Program Execution
1 2
Start counter Run
statement Counter
until
overflow
Program Execution
3
Timeout
Interrupt
4
Jump to
ISR
7
Continue
5
Time-out
Process
(Interrupt
Service 6
Routine) Return
from
Interrupt
HOST PC
PIC MCU
Bit period
0
Time
Idle Start Bit Bit Bit Bit Bit Bit Bit Bit Stop
Bit 0 1 2 3 4 5 6 7 Bit
The data bits are timed from the falling edge of the start bit
Figure 1.12 SPI Connections
Master
Slave 1 Slave 2
SDO SDO
SDI SDI
SCK SCK
!SS !SS
SCK Clock
SDA
SCL
Start Acknowledge
Address / Data bits
SDA 7 6 5 4 3 2 1 0
SCL
Application Board
Reset
MCU
10k
1 Vpp/!MCLR
ICSP Vdd
2
Interface Vss
3
4 PGD
5 PGC
Vdd Vss
Board +5V Supply
Host PC
MPLAB PIC MCU
development ICD2 Target
system USB interface System
6-WAY
+ C Compiler connector
A 16x2 LCD means it can display 16 characters per line and there are 2 such
lines. In this LCD each character is displayed in 5x7 pixel matrix. This LCD
has two registers, namely, Command and Data.
6 Sends data to data pins when a high to low pulse is given Enable
7 DB0
8 DB1
9 DB2
10 DB3
8-bit data pins
11 DB4
12 DB5
13 DB6
14 DB7
15 Backlight VCC (5V) Led+
16 Backlight Ground (0V) Led-
Block Diagram of LCD Display
Temperature Sensor - LM35
Features of LM 35
• TYPES
✓ ACTIVE FILTER
✓ PASSIVE FILTER
REGULATOR
• A voltage regulator is designed to automatically maintain a constant
voltage level. A voltage regulator may be a simple “Feed-forward" design
or may include negative feedback control loops.
The AC mains are fed to the transformer, which steps down the 230 Volts
to the desired voltage. The bridge rectifier follows the transformer thus
converting AC voltage into a DC output and through a filtering capacitor
feeds it directly into the input (Pin 1) of the voltage regulator. The common
pin (Pin 2) of the voltage regulator is grounded. The output (Pin 3) of the
voltage regulator is first filtered by a capacitor, and then the output is taken.
Make the circuit on a general purpose PCB and use a 2 Pin (5A) plug to
connect the transformer input to the AC mains via insulated copper wires.
RELAY
What is relay
Relays are simple switches which are operated both electrically and mechanically.
Relays consist of a n electromagnet and also a set of contacts. The switching
mechanism is carried out with the help of the electromagnet.
The main operation of a relay comes in places where only a low-power signal
can be used to control a circuit. It is also used in places where only one signal can be
used to control a lot of circuits.
They were used to switch the signal coming from one source to another
destination. After the invention of computers they were also used to perform Boolean
and other logical operations. The high end applications of relays require high power to
be driven by electric motors and so on. Such relays are called contactors.
HOW RELAY WORKS?
The working of a relay can be better understood by explaining the following
diagram given below.
The diagram shows an inner section diagram of a relay. An iron
core is surrounded by a control coil. As shown, the power source is given to
the electromagnet through a control switch and through contacts to the load.
When current starts flowing through the control coil, the electromagnet
starts energizing and thus intensifies the magnetic field. Thus the upper
contact arm starts to be attracted to the lower fixed arm and thus closes the
contacts causing a short circuit for the power to the load. On the other hand,
if the relay was already de-energized when the contacts were closed, then
the contact move oppositely and make an open circuit.
Applications
• Can be used in factory automation.
• Can be use machine control.
• Chemical process, electric trains, robotics and
manipulators.
Conclusion
• This paper elaborates the design and
construction of fan speed control system to
control the room temperature. The
temperature sensor was carefully chosen to
gauge the room temperature. Besides, the PIC
microcontroller had been used to control the
fan speed, the fan speed in rpm and the room
temperature was successfully programmed
using C Language and their values displayed
on LCD.
References
• F. Zafrin, “Design and fabrication of infrared remote
controlled switch and sequential speed control of an
electrical load”, B.sc. Engineering project, RUET, July 2011.
• Vaibhav Bhatia, Gavish Bhatia,” Room Temperature based
Fan Speed Control System using Pulse Width Modulation
Technique,” International Journal of Computer Applications
(0975 – 8887), Volume 81 – No5, November 2013.
• http://en.wikipedia.org/wiki/PIC_microcontroller access on
22/1/2016.
• http://www.electrical4u.com/working-or-
operatingprinciple-of-dc-motor/ access at 25/1/2016