Professional Documents
Culture Documents
Two PIC microcontrollers are used; both having the CAN III. HARDWARE
protocol in built in it.
A. Peripheral Interface Controller (PIC)
II. LITERATURE REVIEW PIC [7] is a family of Harvard architecture microcontrollers
TABLE I
made by Microchip Technology to control peripheral devices,
HISTORY OF CAN [13] alleviating the load from the main CPU. Compared to a human
being, the brain is the main CPU and the PIC is equivalent to
1985 Start of development of CAN at Robert the autonomic nervous system. PIC is very cost effective,
Bosch GmbH that is the different model PIC’s are available with
1986 V1.0 specification of CAN proportional cost. There is chance to choose the PIC suitable
1991 Specifications of the extended CAN2.0 for the application. When operated at its maximum clock rate
protocol Part 2.0A –11-bit identifier Part a PIC executes most of its instructions in 0.2 microseconds or
2.0B –29-bit identifier (extended frame 5 instructions / microsecond. [6] A watchdog timer resets the
format) PIC if the chip ever malfunctions and deviates from its normal
1992 CAN in Automation (CiA) established as operations. Three versatile timers can be characterizing inputs,
the international users and manufacturers control outputs and provide internal timings for program
group execution. Up to 12 independent interrupt sources [4], which
1993 First car, a Mercedes S-class, equipped with can provide useful interrupting as and when needed.
CAN Ultraviolet erasable, programmable parts support
1994 First standardization at ISO is completed development. Lower cost on time programmable parts support
1995 CAN open protocol introduced both small and large productions runs. The PIC micro
1998 Development phase of time-triggered CAN controller has a number of inbuilt modules like ADC, CAN
(TTCAN) networks that increase versatility of micro controller.
1999 Explosion of CAN-linked equipment in all
motor vehicle and industrial applications B. CAN Transceiver
Fairchild et al., [15] in 2002 and Johnson et al., in 2004, in The MCP2551 [8] shown in Fig.2 is a high-speed CAN,
their research paper published that the engine temperatures fault-tolerant device that serves as the interface between a
generally do not exceed 110oC, and exhaust system CAN protocol controller and the physical bus. The MCP2551
components can reach upwards of 600oC. provides differential transmit and receive capability for the
Jakob Axelsson et al., [16] in 2003 done a comparative case CAN protocol controller and is fully compatible with the ISO-
study of distributed network architectures for different 11898 standard, including 24V requirements. It will operate at
automotive applications and published a table indicating this,
speeds of up to 1 Mb/s. Typically, each node in a CAN system
which is shown in Table II.
TABLE II
must have a device to convert the digital signals generated by
COMPARITIVE CASE STUDY a CAN controller to signals suitable for transmission over the
bus cabling (differential output).
C. LM7805
The operating voltage range of PIC18F458 is 2.0V to 5.5V.
So LM7805 which is a +5.0V 1A voltage regulator, is used. It
is a linear voltage regulator that produces a relatively constant
output voltage of +5VDC. There is an input pin, which must
generally be greater than +7VDC, a ground pin, and an output
pin as shown in Fig.6.
2
R2
VCC 10K
SW1
1
PIC18F458 VCC RESET
1 2 1 R3 2 MCLR
R1
MCLR C2
10K
1 40
MCLR RB7
1
2 39 3 4
TEMP sensor RAO RB6 U2
3 38 10uF /63V
Battery v olt RA1 RB5 +
4 37 1 8 R
5 RA2 RB4 36 2 TXD RS 7 C3
6 RA3 RB3 35 3 v ss CANH 6
7 RA4 RB2 34 4 v dd CANL 5 CANH 2
8 RA5 RB1 33 RXD VREF
J1
9 RE0 RB0 32
10 RE1 VDD 31 1
RE2 VSS mcp 2
11 30
12 VDD RD7 29 CON2
VSS RD6
Y2
13
14
15
OSC1
OSC2
RD5
RD4
28
27
26
EnableLCD
Fig.7. MCLR circuit
C3 C4
CO2
LDR
16
17
RC0
RC1
RC2
RC7
RC6
RC5
25
24
RS_LCD
R3
R
The behavior of the ESD protection on the MCLR pin
DBO
18
19
20
RC3
RD0
RC4
RD3
23
22
21 J2
differs from previous devices of this family. Voltages applied
to the pin that exceed its specification can result in both Resets
RD1 RD2 UART_RX
DB1 1
2
DB2
pic18f
UART_TX
CON2 and current draws outside of device specification during the
DB3 CANL
Reset event. For this reason, Microchip recommends that the
MCLR pin no longer be tied directly to VDD. The use of an
RC network, is suggested.
Fig.4.Engine side schematic III. MONITORING SYSTEM
The second PIC18F458 is connected to CAN Transceiver at
the dashboard side as shown in the Fig.5. An external key is A. Temperature sensor LM35
connected to RB7. By pressing this key, it can request data The LM35 is an integrated circuit sensor [11] shown in
from engine. This data can be seen through LCD. Fig.8 that can be used to measure temperature with an
VCC
electrical output proportional to the temperature (in oC). It
PIC18F458
KEY
VCC
measures temperature more accurately than a using a
MCLR
1
MCLR RB7
40 C2
R1
thermistor. The sensor circuitry is sealed and not subject to
oxidation, etc. The LM35 generates a higher output voltage
2 39
3 RAO RB6 38 U2
4 RA1 RB5 37 1 8 R
5 RA2 RB4 36 2 TXD RS 7
0.1 oC temperature rise in still air. The sensor has a sensitivity C. Battery voltage
of 10mV / oC. The operating voltage range of PIC18F458 is 2.0V to 5.5V.
U6 LM35 So a 5.1V Zener diode is connected to get a regulated output
voltage as shown in Fig.11.
GND
Vout
+5V
Vs
1
2
3
TEMPERATURE
data bus is used, the LCD will require a total of 11 data lines microcontroller’s receiver pin. MAX232 needs four external
(3 control lines plus the 8 lines for the data bus). When RS is capacitors whose value ranges from 1µF to 22µF.
low (0), the data is to be treated as a command or a special
instructions (such as clear screen, position cursor, etc). When
RS is high (1), the data being sent is text data which should be
displayed on the screen. R/W input allows the user to write
information to LCD or read information from it. When RW
line is low (0), the information on the data bus is being written
to the LCD. When R/W is high (1), the program is registers
effectively querying (or reading) the LCD. The enable Pin is
used by the LCD to latch information at its data pins. When
data is supplied to data pins, a high to low pulse must be
applied to this pin in order for the LCD to latch the data
present in the data pins. We have to prepare an LCD properly
before the character we need, has to be displayed. For this a
number of commands have to be provided to the LCD before
inputting the required data. LCD doesn’t know about the
content (data or commands) supplied to its data bus. It is the Fig.13. MAX232 circuit
user who has to specify whether the content at its data pins are IV. DESIGN OF CAN BASED MONITORING SYSTEM
data or commands. Here 2 ports PORT B and PORT C of PIC
18F458 are taken. PORT B is used for providing control A. AT THE ENGINE SIDE
signals and PORT C is used for providing Data signals.
CAN 2.0B is a network protocol that was specially
F. Universal Synchronous Asynchronous Receiver developed for connecting the sensors, actuators and ECUs of a
Transmitter vehicle. CAN 2.0B supports data rates from 5kbps to 1Mbps,
The Universal Synchronous Asynchronous Receiver which allows the CAN network to be used to share status
Transmitter (USART) module is one of the three serial I/O information and real time control. It can transfer upto 8 data
modules incorporated into PIC18FXX8 devices. (USART is bytes within a single message.
also known as a Serial Communications Interface or SCI.) The In this project 2 nodes are used for monitoring
USART can be configured as a full-duplex asynchronous parameters. The various sensors used are temperature, battery
system that can communicate with peripheral devices, such as voltage, LDR and CO sensors. Temperature and battery
CRT terminals and personal computers, or it can be voltage are connected to ADC. LDR and CO2 sensors are
configured as a half-duplex synchronous system that can connected to digital ports. Values are transferred to
communicate with peripheral devices, such as A/D or D/A microcontrollers in the dashboard from ADC and digital ports
integrated circuits, serial EEPROMs, etc. The USART can be via CAN Protocol at an interval of 10 seconds and is displayed
configured in the following modes: in the LCD. Also the message can be seen through computer
• Asynchronous (full-duplex) via UART. If any data is required by the dashboard, the CAN
• Synchronous – Master (half-duplex) controller at the engine side checks the identifier transmitted
• Synchronous – Slave (half-duplex). by it. After 10 seconds, the engine side controller sends the
The SPEN (RCSTA register) and the TRISC<7> bits have to required data to the dashboard. The flowchart is shown in
be set and the TRISC<6> bit must be cleared in order to Fig.14.
configure pins RC6/TX/CK and RC7/RX/DT as the USART.
The MAX232 IC is used to convert the TTL/CMOS logic
levels to RS232 logic levels during serial communication of
microcontrollers with PC. The controller operates at TTL logic
level (0-5V) whereas the serial communication in PC works
on RS232 standards (-25 V to + 25V). This makes it difficult
to establish a direct link between them to communicate with
each other. The intermediate link is provided through
MAX232 which is shown in Fig.13. It is a dual driver/receiver
that includes a capacitive voltage generator to supply RS232
voltage levels from a single 5V supply. Each receiver converts
RS232 inputs to 5V TTL/CMOS levels. These receivers
(R1 & R2) can accept ±30V inputs. The drivers (T1 & T2),
also called transmitters, convert the TTL/CMOS input level
into RS232 level. The transmitters take input from controller’s
serial transmission pin and send the output to RS232’s
receiver. The receivers, on the other hand, take input from
transmission pin of RS232 serial port and give serial output to
6
Fig.14.Flow chart for CAN based monitoring in the engine Fig.15.Flow chart for CAN based monitoring in the dashboard
7
V. RESULTS AND CONCLUSIONS The Handbook of Networked and Embedded Control Systems
Control Engineering, 2005, VI, pp.741-76
This thesis is concerned about implementation of CAN [2] Renjun Li, Chu Liu and Feng Luo, “A Design for Automotive
nodes for monitoring parameters. The monitoring parameters CAN Bus Monitoring System”, IEEE Vehicle Power and
Propulsion Conference (VPPC), September 3-5, 2008, Harbin,
are temperature, battery voltage, light due to spark or fire and China
CO level in the exhaust. For monitoring the above parameters, [3] CAN specification version 2.0. Robert Bosch GmbH, Stuttgart,
LM35 sensor, 9V battery, LDR and MQ6 sensors are used. Germany, 1991.
For implementing this, the programming of LED, ADC and [4] Wilfried Voss, “A Comprehensible Guide to J1939”, Published by
Copperhill Technologies Corporation
LCD interfacing with microcontroller is done using Embedded [5] Steve Corrigan, “Introduction to the Controller Area Network”,
C. Then the Simulation results are obtained using Proteus Published by Texas Instruments Application Report,SLOA101A,
professional schematic software. The programming of August 2002–Revised July 2008
microcontroller interfacing using CAN Protocol is verified [6] O. González, M. Rodríguez, A. Ayala, J. Hernández and S.
Rodríguez, “Application of PICs and microcontrollers in the
using a general purpose board. Hardware schematic is drawn measurement and control of parameters in industry”, Proc of the
using OrCAD. Implemented hardware and software is ported International Journal of Electrical Engineering Education 41/3,
to it. pp.265-274, Feb 2001
The temperature of the engine, battery voltage, presence of [7] Microchip Technology Inc. DS41159E: PIC18FXX8 Data Sheet
Pat Richards, “A CAN physical layer discussion”, Microchip
light and CO level in the exhaust are transferred from engine Technology Inc. DS00228A
to dashboard via CAN Protocol and these readings are [8] Dogan Ibrahim, “Microcontroller based temperature monitoring
displayed through LCD on the dashboard. An external key is and control”, ISBN: 0750655569, Elsevier Science & Technology
connected to the dashboard for requesting data from engine Books
when required. When key is pressed the requesting data are [9] P.M. Knoll and B.B. Kosmowski, “Liquid crystal display unit for
reconfigurable instrument for automotive applications”, Opto-
transmitted from the engine and displayed through LCD. The Electronics Review, 10(1), 75 (2002)
complete hardware setup is shown in Fig.15. [10] MCP 2551 High speed CAN Transceiver Datasheet.
[11] National Semiconductor, “LM35 Precision Centigrade Temperature
Sensors Data sheet”, National Semiconductor Corporation,
November 2000.
[12] MQ-6 Gas sensor Datasheet.
[13] J.Axelsson, J.Froberg, H.A.Hansson, C.Norstrom, K.Sandstorm and
B.Villing, “Correlating Bussines Needs and Network Architectures
in Automotive Applications – a Comparative Case Study”,Proc of
FET’03,pp.219-228, July 2003.
[14] BS IV regulations April 2010.
[15] Fairchild, Ray, M., Snyder, Rick B., Berlin, Carl W.,Sarma, D. H. R
“Emerging Substrate Technologies for Harsh-Environment
Automotive Electronics Applications", Society of Automotive
Engineers Technical Paper Series 2002-01-1052(2002).
[16] Johnson, R. Wayne, Evans, John L. Jacobsen, Peter, Thompson,
James R, Christopher, Mark. "The Changing Automotive
Environment: High-Temperature Electronics", IEEE Transactions
on Electronics Packaging Manufacturing pp.164-176, 27(2004 )
REFERENCE
[1] Karl Henrik Johansson, Martin Törngren, and Lars Nielsen,
“Vehicle Application of Controller Area Network”.proc of