W&T Interfaces
for TCP/IP, Ethernet, RS-232, RS-485, USB, 20mA
Glass and plastic fiber optic, http, SNMP, OPC, I/O digital, I/O analog, ISA, PCI, ...?
      Products
Home Contact   Distributors worldwide
Languages:
DE

US

ES

IT

RU
Web-IO Universal
Digital
Analog
Web-IO application-ready
Monitor climate
Alarm Reporting Center
Web-Count / S0 acquisition
IP monitoring
Data Server
Motherbox 2
pure.box 2
Network Memory
TCP/IP-Ethernet servers
Com-Server (serial)
USB Server
Serial interfaces
USB, RS232, RS485, 20mA
Isolators & fiber optics
USB, RS232, RS485, 20mA
PC cards
PCI Express, PCI and
ISA bus
...
Printer interfaces
Accessories
Downloads
Old
Shopping basket Your shopping basket

 
      Technical knowledge
Books, articles, glossaries...
Technical background info
Applications for Com-Server,
USB Server
, Web-IO,
Web Thermometer,
Motherbox and pure.box
 
Application for the Web-IO Digital:

Web-IO Digital becomes a timer switch using Linux and CRON




 Additional links: Product overview Application overview Print version


Timer switches are used for a variety of tasks such as turning on courtyard or entrance lighting or neon signs, opening and closing rollup blinds or activating a break announcer. The applications for time controlled switching processes are innumerable. Typically a separate timer is used for each individual task, which needs to be configured and set individually.

Cron

In most companies there are centralized file servers which are running 24/7/365 anyway. A server running under Linux can easily assume the tasks of a central timer (of course this is also possible using Windows servers and Windows PCs).

With the CRON service integrated in Linux servers, the network can be used to control the outputs on Web-IO Digital boxes. This combines the configuration of the switching operations in a central location, from where switching can however be accomplished decentrally.

The example described below shows you how this can work.


You don’t have a Web-IO yet but would like to try the example out sometime?

No problem: We will be glad to send you the Web-IO Digital 2xInput, 2xOutput at no charge for 30 days. Simply fill out a sample ordering form, and we will ship the Web-IO for testing on an open invoice. If you return the unit within 30 days, we will simply mark the invoice as paid.

To sample orders   To sample orders  

Preparations
You have already provided your Web-IO Digital

1. CRON and CURL as command issuers

The Cron daemon is normally used for automatically running programs, services and system commands. The tasks assigned to the CRON are written together with the timing requirements to a text file named crontab.

Linux itself does not offer a service which can switch the outputs on a Web-IO. Here the free tool CURL comes to the rescue. This can be downloaded and installed from the Web site curl.haxx.se.

By entering

curl "10.40.22.101/outputaccess1?PW=Password&State=ON&"

after successful installation, Output 1 for example on the Web-IO having IP address 10.40.22.101 is turned on.

A detailed description of the possible Web-IO commands can be found in the manual for the Web-IO starting on page 102.


2. Structure of the crontab file

The functions described here may differ slightly in the syntax and structure depending on the Linux distribution used!

You can check whether the CRON daemon is running by using the following command:

ps aux | grep cron

If CRON is active, Linux replies with one or more lines, beginning with the user name (e.g. root) and a few other pieces of information.

As already mentioned, the controlling element with CRON is the crontab file, which can be found in the directory /etc. Here you specify which action needs to be performed. For each action there is a line with a specified structure.

#m h dom mon dow user command
0 8 * * 1-5 root curl "10.40.22.101/outputaccess1?PW=Password&State=ON&"

  • m
: Minute
possible values: 0-59
  • h
: Hour
possible values: 0-23
  • dom
: Day of the month
possible values: 1-31
  • mon
: Month
possible values: 1-12
  • dow
  Day of the week
possible values: 0-6 (beginning with 0 = Sunday, 1 = Monday, ...)
  • user
  User name
(it is recommended that you use root as the user name
  • command
: Command
for switching using Web-IO curl and the switching invoke

Instead of a time parameter you may use an asterisk *. This stands for always, i.e. for all permitted values
(for example every minute).

Numerical ranges are permitted. Ranges are two numbers separated by a hyphen. The specified limits are inclusive. For example, 8-17 as an hour value causes the action to be performed at 8, 9, 10, 11, 12, 1, 2, 3, 4 and 5 o’clock.

Lists are possible. A list is an quantity of numbers or ranges separated by commas.
Examples: 1,2,5,9 or 0-4,8-12.

Increments can be used in combination with ranges. Behind the range specify the "/<Increment>".

Example: "0-23/2" can be used under hours to run a special command every two hours. The alternative would be: 0,2,4,6,8,10,12,14,16,18,20,22. Increments are also allowed after asterisks *, "every two hours" can also be described by "*/2".

The entry shown above turns Output 1 on at 8:00 in the morning every Monday through Friday.

The CRON format may seem somewhat cumbersome at first glance, but it is quite easy to configure both repetitive actions as well as one-time switching actuations.

A final example:

You want to turn the courtyard lighting at a company on each evening and off the next morning. Output 0 on the Web-IO 10.40.22.101 controls a Coupling relays which powers the lighting. To save electricity, the controller needs to take into account the monthly sunrise and sunset times. In addition, Output 1 on the Web-IO 10.40.22.104 should activate the break announcer Mondays through Fridays at 1:00 p.m. (the output has been configured for 500ms pulse operation, i.e. automatically resets).

#m h dom mon dow user command

#January 16:30 - 9:30
30 16 * 1 * root curl "10.40.22.101/outputaccess0?PW=Password&State=ON&"
30 9 * 1 * root curl "10.40.22.101/outputaccess0?PW=Password&State=OFF&"
#February 17:30 - 8:30
30 17 * 2 * root curl "10.40.22.101/outputaccess0?PW=Password&State=ON&"
30 8 * 2 * root curl "10.40.22.101/outputaccess0?PW=Password&State=OFF&"
#March 18:30 - 8:00
30 18 * 3* root curl "10.40.22.101/outputaccess0?PW=Password&State=ON&"
0 8 * 3 * root curl "10.40.22.101/outputaccess0?PW=Password&State=OFF&"
#April 20:00 - 7:30
0 20 * 4 * root curl "10.40.22.101/outputaccess0?PW=Password&State=ON&"
30 7 * 4 * root curl "10.40.22.101/outputaccess0?PW=Password&State=OFF&"
#May 21:00 - 5:30
0 21 * 5 * root curl "10.40.22.101/outputaccess0?PW=Password&State=ON&"
30 5 * 5 * root curl "10.40.22.101/outputaccess0?PW=Password&State=OFF&"
#June 21:30 - 5:00
30 21 * 6 * root curl "10.40.22.101/outputaccess0?PW=Password&State=ON&"
0 5 * 6 * root curl "10.40.22.101/outputaccess0?PW=Password&State=OFF&"
#JJuly 21:30 - 6:00
30 21 * 7 * root curl "10.40.22.101/outputaccess0?PW=Password&State=ON&"
0 6 * 7 * root curl "10.40.22.101/outputaccess0?PW=Password&State=OFF&"
#August 18:30 - 7:30
30 18 * 8* root curl "10.40.22.101/outputaccess0?PW=Password&State=ON&"
30 7* 8 * root curl "10.40.22.101/outputaccess0?PW=Password&State=OFF&"
#September 17:30 - 7:00
30 17 * 9 * root curl "10.40.22.101/outputaccess0?PW=Password&State=ON&"
0 7 * 9 * root curl "10.40.22.101/outputaccess0?PW=Password&State=OFF&"
#October 17:00 - 7:30
0 17 * 10 * root curl "10.40.22.101/outputaccess0?PW=Password&State=ON&"
30 7 * 10 * root curl "10.40.22.101/outputaccess0?PW=Password&State=OFF&"
#November 16:30 - 8:30
30 16 * 11 * root curl "10.40.22.101/outputaccess0?PW=Password&State=ON&"
30 8 * 11 * root curl "10.40.22.101/outputaccess0?PW=Password&State=OFF&"
#December 16:00 - 9:00
0 16 * 12 * root curl "10.40.22.101/outputaccess0?PW=Password&State=ON&"
0 9 * 12 * root curl "10.40.22.101/outputaccess0?PW=Password&State=OFF&"
#Monday - Friday 13:00

0 13 * * 1-5 root curl "10.40.22.104/outputaccess1?PW=Password&State=ON&

The example shows that even complex switching routines can be handled using just a few lines of configuration.


 

A detailed description of the switching commands for the Web-IO Digital models can be found in the reference manual.

To sample orders   To sample orders  

 
    Additional application examples for Web-IO Digital
Web techniques
     
     
     
     
  Your own web pages
       
        PHP and AJAX - dynamic web pages also for multiple Web-IOs
        Mashup web pages - displaying values in Google Maps
        Java-Applet - use the integrated applet
        Java-Applet - Example: display in- and outputs
        Java-Applet: Example: display in- and outputs and control the outputs
        Java-Applet - Example: display counters
        Java-Applet - Example: Open doors and switch lights from the browser
        Web-IO with iPhone: visualize and control
        Web-IO with iPhone example: control shutter blinds
        Web-IO with iPhone example: monitor room climate
        Web-IO with iPhone example: display measurement values
System integration
     
     
     
     
     
      Box-to-Box
Data acquisition
     
      FTP data logger - example
Timer
     
      CRON timer (Linux)
      Task planner as timer
Individual programming
     
      Visual Basic.Net 2005/2008/2010
      Visual Basic.Net 2005/2008/2010 with WuTdevice.dll
      Visual C++
      Visual C#
      Visual C# with WuTdevice.dll
      Visual C++ (Linux with QT-Designer)
      Visual Delphi
      Visual Delphi.Net (2005)
      Lazarus / FreePascal
      Java
      control using VBScript
Web-IO system
     
     
      Motherbox - Access multiple Web-IOs
      Motherbox - Logically link Web-IOs
      Limit monitoring
  Web-IO - Options for network linking
       
        DSL
        UMTS/GPRS/mobile phone network
        Satellite radio

 
  • Mister Wong
  • Google Bookmarks
  • Twitter
  • Facebook
  • Digg
   Imprint
We are here for you personally! Wiesemann & Theis GmbH Tel.: +49 202/2680-110 (M-F 8:00 - 5:00)
Porschestr. 12 fax: +49 202/2680-265
42279 Wuppertal Individual e-mail

© Wiesemann & Theis GmbH, subject to error and alteration: Since we can make errors, none of our statements should be used without verification. Please report any mistakes or misunderstandings so that we can be aware of them and respond appropriately as quickly as possible.