Windmill Software Ltd
Windows Engineering Software

Monitor
June 2004

-------------------------Monitor------------------------
The Newsletter for PC-Based Data Acquisition and Control
Issue 71          www.windmill.co.uk           June 2004
--------------------ISSN 1472-0221----------------------

Welcome to Monitor.  This midsummer (or midwinter) 
edition explains how to control electronic equipment.  
Our main article focuses on hardware issues, 
whilst the Windmill Notes section discusses which 
Windmill programs you can use for digital control.

We hope you enjoy receiving Monitor, but should you 
wish to cancel your subscription you can do so at 
https://www.windmill.co.uk/newsletter.html

CONTENTS
========
* Windmill News: Monitor Exceeds 25000 Subscribers
* Controlling Electronic Equipment: Relay Switching
* Windmill Notes: Digital Output Control Systems
* Excel Corner: Automatically Generating Reports II
________________________________________________________
________________________________________________________

Windmill News: Monitor Exceeds 25000 Subscribers
________________________________________________________

The number of subscribers to this newsletter has now 
exceeded 25000. Thank you everyone!

We launched Monitor in August 1998 and mailed it to just 
42 people.  Very soon after we started offering our 
Windmill data acquisition software suite free to 
everyone signing up.  At that time it cost non-
subscribers 345 GB pounds to purchase the software - so 
not surprisingly a great many people took advantage and 
tried Windmill for free. In fact, around 70% of 
subscribers still download the software and we've 
given away over 17000 copies of Windmill!

Dedicated to PC-based data acquisition and control, 
Monitor is sent by e-mail every month.  We hope you 
agree it is written in an easy-to-understand style and 
provides
- articles on making measurements
- application examples of computerised data acquisition
- tips on using Excel to analyse data
- news of exhibitions and conferences relating to data 
  acquisition
- links to more information

With overflowing e-mail in-boxes we know we have to
keep Monitor relevant or you will simply delete it, 
or worse still mark it as spam.  Our yearly surveys have 
helped us respond to your issues and keep on track.  If 
you don't like what you see - tell us.   (We lose around 
2.5% of our subscribers a month, mostly through people 
abandoning their e-mail accounts.)

Thanks again for subscribing.
________________________________________________________
________________________________________________________

Controlling Electronic Equipment: Relay Switching
________________________________________________________

You can use a PC to switch other equipment on and off, 
according to conditions.  For example, say you were 
monitoring a temperature and wanted to know when it 
reached a certain level.  With a suitable data 
acquisition and control interface you could use a 
digital output to 
- switch on a warning light, 
- sound an alarm,
- telephone a number with a pre-recorded message,
- turn off a heater.

Unlike analogue signals which continually vary, digital 
signals are either on or off.  Software controls each 
digital output by just one bit - setting the digital 
line high or low.  At a hardware level, the actual 
voltage of the high (or low) line depends on its 
compatibility.  The most popular standard is TTL 
(transistor-transistor logic). This conforms to the 
following voltage levels for digital output signals.
A logic 1 is represented by 2.4 to 5.5 V with a current 
source capability of at least 400 microA.
A logic 0 is represented by  0 to 0.6 V with a current 
sink capability of at least 16 mA. 

You'll note that there is a gap between high and low (ie 
between 2.4 and 0.6 V). This is so the two states are 
clearly defined.

Another term you will come across is LSTTL.  This stands 
for Low Power Shottkey TTL, which as the name suggests 
has lower power consumption than TTL but has the same 
logic levels. 

Why is it important to know whether digital outputs 
are TTL or otherwise?  Because your digital outputs 
must be compatible with the device you are trying 
to control.

                          *

Switching Relays
================

Computers work at small voltages.  To switch a large 
voltage you would often use relays. A relay opens or 
closes contacts when a current is passed through a coil, 
thus connecting or isolating 2 sections of a circuit.  A 
reed relay, for example, consists of two thin magnetic 
strips (reeds).  When a coil close to the reeds is 
energised, they are magnetised and drawn together making 
a connection between leads attached to the reeds. 

Relays are commonly used as signal switches or control 
switches. Their virtues in these applications being low 
"on" resistance and isolation between switch and control 
circuits.  For switching heavy loads, many data 
acquisition and control (DAQ) interfaces have relays on-
board.  In this case the hardware manufacturer will list 
in the specifications a "contact rating".  This shows 
the power that can be safely switched with the relay.  
For example 10 amps at 30 volts DC or 230 volts AC.  
This must be at least as big as the maximum rating of 
the device you want to control.

The contact rating is quoted for non-reactive load - 
that is without capacitance or inductance.  If you do 
have an inductive load connected, such as a motor or 
solenoid, be aware that the contact rating is reduced.  
This is due to the large transients produced when 
inductances are switched.  You can often reduce the size 
of the transient by fitting a capacitor in series with a 
resistor.

A situation that often causes trouble is when you switch 
capacitive loads.  A high current rushes into the 
capacitance when it is switched, often sufficient to 
weld the relay contacts.  If a relay stops working but 
recovers after being given a sharp tap, then the contact 
has been welded.  People often don't realise when they 
have a capacitive load.  For instance an open circuit 
screened cable can present a considerable capacitance.  
If you suspect you will have this problem the you may be 
able to fit series resistors to limit the peak current.

Relays take a significant time (measured in 
milliseconds) to open and close.  Hardware manufacturers 
quote this as operating time and release time.

                          *

Glossary of Terms
=================

Signal 
  General term referring to a conveyor of information. 

TTL 
  Abbreviation for transistor-transistor logic. Provides 
  conditional switching capability depending on voltage 
  levels. 

TTL-Compatible 
  For digital output signals, a logic 1 is represented 
  by 2.4 to 5.5 V with a current source capability of at 
  least 400 microA; and a logic 0 by 0 to 0.6 V with a 
  current sink capability of at least 16 mA. 

Output 
  Information leaving a device. 

Relay 
  Electromechanical device that opens or closes contacts 
  when a current is passed through a coil. 

Reed Relay 
  Consists of two thin magnetic strips (reeds). When a 
  coil close to the reeds is energised, they are 
  magnetised and drawn together making a connection 
  between leads attached to the reeds. 

Release Time
  The time a relay takes to open.

Operating Time
  The time a relay takes to close.

Pole
  A relay contact.

Transient 
  A short surge of voltage or current, often occurring 
  before steady-state conditions have become established. 

Capacitance
  The ability to store an electrical charge, or, more 
  precisely, the ratio of the total charge on a capacitor 
  to its potential. The unit is the Farad.

Inductance
  The magnitude of a magnetic field created by a circuit 
  element carrying a current.

More Information
================

For more information contact Windmill Software Ltd at 
sales@biodataltd.com.  We sell a range of data 
acquisition and control units providing digital outputs, 
including the Microlink 751 and 752.  These connect to 
the computer over USB.  For details see our on-line 
catalogue at 
https://www.windmillsoft.com/daqshop/daq-usb.html
https://www.windmillsoft.com/daqshop/resistance.html

Other companies, such as Biodata, 
(http://www.microlink.co.uk/), sell larger systems that 
can communicate with the PC over greater distances.  You
can use Windmill software with most Biodata products.
________________________________________________________
________________________________________________________

Windmill Notes: Using Windmill to Control Digital Outputs
________________________________________________________

Windmill has several programs which you can use to 
control your digital outputs, including DigitalOut, 
AnalogOut, Graphics and Test-Seq.  Additionally, the 
Windmill IML Tools make it easy for you control outputs 
from your own macros and programs.

Windmill DigitalOut for Push Button Control
===========================================
  This software lets you control any number of digital 
  output channels.  It provides push buttons for you to 
  change the state of each channel.  You can switch 
  each channel individually, or switch several 
  channels at once.
  For more details see either 
  https://www.windmill.co.uk/digout.html 
  or the DigitalOut Help file available from 
  https://www.windmill.co.uk/help.html

Windmill AnalogOut for Controlling Groups of Outputs
====================================================
  You normally use AnalogOut to control analogue, not 
  digital, outputs.  However there is one special case 
  when you could use it to control digital channels.  This 
  is when you have grouped digital channels using Windmill 
  SetupIML.  

  Each digital channel (or line) is initially set to on or 
  off by a single bit. You might, however, want to always 
  switch several channels at the same time - for example 
  to open or close 8 relays at the same instant.  In this 
  case you can group the 8 channels together.  All 8 relays 
  will be controlled by a single value rather than by 
  8 separate ON/OFF values. In binary the value would 
  be from 00000000 to 11111111.

  Bit 0 corresponds to line 0, bit 1 to line 1, bit 2 to 
  line 2 and so on.  A value of 1 sets a line to on, a 0 
  sets it to off.  So, for example, to set lines 0, 3, 
  6 and 7 to on and lines 1, 2, 4 and 5 to off you would 
  send the following number in binary, (best viewed in 
  Courier font so the columns line up correctly):

  Data bits: 76543210 
  Binary:    11001001

  In hexadecimal you would send "C9" and in decimal "201".

  For more details see the AnalogOut and SetupIML Help 
  files, available from 
  https://www.windmill.co.uk/help.html

Windmill Graphics for Customised Windows
========================================
  Graphics lets you design and create your own display 
  and control windows.  You can insert buttons to control 
  digital outputs.  These can take any appearance you 
  like.  There are three types of button: one that 
  toggles between on and off, one that always turns an 
  output on and one that always turns an output off.  
  You can also insert "LEDs" to light up when the 
  output is on.  Finally, you can choose whether the 
  the digital output should initially be on or off.
  For more details see
  https://www.windmill.co.uk/graphics.html

Windmill Test-Seq for Sequence Control of Equipment
===================================================
  Test-Seq interprets a file of commands and controls 
  equipment and applications accordingly.  It can send 
  commands and data to other Windows programs, or directly 
  to the hardware inputs and outputs.  The command, or 
  test sequence file is a text file which you can easily 
  create in a text editor or word processor.  Use 
  Test-Seq to control digital outputs depending on 
  timing or environmental conditions.  For more 
  details see
  https://www.windmillsoft.com/daqshop/test-control.html

Windmill IML Tools
==================
  You can use the IML Tools to switch digital outputs
  directly from Windows applications like Excel, from 
  JavaScript code running on a web page, from Visual
  Basic programs or from any developer tool can 
  integrate Active X controls.  Windmill takes care of 
  the communication with the hardware leaving you 
  free to concentrate on your application. For more 
  details see
  https://www.windmill.co.uk/tools.html 

All the Windmill programs mentioned can be used with 
equipment connected to the PC over Ethernet, USB, 
RS232, RS422, RS485 or Modbus.  Contact Windmill 
Software at sales@biodataltd.com for more information, 
or fill in the form at 
https://www.windmill.co.uk/contact.html
________________________________________________________
________________________________________________________

Excel Corner: Automatically Generating Reports II
________________________________________________________

Last month we explained how to automatically generate 
reports in Excel.  (If you missed last month's copy, 
you can read it at
https://www.windmill.co.uk/monitor70.html)

This month we discuss ways to improve the report 
generation. We show how to implement a form from which 
people can simply make selections, rather than editing 
the macro to suit their system.  A menu item lets you 
re-display the form should you choose to hide or close 
it. 

Downloading the Report Generator
==================================

The improved report generator is available at 
https://www.windmill.co.uk/excel/reportwl2.zip
Unzip this into your Windmill folder.
You need to load the worksheet (reportWL_m2.xls) from 
Excel rather than double clicking on the xls file.

Using the Report Generator
==========================

When you open the xls file, Excel looks for valid 
Windmill Logger data files.  It considers a file to be 
valid when you have periodic logging enabled in Windmill 
Logger, with no files being overwritten.  Excel then 
lets you choose which set of data files to analyse.  
Make your selection from the File Prefixes box in the 
opening form.  You can then choose how to analyse the 
data: select the summary type from Maximum value, 
Minimum value, Sum or Mean.  Choose a date for the 
report and whether the report should cover a day's, a 
week's or a month's data. Now press the "Make Report" 
button and Excel will generate the report according to 
your specifications.

Customising the Report Generator
================================

Should you wish to edit the Report Generator - for 
example to add other analysis functions - click the 
Hide button on the Report Selector Form.  (To redisplay 
the form select the Windmill menu in Excel and choose 
"Show Report Selector".) 

Open the Visual Basic Editor and edit the code attached 
to the ButtonForm. To create a new analysis function you 
need to:
- Declare it as a constant at the beginning of the 
  macro.
- Add it to the drop-down list of functions in the 
  opening form, by editing the UserForm_Initialize() 
  subroutine.
- Write the new function using one of the other analysis 
  functions as a template, for example "Public Function 
  analyse_SumColumn(sName, iCol, rowCount)"
- Edit the ShowDaily, ShowWeekly and ShowMonthly 
  subroutines to include your new function.

For more help with editing the Report Generator see 
last month's Monitor, 
https://www.windmill.co.uk/monitor70.html
or contact techsupport@windmill.co.uk
________________________________________________________
________________________________________________________

* 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 834 6688
Facsimile: +44 (0)161 833 2190
E-mail: monitor@windmillsoft.com

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

Previous Issue Next Issue