-------------------------Monitor------------------------
The Newsletter for PC-Based Data Acquisition and Control
Issue 107 www.windmill.co.uk June 2007
--------------------ISSN 1472-0221----------------------
Thank you for subscribing to Monitor. In this issue we
discuss how to continually log and display your vehicle's
emissions, location, speed, fuel consumption and other
values on your PC. By interfacing your laptop to the
vehicle's on-board diagnostic system you can show live
data, store it to disk, replay it later and map it.
I hope you enjoy the newsletter but should you wish to
cancel your subscription you can do so at
https://www.windmill.co.uk/newsletter.html
CONTENTS
========
* Windmill News: Displaying Real-Time Fuel Consumption
* Logging data from a vehicle to a PC
* Excel Corner
* DAQ News Roundup
________________________________________________________
________________________________________________________
Windmill News: Displaying Real-Time Fuel Consumption
________________________________________________________
Robert Kwiatkowski wanted to see his fuel consumption
whilst driving. He therefore connected a laptop to his
Ford truck and used Windmill software to collect data
from the on-board diagnostics system.
In most countries, new vehicles have to have an on-
board diagnostics system. This monitors conditions
and components that are related to vehicle emissions.
Kwiatkowski used Windmill to collect Mass Air Flow and
Vehicle Speed readings. He set Windmill to
automatically send the data to Excel where the fuel
consumption was calculated.
Modern vehicles use data from oxygen sensors to control
the air to fuel ratio. This ratio is set at the
chemically ideal value of 14.7 grams of air to every gram
of gasoline. The Mass Air Flow is the mass of air
consumed in grams per second. Kwiatkowski used this
information to convert the Mass Air Flow to gallons per
hour and then calculate miles per gallon. He set Windmill
to route the readings to Excel which performed the
necessary calculations and showed the current
fuel-consumption.
Although the system is designed to show real-time fuel
consumption, all the data can be logged and reviewed
later. Windmill can also record GPS co-ordinates
alongside the vehicle data. Other data could be recorded,
such as emissions. This means that the system could be
adapted to show emission maps of journeys through
specific areas.
Further Reading
===============
Robert Kwiatkowski has produced a step-by-step guide to
replicating his system which he has kindly made available
at https://www.windmill.co.uk/obdii.pdf
For an overview of using Windmill with OBD systems see
https://www.windmill.co.uk/obd.html
________________________________________________________
________________________________________________________
Logging Data from a Vehicle to a PC
________________________________________________________
All modern cars have an on-board diagnostics system. This
is known as OBD-II, EOBD or JOBD depending on whether the
car uses the American, European or Japanese system. All
these systems work in a similar manner.
In today's engines sensors monitor the operation of
specific components whilst actuators maintain optimal
engine control. An on-board computer, sometimes known as
a "powertrain control module" (PCM) or an "engine control
module" (ECM), controls these systems. The sensors and
actuators, along with the diagnostic software in the
on-board computer, make up the OBD system. The on-board
diagnostics make their data available to you through a
16-pin port.
The OBD is primarily an emissions control system. However,
as you can access all the sensor readings you can use it
for many applications. Our opening story told of how it
could be used to display fuel-consumption in real-time on
a PC. There may be as many as 300 readings available
from your vehicle: including engine rpm, vehicle speed,
emitted oxygen, intake air temperature and ignition
timing. Add a GPS receiver and you could log the
location of each reading.
*
How to Get the OBD Data into your Laptop
========================================
1. You need an interface to connect the vehicle's
on-board computer to your laptop. Although the
on-board diagnostics are standard across cars, the
interface isn't. You need to buy one that matches your
vehicle. Connect the interface between the vehicle's
16-pin diagnostic port and one of the laptop's ports.
2. You need some software, like Windmill, to request data
from the OBD, read the response and log, display and
distribute the data. The free Windmill 4.3 software
reads ASCII data from the PC's COM port. So if you
plan to use Windmill make sure your interface can be
plugged into the COM (RS232) port and transmit ASCII
data. With Windmill you can read any of the OBD
information: the standard stuff and any extras
provided by your vehicle manufacturer.
3. You will need to perform some calculations on the data
so a spreadsheet like Excel would be useful.
*
The Structure of the OBD Data
=============================
To obtain data send a request then wait for a response.
Commands to Request Data...
-------------------------------
A command to request data is usually two or three bytes
long, but the OBD standard allows for up to seven. The
requests are sent in hexadecimal.
The first byte sent is the Mode byte. There are nine
modes of operation in the OBD standard. For regularly
logging data you will generally use Mode 1: Show Current
Data. So start all your requests for data with "01".
The next byte describes the information wanted. You
specify this with a "PID" code. PID stands for parameter
identification number and is a hexadecimal number. Here
are some of the PIDs you might use. For a full table
download https://www.windmill.co.uk/obdii.pdf and see
Appendix C.
PID Description (Number of bytes returned)
05 Engine Coolant Temperature (1 byte)
0A Fuel Pressure (1 byte)
0B Intake Manifold Pressure (1 byte)
0C Engine RPM (2 bytes)
0D Vehicle speed (1 byte)
0F Intake air temperature (1 byte)
10 MAF air flow rate (2 bytes)
1F Run time since engine start (2 bytes)
2F Fuel Level Input (1 byte)
31 Distance traveled since codes cleared (2 bytes)
33 Barometric pressure (1 byte)
46 Ambient air temperature (1 byte)
To request a vehicle speed reading, therefore, you would
send 010D.
Finally you may need to tell your interface that you have
finished the request message. The character to do this
depends on your interface: in ELM interfaces it is a
carriage return. Some interfaces require you to send a
fixed number of bytes so no ending character is required.
Once configured Windmill Software regularly sends this
command to the OBD interface and stores the reading
received.
How to Interpret the Data Received...
-----------------------------------------
In our above speed reading, the message returned would be
in this format:
41 0D 37
41 - shows a response (4) from a Mode 1 request
0D - the PID of the measurement, speed in our case
37 - the data value in hexadecimal
With Windmill we would extract the data value from the
rest of the message. So we might tell it to ignore six
characters then extract two.
For speed just one hexadecimal number is returned. Other
types of data may return 2 or 3 hexadecimal numbers
(bytes). See the table above for details.
We now need to convert the hexadecimal value to decimal.
If using Windmill we could send the data to Excel (or
another analysis program) and perform the conversion
there using the HEX2DEC command.
Finally, you may need to apply a scale and an offet
to the results. You can get the Windmill software
to do this before it presents the results, or you
could do so after data collection in Excel.
*
Further Reading
===============
A guide to configuring Windmill for OBD systems
https://www.windmill.co.uk/obd.html
Getting Data from Windmill into Excel
https://www.windmill.co.uk/excel/
________________________________________________________
________________________________________________________
Excel Corner
________________________________________________________
We've updated our Excel pages on the Windmill web site to
reference all the tips and tricks we have been giving you
in these newsletters over the last 6 years. For tips on
using Excel charts see
https://www.windmill.co.uk/excel/excel-charting.html and for help using
Excel for data acquisition and analysis see
https://www.windmill.co.uk/excel/
If you have a question about using Excel for data
acquisition then fill our form at
https://www.windmill.co.uk/excel/
________________________________________________________
________________________________________________________
DAQ News Roundup
________________________________________________________
Welcome to our roundup of the data acquisition and
control news. If you would like to receive more
timely DAQ news updates then grab our RSS newsfeed
at https://www.windmillsoft.com/monitor.xml. Read
https://www.windmill.co.uk/newsfeed.php for notes
on how to display the news on your own web site,
read it via e-mail, mobile phone or a newsfeed viewer.
First Buoy to Monitor Ocean Acidification Launched
The first buoy to monitor ocean acidification has
been launched in the Gulf of Alaska. Attached to the
buoy are sensors to measure climate indicators. These
transmit their readings via satellite. The instruments
will measure the air-sea exchange of carbon dioxide,
oxygen and nitrogen gas in addition to the pH. The
buoy is anchored in water nearly 5,000 meters deep.
Source: National Science Foundation
http://www.nsf.gov/news/news_summ.jsp?cntn_id=109619
Thirsty Crops to Signal Farmers
Corn and potato crops may soon provide information
to farmers about when they need water and how much
should be delivered, thanks to a University of
Colorado invention. The technology includes a tiny
sensor that can be clipped to plant leaves charting
their thickness, a key measure of water deficiency
and accompanying stress. Data from the leaves could
be sent wirelessly over the Internet to computers
linked to irrigation equipment, ensuring timely
watering and cutting down on excessive water and
energy use.
Source: University of Colarado at Boulder
http://www.colorado.edu/news/releases/2007/244.html
New Quality Measurement Data Standard
National Institute of Standards and Technology
(NIST) researchers have completed work on a new data
specification that will allow compliant products to
store and exchange measurement data from process-
monitoring instruments in a completely open and non-
proprietary format. Widespread use of the new quality
measurement data (QMD) specification, which defines
the information exchanged between factory floor
measurement instruments and Statistical Process
Control (SPC) software, should provide substantial
savings to quality systems users and their suppliers
throughout the manufacturing sector.
Source: NIST
http://www.isd.mel.nist.gov/
Research Tower Could Aid Tracking Of Contaminant Plumes
America's first network of research instruments to
predict urban movements of toxic or radioactive
contaminants is being completed in Washington DC.
Using data from the new network, scientists expect to
create and test computer models that would calculate
a contaminant plume's spread. The new monitoring
station will include a device called a sonic
anemometer that uses high-frequency sound waves to
measure wind velocity in all directions simultaneously
at brief time intervals. With such data, scientists
can analyze local air turbulence that strongly
influences where and at what rate airborne
contaminants spread in an urban environment.
Source: AGU
http://www.agu.org/
Steady Growth in Worldwide PLCs Market
IMS Research forecasts that the worldwide market
for PLCs will grow steadily to surpass $9 billion by
2011, growing at around 5.0% per year. The Asia
Pacific region is forecast to experience the strongest
growth, with an estimated compound annual growth rate
of 7.9%.
Source: IMS
https://technology.ihs.com/members/pr.asp?X=372
________________________________________________________
________________________________________________________
* Copyright Windmill Software Ltd
* Reprinting permitted with this notice included
* For more articles see https://www.windmill.co.uk
We are happy for you to copy and distribute this
newsletter, and use extracts from it on your own web site
or publication, providing the above notice is
included and a link back to our website is in place.
An archive of previous issues is at
https://www.windmill.co.uk/newsletter.html
and an index of articles at
https://www.windmill.co.uk/newsletter.html
Windmill Software Ltd, PO Box 58, North District Office,
Manchester, M8 8QR, UK
Telephone: +44 (0)161 833 2782
Facsimile: +44 (0)161 833 2190
E-mail: [email protected]
https://www.windmill.co.uk/
https://www.windmillsoft.com/
Do you have a question, comment or suggestion on this
newsletter? Fill in this form to contact the editor.
Previous Issue
Next Issue