can based data acquisition - western washington...
TRANSCRIPT
![Page 1: CAN Based Data Acquisition - Western Washington …eet.etec.wwu.edu/jahnsd/project/docs/ETEC471_Project_Description.pdfCAN Based Data Acquisition 8-Dec-10 ... J1939-71 document and](https://reader035.vdocuments.net/reader035/viewer/2022081605/5ae535d97f8b9a7b218f687c/html5/thumbnails/1.jpg)
Dean Jahns
ETEC 471
CAN Based Data Acquisition 8-Dec-10
1 of 10
Introduction
This project will convert physical temperature measurements into Controller
Area Network (CAN) messages following the Society of Automotive
Engineers standard, SAE-J1939, “Surface Vehicle Recommended Practice”
format. The J1939 standard is universally used in the heavy-duty trucking
and non-road vehicle industries in North America and Europe for controller to
controller communication. Any J1939 compliant data collection device will be
able to monitor and record the signals – the specific use in this case is the
engine test cell automation system at the PACCAR Technical Center.
Description
The device used for this project is a National Instruments Compact RIO
system consisting of a controller, model NI cRIO-9014, and an 8 port, 3M
gate chassis model NI-9104. To handle the I/O, 7 thermocouple modules,
model NI-9213, and one CAN module, model NI-9853, were installed into
the chassis. Each thermocouple module can accept 16 thermocouples and
the CAN module has 2 low-speed CAN channels.
The CRIO hardware is a real time microcontroller coupled with a Field
Programmable Gate Array (FPGA). The CRIO unit plugs into a chassis with
up to 8 additional slots for I/O modules, allowing for easy configuration and
reconfiguration as necessary. The chassis dimensions are 28 cm x 9 cm x 9
cm, and all modules and the controller fit within this package. See figure 1
for a photo of the hardware.
![Page 2: CAN Based Data Acquisition - Western Washington …eet.etec.wwu.edu/jahnsd/project/docs/ETEC471_Project_Description.pdfCAN Based Data Acquisition 8-Dec-10 ... J1939-71 document and](https://reader035.vdocuments.net/reader035/viewer/2022081605/5ae535d97f8b9a7b218f687c/html5/thumbnails/2.jpg)
Dean Jahns
ETEC 471
CAN Based Data Acquisition 8-Dec-10
2 of 10
Figure 1 – cRIO unit, complete
Hardware Description
The cRIO device consists of 3 main components – the real time controller or
microprocessor, the chassis which contains the FPGA gates, and the I/O
modules which handle the signal conditioning.
The controller uses a 400 MHz Freescale MPC5200 real-time processor, 128
MB of internal DRAM and 2 GB of non volatile memory. The controller itself
has a power consumption of 6W, and the chassis maximum power is 3W.
With a chassis equipped with 8 modules, the recommended power supply is
a 24 VDC 48W, as the unit will draw up to 20W during normal operation
after the inrush current on startup. The 16 channel thermocouple modules
have 24 bit resolution, can sample up to 1200 samples / second with 0.02°C
of resolution in high-res mode, and a maximum power consumption of
490mW and thermal dissipation of 840mW. The CAN module has a
maximum baud rate of 1 Megabit per second (Mbps), maximum power
consumption of 625mW, and thermal dissipation of 1W. As configured, this
unit will have a maximum power consumption of 13.055W. A basic block
diagram of the hardware and signals is in figure 2 below.
![Page 3: CAN Based Data Acquisition - Western Washington …eet.etec.wwu.edu/jahnsd/project/docs/ETEC471_Project_Description.pdfCAN Based Data Acquisition 8-Dec-10 ... J1939-71 document and](https://reader035.vdocuments.net/reader035/viewer/2022081605/5ae535d97f8b9a7b218f687c/html5/thumbnails/3.jpg)
Dean Jahns
ETEC 471
CAN Based Data Acquisition 8-Dec-10
3 of 10
Figure 2 – Hardware Layout
![Page 4: CAN Based Data Acquisition - Western Washington …eet.etec.wwu.edu/jahnsd/project/docs/ETEC471_Project_Description.pdfCAN Based Data Acquisition 8-Dec-10 ... J1939-71 document and](https://reader035.vdocuments.net/reader035/viewer/2022081605/5ae535d97f8b9a7b218f687c/html5/thumbnails/4.jpg)
Dean Jahns
ETEC 471
CAN Based Data Acquisition 8-Dec-10
4 of 10
Software Requirements
National Instruments LabVIEW software was used for this project. LabVIEW
is a proprietary graphical programming language used to develop
measurement, test and control systems using graphical icons and "wires"
connecting the icons, resembling a flowchart. National Instruments hardware
is designed to run LabVIEW applications created by the end user, and
LabVIEW contains hundreds of built-in libraries to create virtual
instrumentation to aid in rapid development of software.
The software will run a loop once per second, and will read in all the
thermocouples and transmit all necessary CAN messages once per loop. The
CAN message can hold up to 8 bytes of data per message, and there are 112
thermocouple channels, which require 2 bytes for each signal, so 28 CAN
messages will be required to transmit all the data. A flowchart of the process
is below in figure 3.
![Page 5: CAN Based Data Acquisition - Western Washington …eet.etec.wwu.edu/jahnsd/project/docs/ETEC471_Project_Description.pdfCAN Based Data Acquisition 8-Dec-10 ... J1939-71 document and](https://reader035.vdocuments.net/reader035/viewer/2022081605/5ae535d97f8b9a7b218f687c/html5/thumbnails/5.jpg)
Dean Jahns
ETEC 471
CAN Based Data Acquisition 8-Dec-10
5 of 10
Start
Case 1 to 28
Read in 4 thermocouples
from FPGA layer
Encode CAN message
Start for loop 1 to 28
Send CAN message to
FIFO buffer
End For Loop
End
Figure 3 – Main Software Loop
User Interface
When programming in LabVIEW, all the signals are automatically placed on
the top layer VI, but this project did not make much use of the LabVIEW
user interfaces. The primary use of LabVIEW VI was merely troubleshooting
the program and signal processing, as the main use of the program was to
![Page 6: CAN Based Data Acquisition - Western Washington …eet.etec.wwu.edu/jahnsd/project/docs/ETEC471_Project_Description.pdfCAN Based Data Acquisition 8-Dec-10 ... J1939-71 document and](https://reader035.vdocuments.net/reader035/viewer/2022081605/5ae535d97f8b9a7b218f687c/html5/thumbnails/6.jpg)
Dean Jahns
ETEC 471
CAN Based Data Acquisition 8-Dec-10
6 of 10
provide the correct CAN message output. The automation system that will
receive the CAN message has a configurable GUI for the test operator and
engineer to monitor, and a screenshot of this is in figure 4 - notice the
temperature tabular readouts in the lower left corner. The automation
system also has data acquisition built in to record all data to a file for post-
processing of the data.
Figure 4 – PUMA Automation System GUI
Communication Protocols
The standard SAE J1939 - Surface Vehicle Recommended Practice provides
in depth requirements for compliance, from the hardware design to the
abstract layers of the CAN message format. This project only deals with the
software side of the CAN message itself - particularly the encoding and
decoding of this message. The speed of this CAN message is 250 kbps with a
29 bit identifier, which consists of a parameter group number (PGN) and a
![Page 7: CAN Based Data Acquisition - Western Washington …eet.etec.wwu.edu/jahnsd/project/docs/ETEC471_Project_Description.pdfCAN Based Data Acquisition 8-Dec-10 ... J1939-71 document and](https://reader035.vdocuments.net/reader035/viewer/2022081605/5ae535d97f8b9a7b218f687c/html5/thumbnails/7.jpg)
Dean Jahns
ETEC 471
CAN Based Data Acquisition 8-Dec-10
7 of 10
source address, and 8 bytes of data as described in figure 5. The PGN
identifies the content of the data field and sets priority of the message.
Figure 5 - J1939 Message format
The CAN message frame components are:
• SOF - Start of Frame
• CAN-ID - 29 bit identifier, consisting of the Parameter Group Number
(PGN) and the source address
o PGN is 21 bits long, defined in the CAN database and in the SAE
J1939-71 standard
� Priority field - 3 bits, sets the priority of the message on
the network, 0 is highest priority
� Reserved - for future use, set to zero
� Data Page - used to expand the maximum number of
possible messages
![Page 8: CAN Based Data Acquisition - Western Washington …eet.etec.wwu.edu/jahnsd/project/docs/ETEC471_Project_Description.pdfCAN Based Data Acquisition 8-Dec-10 ... J1939-71 document and](https://reader035.vdocuments.net/reader035/viewer/2022081605/5ae535d97f8b9a7b218f687c/html5/thumbnails/8.jpg)
Dean Jahns
ETEC 471
CAN Based Data Acquisition 8-Dec-10
8 of 10
� PDU Format (PDU-F) - 8 bits, used to determine if the
message is intended for a specific device or the entire
network
� PDU Specific (PDU-S) - 8 bits, defined by PDU-F - if
intended for a specific device, this is the destination
address; if intended for the entire network, it is interpreted
as a Group Extension field
o Source Address - the address of the device sending the
message. Each device on the network must have a unique
address
• RTR - Remote Transmission Request
• Control - Contains data length code
• Data Field - up to 8 bytes (64 bits) in single frame, more data can be
sent in multiple frame messages
o This is where the data is transmitted, in this project 8 bytes are
used for 4 thermocouple channels, 2 bytes or 16 bit resolution
• CRC - Cyclic Redundancy Check
• ACK - Acknowledge
• EOF - End of Frame
The PGN is used as a reference lookup in the CAN database, which defines
the contents of the data field. The CAN database is defined by the SAE
J1939-71 document and describes standard parameters which are grouped
together in a message frame and given a PGN. Each parameter is described
by its length, resolution, range, type, Suspect Parameter Number (SPN), and
the PGN in which the parameter is grouped. Each PGN is described by its
transmission rate, data length, data page, PDU-F, PDU-S, priority, and the
data parameter bytes (the parameters included in the data field and their
byte order). The J1939-71 document provides a certain number of PGNs for
free use, and this project used 28 of those available PGNs to define the CAN
messages that I send.
![Page 9: CAN Based Data Acquisition - Western Washington …eet.etec.wwu.edu/jahnsd/project/docs/ETEC471_Project_Description.pdfCAN Based Data Acquisition 8-Dec-10 ... J1939-71 document and](https://reader035.vdocuments.net/reader035/viewer/2022081605/5ae535d97f8b9a7b218f687c/html5/thumbnails/9.jpg)
Dean Jahns
ETEC 471
CAN Based Data Acquisition 8-Dec-10
9 of 10
Development Plan
This project is currently underway to provide this instrumentation for my
employer, and the project will be completed long before the Spring quarter.
Week#/Year Planned activity
44 / 2010 Hardware arrived, simple assembly and begin writing code
45 / 2010 Set up FPGA for input signals
46 / 2010 Continue FPGA code development
47 / 2010 Write main control loop
48 / 2010 Continue with main control loop
49 / 2010 Set up CAN database
50 / 2010 Continue CAN database
51 / 2010 CAN message encoding
52 / 2010 CAN message encoding
1 / 2011 FIFO buffer system and FPGA configuration for output
2 / 2011 Error checking and debug
3 / 2011 Connect to automation system
4 / 2011 CAN message decoding into automation system data acquisition
5 / 2011 Error checking and debug
6 / 2011 Data collection
7 / 2011 Data collection
16 / 2011 Hardware review with class
18 / 2011 Software system presentation
21 / 2011 Code review
22 / 2011 Project Demonstration
I will be using National Instruments LabVIEW for all software code and a
CAN analysis software called CANalyzer from Vector Informatik.
For the project demonstration, I will bring the cRIO unit and several
thermocouples into the lab and the CAN message transmission can be
viewed using CANalyzer. I will also have several posters to show the
LabVIEW graphical code and the structure of the cRIO platform.
During the spring quarter for code review and other tollgates, I will present
the graphical based National Instruments LabVIEW code. This code will be
presented with a pseudo-C equivalent to demonstrate the pros and cons of
![Page 10: CAN Based Data Acquisition - Western Washington …eet.etec.wwu.edu/jahnsd/project/docs/ETEC471_Project_Description.pdfCAN Based Data Acquisition 8-Dec-10 ... J1939-71 document and](https://reader035.vdocuments.net/reader035/viewer/2022081605/5ae535d97f8b9a7b218f687c/html5/thumbnails/10.jpg)
Dean Jahns
ETEC 471
CAN Based Data Acquisition 8-Dec-10
10 of 10
using LabVIEW. If desired, a simple exercise could be developed for the
students to gain exposure to LabVIEW.
Industry Standards
SAE J1939
Electrical Specifications
• Range : minimum 0-1000°C
• Accuracy : +/- 2°C
• Data transmission rate : all messages sent at minimum 1/sec
• Power Supply : 24VDC / 50W
• Operating Temperatures : -40°C to 70°C
• Maximum Power Consumption : 13.055W
Part List
The price list is current, but the only hardware purchased for this project
were the thermocouple I/O modules and connector components, as my
employer already had all the other hardware, which was one reason for
choosing this option for the data acquisition hardware. All components were
purchased from National Instruments.
Part Number Description Power Quantity Price Total
NI cRIO-9014 Controller 6W 1 $2699 $2699
NI-9104 Chassis 3W 1 $2899 $2899
NI-9213 Thermocouple I/O 490mW 7 $999 $6993
NI-9853 CAN I/O 625mW 1 $1149 $1149
196740-01 Connector block n/a 7 $39 $273
779567-01 Backshell n/a 7 $29 $203
Total Cost of all Hardware $14216
Minus price of available hardware -$6747
Total Project Costs $7469