Windmill Software Ltd
Data Acquisition Intelligence

Monitor
February 2008

-------------------------Monitor------------------------
The Newsletter for PC-Based Data Acquisition and Control
Issue 115          www.windmill.co.uk      February 2008
--------------------ISSN 1472-0221----------------------

Thanks very much if you completed our survey last month.  
This month we've another request. If you are logging 
data from an instrument connected to your PC over RS232, 
could you email us an example of the data string sent by 
the instrument?  We are planning a feature to help 
readers acquire data from their measuring devices. 
Thanks.

I hope you enjoy the newsletter but if you want to 
remove yourself from our mailing list please do so at
http://www.windmill.co.uk/newsletter.html 

CONTENTS
========
* Windmill News: Survey Results
* Windmill Notes: Connecting a Garmin GPS to a PC
* Excel Corner: Conditional Counting - COUNTIF
* DAQ News Roundup
________________________________________________________
________________________________________________________

Windmill News: Survey Results
________________________________________________________

Last month we asked you some questions to try to improve 
Monitor and our service.  Thank you very much for your 
answers and comments.  If you didn't complete the 
survey but would like to do so, 
go to 
http://www.windmill.co.uk/monitor114.html

One reader suggested it would be helpful if we provided 
a list of instruments and their message strings.  To do 
this we need your help - please could you send us an 
example of your instrument's data string and the name of 
the instrument?  E-mail to [email protected]

We had several requests to cover topics which we have 
already visited.  We've thus put up a comprehensive 
index to back issues at 
http://www.windmill.co.uk/monitorindex.html.
I hope you find it useful.

More people preferred a text format newsletter to one in 
HTML format (47% to 39% with 14% not being bothered either 
way).  The text format was thought to be good because it 
made the newsletters "easy to save" and "quick and small".

Over 93% of you were very or fairly interested in the 
Excel Corner, real-world examples of how Windmill software 
is being used, tips on using Windmill and the articles on 
data acquisition. So we shall be including more of these 
types of story in future issues.

Thanks very much for your input. E-mail any other 
questions, comments or suggestions to 
[email protected]
________________________________________________________
________________________________________________________

Windmill Notes: Connecting a Garmin GPS Receiver to a PC
________________________________________________________

Note: the software used in this example has been 
replaced by Windmill 7. See our new 
instructions on  connecting a 
Garmin GPS here. 

Windmill lets you log data from a Garmin GPS Receiver to 
your PC.  Subscribers to Monitor can download a free copy 
of Windmill 4.3. Alternatively you can purchase Version 6 
of 
Windmill from 
https://www.windmillsoft.com/daqshop/rs232-modbus.html

There are three basic steps to starting to log data 
from a GPS receiver using the free software.

1. Run the Windmill ConfIML program and enter your 
   GPS's communication settings. 
2. Run the Windmill SetupIML program and choose names 
   and units for your GPS data. 
3. Run the Windmill DDE Panel or Logger program to 
   display or save data from your GPS.

Once you have configured the Windmill software you can 
in future go straight logging data.

                           *

Windmill ConfIML
================

This program detects and saves a record of the hardware 
you want to use, in our case a Garmin GPS receiver.  The 
settings below work with most Garmins, but check your 
Manual to make sure.

1. Start ConfIML and Press the Add button. 

2. Select LabIML RS232 ASCII Instrument Handler. 

3. Type a name for the Garmin, a description and enter 
   how many channels of data you will be collecting (two 
   if you are just recording latitude and longitude). 
   Press OK.

4. Enter your instrument's settings:
   - Reading Protocol: Continuous Flow
   - Instrument Idle or Wait Time: 0 
   - Data Persistence: 5000 (assuming you are taking 
     readings more often than once every 5 seconds) 
   - Returned Message Length: 100
   - Instrument Initialisation String: Leave blank

5. Press the Channels button. Enter the instructions to 
   extract the reading from the string of data sent by 
   the GPS. This is called the Reply Parse String. 
  - The Garmin sends many different types of messages, for example 
    $GPRMC,hhmmss,A,llll.ll,N,yyyyy.yy,W,kk.k,tt.t,ddmmyy,mm.m,W*CS
    Here llll.ll is the latitude and yyyyy.yy is the longitude.
  - to extract the latitude you could Search for "$GPRMC", 
    Ignore 10 characters then Extract everything until the 
    next comma. This appears as \S"$GPRMC"\I10\E","
  - to extract the longitude you could Search for "N,", Extract 
    until the next comma. This appears as \S"N,"\E","

Note: in this example your Latitude channel must come 
before your Longitude channel. For example, channel 0 
is Latitude and channel 1 is Longitude. This is because 
it is the Latitude channel which pinpoints the correct 
place in the data string to start (ie at the beginning 
of the $GPRMC sentence). 

6. Enter the communications settings being used by the 
   Garmin. For example...
   - Baud: 4800
   - Data Bits: 8
   - Parity: None
   - Flow control: None

7. Save your settings and close ConfIML. You may receive 
   a message asking you to restart Windows. Ignore this but 
   be sure to close any IML or Windmill icons on the Taskbar. 
   You can now start SetupIML.

                           *

Windmill SetupIML
=================

With the SetupIML program you can name channels, set units 
and so on.

1. Choose to Create a New Setup and enter a name and 
   description. This can be anything you like.

2. From the Device menu select LabIML.

3. Your data channels will be shown as a numbers like 10000, 
   10001. Double click a channel number.

4. Type name for your channel, eg Lat, and make sure 
   Enable for Input is checked. 

5. Save your settings in a *.ims file, close SetupIML and 
   run DDE Panel or Logger

                           *

Windmill DDE Panel
==================

1. From the File menu select Load Hardware Setup and 
   choose the *.ims file you just saved.

2. Connect your GPS channels. You should see your 
   co-ordinates in DDE Panel.

3. Proceed similarly for the Logger program. 

                           *

Getting the data into Excel or Mapping programs

You can use the Windmill Logger program to collect data, 
and after collection has finished import it into Excel or 
your mapping program. 

Alternatively, you can collect data with Excel in 
real-time by writing an Excel macro to read data from 
the Windmill DDE Panel. For more details see our 
Excel page at http://www.windmill.co.uk/excel/

                           *

Trouble-Shooting
================

If you are having problems receiving data from your 
Garmin GPS receiver, right-click the LabIML icon on the 
tool bar and select "Debug Options". 

If the LabIML Debug window says "Parsing Failed", 
go back to the ConfIML program and edit your 
Reply Parse String. 

If no data is shown in the LabIML Debug window, you may 
have a communication or a cabling problem.  Check your 
settings in ConfIML - baud rate etc - correspond to those 
being used by the GPS. If so make sure your cable 
is compatible with Garmin. Should your PC not have any 
RS232 ports you can purchase a USB-Serial cable. 

If you still have problems fill in the form at 
http://www.windmill.co.uk/garmin.html

                           *
Further Reading:
================

Interfacing a Garmin GPS Receiver (includes screenshots)
http://www.windmill.co.uk/garmin.html

Monitor #52 - Interfacing NMEA Instruments
http://www.windmill.co.uk/monitor52.html

Monitor #44 - Geographical Information Systems
http://www.windmill.co.uk/monitor44.html
________________________________________________________
________________________________________________________

Excel Corner: Conditional Counting - COUNTIF
________________________________________________________

Excel's COUNTIF function is often useful when analysing 
your data. Here are a couple of examples: they both are 
being applied to a column of data in cells B2 to B100.

To count the number of negative readings
=COUNTIF(B2:B100,"<0")

To count the number of readings which are between 17 and 18:
=COUNTIF(B2:B100,">=17")-COUNTIF(B2:B100,"<18")

                           *

Using the Functions in your Macros
=================================

You can use COUNTIF in your VBA code.  Here we are 
counting the number of negative readings and storing 
the result in a variable called BelowFreezing.

BelowFreezing = Application.COUNTIF(Sheets("Sheet1")
                         .Range("B2:B100"), "<0")

                           *

Counting over Scattered Cells
=============================

The COUNTIF function checks to see if the specified cells 
meet one condition.  You can use cell references as in 
our example, or a named range. The range of cells can 
spread several rows and columns, but must be contiguous: 
=COUNTIF(A2,A4,A6,"<0") won't work. However, you can 
sum COUNTIF functions to get the required result. 
=COUNTIF(A2,"<0")+COUNTIF(A4,"<0")+COUNTIF(A6,"<0")

                           *

Having a Cell Contain the Condition
===================================

In our examples we have entered our conditions as numbers. 
You could instead use a cell reference. In this example 
the cell C1 holds the numerical part of the condition 
(the operand).
=COUNTIF(A2:A100,"<"&C1)

Note the less than symbol is enclosed in inverted commas 
and the &  sign which precedes the cell reference.

                           *

Counting against more than one Condition
========================================
With COUNTIF you cannot count against more than one 
condition: such as the number of times both the 
temperature was over 0 oC and the humidity was below 
50%.  Instead you could use DCOUNT, an 
array formula or a 
Pivot table.  More on these in future issues. 


For more tips on using Excel for data acquisition and 
analysis see http://www.windmill.co.uk/excel/ and 
http://www.windmill.co.uk/excel/excel-charting.html
________________________________________________________
________________________________________________________

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 
http://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.

Divers make precision measurements   
   A new underwater sensing device can operate at depths 
   of 25 m.  The device can accommodate pH, oxygen and 
   hydrogen sulphide microsensors. The system can be pre-
   programmed to autonomous operation or interactively 
   operated by SCUBA divers. Internal batteries supply 
   power for up to 24 hours of measurements, storing up 
   to 64 million data samples.
   Source: SCUBA Diving News
   http://news.scubatravel.co.uk/

Position sensors: magnets know their place
   Non-contact position sensors are small but important 
   parts of many modern machines. Researchers have used 
   a phenomenon known as magnetoresistance to develop a 
   practical, low-cost position sensor that performs 
   better than existing designs. 
   Source: CORDIS
   http://tinyurl.com/2wajy7

Cyclists' cellphones help monitor air pollution   
   Cellphones used by bicycle couriers are monitoring 
   air pollution in Cambridge, UK, and beaming the data 
   back to a research lab. The technique is made possible 
   by small wireless pollution sensors and custom 
   software that allows the phones to report levels of 
   air pollutants wherever they happen to be around town. 
   Source: NewScientist.com
   https://www.newscientist.com/
 
NMR on a Chip 
   A super-sensitive mini-sensor developed at the National 
   Institute of Standards and Technology (NIST) can detect 
   nuclear magnetic resonance (NMR) in tiny samples of 
   fluids flowing through a novel microchip. The prototype 
   chip device may have wide application as a sensitive 
   chemical analyser.
   Source: NIST
   https://www.nist.gov/

Industrial Control Shipments Strong in 2007
   US industrial control shipments surged 8.3 percent 
   in the fourth quarter of 2007, but a darkening economic 
   outlook may weigh on future demand - according to 
   electrical equipment association NEMA.
   Source: NEMA
   http://www.nema.org/
________________________________________________________
________________________________________________________

* Copyright Windmill Software Ltd
* Reprinting permitted with this notice included
* For more articles see http://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 
http://www.windmill.co.uk/newsletter.html
and an index of articles at 
http://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]
http://www.windmill.co.uk/
https://www.windmillsoft.com/



Subscribing

To receive Monitor every month please fill in your e-mail address below. We will not pass your address to any third parties, nor send you any unsolicited e-mail.

Subscribe Monitor

You will receive an e-mail confirming your subscription, with details of how to download the free software. If you don't receive this then your spam filter may be blocking our message. Make sure it is set to accept messages from [email protected] If you have problems contact the Editor.

Previous Issue Next Issue