This is only a preview of the February 2009 issue of Silicon Chip. You can view 32 of the 104 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Articles in this series:
Items relevant to "Tempmaster Electronic Thermostat Mk.2":
Articles in this series:
Items relevant to "10A Universal Motor Speed Controller, Mk.2":
Items relevant to "Programmable Time Delay Flash Trigger":
Items relevant to "Multi-Purpose Car Scrolling Display, Pt.3":
Purchase a printed copy of this issue for $10.00. |
Pt.3: By Mauro Grassi
Multi-Purpose Car
Scrolling Display
User Software Instructions & Features Descriptions
In Pt.3 this month, we describe how the MultiPurpose Car Scrolling Display is connected
to the car and used. It’s driven using a simple
command-line program.
W
HEN YOU HAVE built and tested
the PC boards and installed the
driver and software as explained in last
month’s article, you will then need to
use the host program for calibration,
to change preferences and to set up
the features of the display.
This is done using a PC (a laptop
is preferable if the device is already
installed in a car), a USB cable and
the command line program for Windows: cardisplay.exe (downloadable
from the SILICON CHIP website at www.
siliconchip.com.au).
78 Silicon Chip
There are many user-changeable
settings but the software is organised
into multiple-choice menus which
should make it clear to use. We should
point out that in most cases, the default
values will not need changing – you
can use them as they are.
Aside from the main features described in the December 2008 issue
of SILICON CHIP, there are several other
features. These are battery protection
(if using a car’s battery as the power
source), dependent variables and
limit condition messages. The latter
are messages that, in the two scrolling
display modes, will alert you when a
variable is too low or too high. As previously mentioned, in Static Display
mode, flashing and reversed modes
indicate the limit conditions.
With dependent variables, you can
display temperature in both degrees
Celsius and Fahrenheit. More generally, you can display the same reading
in different units, or show a corrected
speed reading, for example.
When using the display in a car,
with the car’s battery supplying power,
you can enable battery protection to
switch off the display when the battery level drops below a set minimum.
The display will then go into standby
mode with a current drain typically
around 10mA.
This mode is also recommended if
siliconchip.com.au
you want to use running totals that
persist over many on/off cycles.
Connecting Sensors
The Car Scrolling Display can monitor up to six different sensors. For a
Voltage/Resistance sensor, connect the
output of the sensor to one of the four
input channels on CON3 (referred to
as AN0-AN3). For a sensor with a varying voltage (eg, oxygen sensor), you
should connect its ground reference
to pin 6 of CON3. For a sensor with
a varying resistance (eg, thermistors),
you should connect its other end to
pin 1 of CON3 (+5V rail).
For a Frequency/Duty Cycle sensor,
connect the output of the sensor to one
of the two input channels on CON2
(referred to as FQ0-FQ1). You should
also connect the ground reference to
pin 1 of CON2. If you want to measure
fuel injector duty cycle, for example,
connect the fuel injector signal to
one of the input pins of CON2 – see
Table 1.
Connecting Relays & Buzzers
If you plan on using at least one of
the two digital output channels for
switching a relay or buzzer on a limit
condition (a reading that is too high
or too low), you should connect the
relay or buzzer to CON4.
Note that if you are powering the
Car Scrolling Display solely from USB
power (+5V) then neither relays nor
buzzers will work on the output channels, because they take their positive
supply from pin 4 of CON1 (the power
supply input pin). Using USB power
only does allow you to do everything
else though, including data logging
and powering the display.
There are two relay/buzzer outputs,
referred to here as Output 0 and Output 1. Output 0 corresponds to pins
1 (-) and 2 (+) of CON4 while Output
1 corresponds to pins 3 (+) and 4 (-)
of CON4. For relays, which are not
polarised, the coil is connected across
pins 1 & 2 or across pins 3 & 4. You
should connect buzzers with the correct polarity, however.
Connecting The Supply
There are two options when connecting power. One way is to connect
the ignition-switched +12V supply
from your car’s battery to pin 4 of
CON1 while connecting the negative
terminal of the battery to either pin 2
or 3 of CON1 (it is immaterial which).
siliconchip.com.au
Physical Channel
Physical Input Pin
Measurement Type
0 (AN0)
Pin 5 of CON3
Voltage/Resistance
1 (AN1)
Pin 4 of CON3
Voltage/Resistance
2 (AN2)
Pin 3 of CON3
Voltage/Resistance
3 (AN3)
Pin 2 of CON3
Voltage/Resistance
4 (FQ0)
Pin 2 of CON2
Frequency/Duty Cycle
5 (FQ1)
Pin 3 of CON2
Frequency/Duty Cycle
Table.1: this table shows the pin-outs of the six channels. You connect the output
of your sensor to either CON2 or CON3, depending on whether it is a voltage/
resistance sensor or a frequency/duty cycle sensor – see text.
You then connect the positive battery
terminal to pin 1 of CON1 (for battery
level measurements).
With this configuration, the “off”
state current drain (the current drain
when the Car Scrolling Display has
shut down) is very small and is essentially determined by the 66kΩ
loading on the battery sense input (the
input impedance of the ADC input,
which is very high, is in parallel with
the 10kΩ resistor). It works out to be
roughly 200μA.
Unfortunately, with this power supply connection, three features of the
Car Scrolling Display will not be available: battery protection, automatic
shutdown and wake-up, and persistent
running totals (see below for explanations of these features).
For cars that are driven frequently,
say at least once a week, and to ensure
all features of the Car Scrolling Display
will function correctly, you should
reverse the positive supply connections. In other words, connect the
(unswitched) +12V battery line to pin
4 of CON1 and the ignition-switched
+12V to pin 1 of CON1.
The only penalty is that when the
Car Scrolling Display shuts down (for
example, when you switch off the
ignition), the display will still draw
standby current – around 10mA. If that
is a problem, you will need to connect
the display to the car’s battery in the
alternative way described above.
Connecting A Computer
The next thing to do is to connect
the Car Scrolling Display to a computer
running Windows, using a USB cable.
You can do this at any time to change
settings, calibrate the sensors and to
do real-time data-logging.
In last month’s article, we guided
you through the installation of the
Windows Driver, and the PC host program. You may want to create a short-
Fig.1: this screen grab from Windows
XP shows the properties of the
command prompt shortcut used
with the program cardisplay.exe.
We suggest you use size 16 Lucida
Console font, while the window width
should be 125 and the height 58.
cut to the command window to go on
your Windows Desktop. The guggested
settings are shown in Fig.1. Change
these by right clicking on the shortcut
icon and going to “Properties”.
The line width should be at least
120 characters, as the program can
output some very long lines, which
will otherwise wrap around and be
difficult to read.
When cardisplay.exe is run without
command line options, it will display
the help message listing the available
options. The full list of command line
options is shown in Table.2.
Setting Name & Unit Strings
Each of the four values of each variable has an associated name and unit
string. The default name strings are
of the form VarD(N) where D is the
February 2009 79
Fig.2: typical limit condition messages in the two scrolling modes. When a
reading is below the minimum or above the maximum, you will periodically be
warned about this. You set the minimum and maximum values by running the
command cardisplay -v and choosing the “Change the Minimum & Maximum
Values & Hysteresis” option.
variable number (0-5) and N is the
value number (0-3). For example, the
default name of reading 2 of variable 3
is Var3(2). The default unit strings are
similarly of the form UnitD(N).
For example, if you are measuring
engine RPM, you could choose the
name “Engine Revs” and the unit
“RPM”. To do this, run the command:
cardisplay -v and choose the “Change
the Name and Unit of the Variable”.
Once you’ve chosen the variable name
and its units, select the “Exit and Save”
option and they will be saved to nonvolatile memory.
Remember that you will also need to
add the reading to the display queue
as explained in the section titled
“Changing The Displayed Readings &
Their Order” (see below), for it to be
displayed.
Setting Minimum &
Maximum Values
Fig.3: this screen grab was obtained by running the command cardisplay -o. It
shows the output configuration menu and this is used to set up the two digital
outputs to drive buzzers or relays, depending on limit conditions. In this
example, the second output is disabled, while the first output controls a relay
that will switch off when the battery voltage drops below 11.0V.
Fig.4: how to use the command cardisplay -o to set up a relay connected to
Output 1. In this example, we have followed the prompts to set up the relay to
switch on when the battery voltage exceeds the set maximum value of 13.8V. The
choices are made at each step by pressing the appropriate key (we’ve selected
options b, b, a, g & d here). Choose “Exit & Save” for the changes to take effect.
80 Silicon Chip
Next, you can also set the minimum
and maximum values for the reading,
by running the command cardisplay
-v and choosing the “Change the
Minimum and Maximum Values &
Hysteresis” option.
Visible cues depend on the minimum and maximum values you enter.
Recall from the first part of the article,
that in the Static Display mode, the
readings will flash when below the
minimum and flash reversed when
above the maximum.
In the other two scrolling display
modes, there will be periodic warning
messages as shown in Fig.2. If you are
also planning to use one of the two
digital outputs to monitor a reading
and have a relay switch on or off or a
buzzer sound on the extremes, these
are also the values that determine the
on/off switching of the relay or buzzer.
For example, for a 12V car battery,
a typical minimum value would be
11V and a typical maximum would
be 13.8V. For cabin temperature, you
might choose 16°C for the minimum
and 32°C as a maximum.
If you would like to monitor a reading and have a relay switch on or off
on a limit condition, or have a buzzer
beep, you should configure one of the
two digital outputs as follows.
Setting Up A Relay
Setting up a relay to switch on or
off on a limit condition is easy. Run
the command cardisplay -o to enter
the output configuration menu as
siliconchip.com.au
Command
cardisplay or cardisplay –h
cardisplay –x:N or
cardisplay –q:N
cardisplay –v
(‘v’ is for variable)
Function
Example
Show all available command
line options (help).
View real time information from
variable number N, where N is
in the range 0-5. The –x option
is useful for troubleshooting
cardisplay
The available command line options will be
shown.
cardisplay -q:0
Shows information on variable 0 including
all real time readings.
Go to the variable setup menu.
cardisplay –d (‘d’ is for display) Go to the display menu.
cardisplay –v
cardisplay –d
Result
You can change all variable settings, like
minimum and maximum values, enable or
disable averaging mode, change the name
and unit strings for the variable, among
others.
You can change which readings are
displayed and in what order, among other
things. The menu options are listed in Fig.6.
cardisplay –i
(‘i’ is for information)
Display Information about the
Car Scrolling Display, including
system settings
cardisplay –i
Displays the current values of the settings,
including system settings.
cardisplay –e
(‘e’ is for extended)
Display extended information
about the Car Scrolling Display.
cardisplay –e
Displays extended information including
internal settings useful for troubleshooting,
if needed.
cardisplay –c
(‘c’ is for calibration)
Go to the calibration menu.
cardisplay –c
Follow the on screen prompts.
cardisplay –o
(‘o’ is for outputs)
Go to the output configuration
menu.
cardisplay –o
Start real-time data logging
up to N samples or until
interrupted by the user.
Start real-time data logging up
cardisplay –l:N:<filename>
to N samples and store as file
<filename> in .csv format.
to the system settings
cardisplay –s (‘s’ is for system) Go
menu.
Write all settings to a file for
cardisplay –w:<filename>
later recall.
Read all settings from a
cardisplay –r:<filename>
previously created file.
Reset the Car Scrolling Display
cardisplay –r
and restore all default values.
cardisplay –u:N
cardisplay –u:100
Cardisplay “–l:2000:my
Data Log”
cardisplay –s
Allows you to configure the two digital
outputs for connecting relays or buzzers.
The menu options are listed in Fig.4.
Capture 100 samples in real time at the set
logging frequency and dump the data to a
.csv file – see Fig.9.
Capture 2000 samples in real time at the set
logging frequency and dump the data to a
file.
Change any system settings. The menu
options are shown in Fig.5.
cardisplay “-w:mySettings” Saves all settings to the file mySettings.
cardisplay “-r:mySettings” Restores all settings from the file
mySettings.
Resets the car scrolling display and restores
cardisplay –r
all default values.
Table.2: this table shows the command line options for the PC program “cardisplay.exe” running on your Windows OS.
You can use a laptop to connect to the Car Scrolling Display if it is already installed in your car. You will need a USB
cable and the PC host program will allow you to log your car’s signals in real time.
shown in Fig.3. Note that the current
settings of the two digital outputs will
be shown.
Choose the “Set Up a Relay” option. Then choose the digital output
connected to the relay you wish to
control. You then select one of the four
operating modes:
(a) Relay switches on at a maximum
condition.
(b) Relay switches off at a maximum
condition.
(c) Relay switches on at a minimum
condition.
(d) Relay switches off at a minimum
condition.
You then choose the variable to
monitor and the relay output will be
set up. A complete procedure is shown
in the screen grab of Fig.4.
siliconchip.com.au
Note that each variable has its own
hysteresis value (shown as a percentage) which is settable by running the
command cardisplay -v and choosing
the “Change the Minimum and Maximum values & Hysteresis” option.
A typical value will be 10%. This
affects how a relay connected to one
of the two digital outputs is switched
on or off.
Suppose for example, that the
minimum and maximum values for
the battery voltage are set at 11.0V
and 13.8V respectively, with the hysteresis at 5%.
If the relay is set to switch on at a
maximum condition, then the relay
will switch on whenever the battery
voltage is above 13.8V and switch off
whenever the battery voltage is below
95% of the maximum value, ie, below
13.1V.
Setting Up A Buzzer
Again, run the command cardisplay -o. This time, select the “Set Up
a Buzzer” option, then choose one of
the two digital outputs and the variable the buzzer applies to. Remember
that the buzzer will emit two short
beeps when the reading is below the
minimum and one long beep when the
reading is above the maximum. Recall
also that beeping is only enabled in the
Static Display mode.
Changing System Settings
There are a few system settings
which can be set by running the command cardisplay -s. You will be given
February 2009 81
Fig.5: this shows the result of running the command cardisplay -s to change
system settings. The value of the setting is shown and you are prompted to enter
a new value. In each case, pressing ENTER retains the old value. For the Enable/
Disable settings, you press either e (for Enable) or d (for Disable). When the
settings have been entered, the new settings are displayed.
in Static Display mode when a limit
condition occurs. The smaller the
number, the shorter the time that the
reading will be seen.
(c) Readings Rounding Off Mode: you
can enable or disable rounding off of
readings. If enabled, rounding will
be applied to all readings, depending
on how many digits after the decimal
point are set for that variable.
For example, if a variable is set
to show two digits after the decimal
point and the reading is 123.5565, the
display will show 123.56 (with rounding enabled) rather than 123.55 (with
rounding disabled).
(d) Zero Accumulators at Power On:
you can enable or disable setting all
accumulators to 0.0 when the display
is powered on. Disabling is useful if
you want persistent running totals, ie,
totals that retain their value when you
switch off the ignition.
(e) Automatic Wake-Up On Battery
Sense: enable this to have the display
turn on automatically when power is
detected at the battery sense input.
(f) Readings’ Update Frequency (Log
ged): you can set the readings’ update
frequency for data logging from 0.2Hz
to 8Hz. Note that the readings’ update
frequency for normal display mode is
always half of this value.
Display Settings Menu
Fig.6: by running the command cardisplay -d, you can enter the display settings
menu. Here you can add readings you want to show or hide readings you no
longer want to display. You can also change the order of the displayed readings,
the scrolling speed of the display and the minimum and maximum brightness
levels.
the current value of each system setting
and prompted to enter a new value. In
all cases, pressing ENTER retains the
current value. Again, in most cases, the
default system settings probably will
not need to be changed.
A typical screen grab is shown in
Fig.5. Note that some are Enable/DisFig.7: this is the message that will
scroll when the battery level drops
below the set minimum. The Car
Scrolling Display will protect the
battery by shutting down to standby
mode.
82 Silicon Chip
able settings and you simply type ‘e’
or ‘d’ to enable or disable respectively.
The system settings are:
(a) Minor delay: this is a number in
multiples of 16ms that sets the delay
for flashing and reverse flashing in
Static Display mode. The smaller the
number, the shorter the time that the
readings will be off (if flashing to indicate minimum condition) or reversed
(if flashing in reverse to indicate a
maximum condition).
(b) Major delay: this is a number in
multiples of 16ms that sets the time
that the actual reading is displayed
Once you’ve set up a variable, you
can select which readings to display
using the display settings menu. You
can also select the order in which the
readings are displayed, the minimum
and maximum display brightness and
the scrolling speed.
Ambient Light Level Response
The ambient light level is used to
automatically dim the display when
the light level drops. This can be
overridden by setting the minimum
and maximum brightness levels. The
higher the number, the brighter is the
display. If you set the minimum to
be equal to the maximum, then the
brightness will be fixed.
If, for example, you set the minimum to 100 and the maximum to 250,
the brightness will vary between these
extremes, depending on the ambient
light level. It is usually desirable to
have a dimmer display when the am-
siliconchip.com.au
bient level drops. It will also result in
lower current drain.
The scrolling speed (applicable to
the two scrolling display modes) can
be varied. The lower the scrolling
delay (measured in milliseconds), the
faster the scrolling will be.
To set the minimum and maximum
brightness as well as the scrolling
speed, run the command cardisplay
-d and choose the “Change Display
Settings” option.
Changing the Displayed
Readings & Their Order
The display menu also allows you
to select up to 10 readings to display
and choose the order in which they
appear. Note that the first reading
cannot be hidden, so there will always
be at least one reading to display. The
accumulator of each variable can also
be displayed.
When the accumulator is displayed
in any of the two scrolling modes, the
name string will be that of the value
which it is summing with a ‘(+)’ suffixed to indicate that the accumulator rather than the value is being
displayed.
To change which readings are displayed and in what order, or to hide
or add a reading, run the command
cardisplay -d and choose the appropriate options as shown in the screen
grab in Fig.6. For example, choose
“Change Order of Display Object” and
select an object from the list of currently displayed readings. Then use
the arrow keys to move the reading
up or down in order.
Battery Protection, Automatic
Wake-Up On Battery Sense
With the correct power supply connection, you can enable automatic
wake-up on battery sense and battery
protection. Recall that the Car Scrolling Display will go into standby mode
(drawing only very small currents)
when it detects that the battery voltage has dropped below the minimum
(it will, however, not go into standby
mode if USB power is available).
The delay from detecting the low
battery condition to the Car Scrolling
Display shutting down (with a message as shown in Fig.7) can be set by
running the command cardisplay -s.
siliconchip.com.au
The setting to change is the “Battery
Protection Delay”. This delay is useful,
for example, if you are running a cooling pump from a relay on the digital
outputs and you want it to operate for
a while after the ignition key has been
switched off.
When you enable automatic wakeup on battery sense, the Car Scrolling
Display will turn on when it detects
that the battery level is above the minimum. You can enable or disable this
by running the command cardisplay
-s. The setting to change is “Automatic
Wake Up on Battery Sense”.
Note that when you see the message
in Fig.7 and the Car Scrolling Display
goes into standby mode, you can manually force the display to wake up by
pressing the pushbutton on the front
panel. Keep it pressed for 10 seconds
or so and the display will turn on.
System Messages
From time to time, you will see a
number of messages scroll by on the
display which are generated by the
firmware in response to a number of
events. These are shown in Fig.8.
Real Time Data Logging
For data logging, run the command:
cardisplay -u:<N> or cardisplay
-l:<N>:<filename>, where <N> is the
number of samples and <filename> is
the name of the file to save the data to.
Fig.9 shows an example screen grab.
Note that when specifying a command line option with spaces, you use
double quotes to enclose the argument.
For example, to collect 2000 samples
and store the result to a file called
“My Output Log” you would type
at the command prompt cardisplay
Fig.8: these are some system messages,
which begin with a “>” character.
“Wait” appears when the display is
busy; “Logging” when entering data
logging mode; “USB On!” when a USB
cable is connected; “USB Off!” when
a USB cable is disconnected; and
“Reset” when a reset has occurred.
“Off” indicates that you have scrolled
past the last reading and that the
display is about to turn off (but not go
into standby mode yet).
“-l:2000:my Output Log”, enclosing
the argument in double quotes.
The produced file will be a .csv
(comma separated values) file which
can be opened with any spreadsheet.
Only values which have been made
loggable will be logged at the set logging frequency.
To change the loggable values of a
variable, run the command: cardisplay
-v and choose the “Set the Logging
Parameters For the Variable”. You
Fig.9: this screen grab was taken after running cardisplay -u:100 to collect 100
samples in real time. The battery level and the ambient light level are being
logged at the logging frequency of 5.6Hz. When using the -u option rather than
the -l option, the filename is generated automatically from the PC’s date and
time. In this case, the log was saved to dataWedDec171647472008.csv.
February 2009 83
Fig.13: In the Static Display Mode,
overflow is indicated by 4 ‘+’ signs,
while 4 ‘-‘ signs indicate that the
reading is not ready to be displayed.
In the scrolling modes, the value will
appear as ‘N/A’ when the reading is
not ready to be displayed.
running the command: cardisplay -v
and choosing the “Change Welcome
Message” option.
Saving & Restoring
Settings To A File
Fig.10: this shows the result of importing the log file into the spreadsheet
application Microsoft Excel. We’ve also created a graph of the battery voltage
level. This shows that the battery voltage was switched on around 4s after the
start of logging and switched off again at about the 15s mark.
can choose to toggle whether each of
the four values of the variable will be
logged. If at least one value is made
loggable, you can further choose to log
the accumulator for the variable and
to log the limit conditions.
A screen shot showing a log file
that has been imported into Microsoft
Excel is shown in Fig.10. Here, the battery level has been logged and a graph
has also been created.
Out Of Range Values
In Static Display Mode, out of range
values will be shown as four “+” signs.
When a displayed value comes from
a variable that has not been updated
since being last displayed, the value
will appear as “N/A” in the two scrolling modes and as four “–” signs in the
Static Display mode (see Fig.11).
Changing The Welcome Message
When the Car Scrolling Display
first powers on, a welcome message is
shown. The default welcome message
includes the firmware version. You
can change the welcome message by
To write settings to a file for later
restoring, run the command cardisplay -w:<filename>. You can restore
settings by running the command
cardisplay -r:<filename>.
Restoring Default Values
To restore all default values, as well
as clearing all strings, you run the
command cardisplay -r.
That completes our presentation of
this project in the magazine. To obtain
more detailed information about the
operation of the software and the
calibration procedure, as well as how
to change the variables’ settings, you
can access a PDF file entitled “Car
Scrolling Display User Guide” on our
SC
website.
Looking for real performance?
• Learn how engine management systems work
• Build projects to control nitrous, fuel injection and turbo
boost systems
• Switch devices on and off on the basis of signal frequency,
160 PAGES
23 CHAPTE
RS
temperature and voltage
• Build test instruments to check fuel injector duty cycle, fuel mixture and brake and coolant temperatures
• Speedo Corrector, Turbo Timer & Digital Thermometer Projects
of
Intelligen
t
turbo timer
I SBN 0958
5229
9 7809
5
Mail order prices: Aust. $A22.50 (incl. GST & P&P); Overseas: $A26.00 via airmail.
Fro m the
pub lish ers
8 5229
4
$19.80 (inc GST)
4-4
TURBO B
OOST
& nit
rous fuel co
ntrollers
6
NZ $22.00 (inc
GST)
How engi
ne
manageme
nt works
Order by phoning (02) 9939 3295 & quoting your credit card number; or fax the details to (02) 9939 2648; or
mail your order with cheque or credit card details to Silicon Chip Publications, PO Box 139, Collaroy, NSW 2097.
84 Silicon Chip
siliconchip.com.au
|