Charon I – Web51 Home Control FW

The Charon I module with this firmware controls the RS-232 line, 8x inputs and 8x outputs, LCD display and up to 4 one-wire thermometers via Ethernet network, using Telnet or Web browser application. We should recommend you to use the Charon I Development Kit for testing and using the firmware. You can use the Charon I&II DB, which contains shifted peripherals and it's standard distributed with the Charon 2 module.

This firmware is not the default firmware, so you need to upload this firmware to the module. The basic network parameters are set via RS-232 line later using the easy standard terminal application.The application is available with the source codes in the development version of Web51 system as an example.

Basic Description

The main function of this firmware is to connect the RS-232 serial line, I/O ports and up to 4 thermometers via Ethernet network. It is not necessary to create your own, difficult application, because the peripheries are accessible via www, so you can use standard www browser.

  • The module is a small WWW server, so it has its own IP address and it provides standard WWW service on port 80. Than you can see the I/O ports status, the temperatures and so on. You can set also the password (in the RS-232 line setup) for making the changes on the outputs ports.  
     
  • The module allows you to display the temperature of up to 4 1-Wire thermometers and to display the text on the LCD display.  
  • There is a new feature, which allows the module to send an e-mail, if there was a pre-defined change on the input port.
     
  • There is also a chance to access the RS-232 line on the IP address and port 23 in the Client or Client/Server mode (the active mode).
     
  • The peripheries are accessible also using the Controller. Controller is a special text protocol, which access the module on port 26 and can be used for instance for testing via telnet.
     
  • This firmware doesn’t need the external 32kB RAM memory, which is placed on the Charon I module, so the firmware should run on each x51-based processor, which has approximately 512B of XRAM. We mostly use the T89C51RD2 processor developed by Atmel.
     
  • The Charon I module can’t stay alone, so you have to put the module into a basic or development board, which will be a connection between the peripherals and module.

The Controlled and supported peripherals

The Web51 Home Control uses the RS-232 line and 8 bits I/O port P1. You can set up two P port modes, the first is the direct port mode and the second one is a shift register usage mode. The recommended shift registers scheme is available on our web page (see Charon I&II Development Board).

8 bits port P1 – Direct access

If you need only several I/O pins, use the Direct port communication mode. Than you can remotely control:
  • RS-232 access via TCP/IP on port 23
  • 8 bits I/O gate on P1 port

Using the external shift registers

If you are using the recommended P1 port extension, you will get a very powerful tool with:
  • RS-232 line access via TCP/IP (port 23)
  • 8 bits input gate control (74165 shift register)
  • 8 bits output gate control (74595 shift register)
  • 4x 1-Wire thermometer control – for example DS1822 type
  • LCD display control (connected to 74595 shift register)

Doporučený hardware

  • Web51 HW 3.X An older development kit – RTL8019 connected directly to the MCU’s ports
  • Web51 HW 4.X An Industrial converter RS-232/Ethernet + binary inputs/outputs.
Charon I DK (Development Kit) It is an easy and cheap powerful development kit, where you can test the basic peripheries. It doesn’t have any shift registers. It is enough for smaller applications with only several I/O pins usage.
Charon I&II DB (Development Board) It is a development kit for those, who needs more I/O pins, direct pins, LCD output and other peripheries. This board supports also a peripheries, which are supported only by the Charon 2 module, as for instance second RS-232 line, JTAG, SERIAL FLASH up to 4 MB, ISP.

The module should be used with any other basic board, which supports at least the power supply and the right Ethernet connection.

The SNMP module’s firmware instalation

Upload the Home Web Control firmware

The Charon Module has already the default firmware Convertor Ethernet / RS-232 uploaded, so the first step is to change the firmware containing SNMP application. We will use the original Atmel's Flip program for upload the T89C51RD2 processor.

You should download the FLIP from official web pages of Atmel's company or you should download an older, stable version Atmel FLIP 1.6.

PSEN – programming

Connect the module Charon to the RS-232 serial link (using the serial cable, which is included in the development kit) and connect the PSEN jumper.

You can find the PSEN jumper's position on the development board (Charon Charon I&II DB DB on the left side- the bottom position „Forced“, Charon I DK under the LINK and POWER LEDs).

Since you have connected the PSEN jumper, switch the power supply on. Select the processor type (Device => Select => T89C51RD2) in the Flip program and open the firmware file with the HEX extension.

Set the RS-232 programming port (Settings => Communication => RS-232). If there was an error displayed, check the PSEN jumper position, or check the serial cable type (3 wire, RX, TX, GND) (if you are using Charon I&II DB, check the RESET jumper position - must be in x51 pos. and reset the module).

  • Do not forget to check the ERASE and BLANK CHECK checkboxes.
  • Disconnect the Atmel Flip program after programming has done.
  • Finally disconnect the PSEN jumper.
  • Connect the SETUP (T0) jumper.

Start any type of serial terminal (TeraTerm, Terminal), or we should recommend you to use our „Ethernet Converter SETUP“, which you can download from DOWNLOAD page on www.HWgroup.cz.

RS-232 SETUP for the Home Web Control application

Set the Serial Terminal application’s parameters to 9600 Bd 8N1, no handshake. Check, if the SETUP jumper is connected and the PSEN jumper is disconnected. Than reset the module.

ATTENTION
After each firmware upload, you must make RESET all the module's SETUP parameters to default. The internal EEPROM must be initialized by this way. Otherwise, the module does not work properly.

The Commands description

D: Reset to defaults 

This command reloads the default EEPROM setup settings. After that the defaults are loaded, set the IP address Mask and Gateway of the module.

S: Telnet/SMTP Server IP

It is an IP address of the other communication side:

  • If you would like to send e-mails, set the SNTP server’s IP address.
  • If you would like to use the module as a Client, set the server’s IP address.

The IP address must be different from the IP of the Gateway.


B: Speed 9600,N,8,1
Serial port speed:
   1: 38400 Bd
   2: 19200 Bd
   3:  9600 Bd
   4:  4800 Bd
   5:  2400 Bd
   6:  1200 Bd
   7:   600 Bd
Set the RS-232 line communication speed.
You cannot use other speeds or parity types than in the list.
   
A: Add device (max.4) now:1
Adding One-Wire device ... OK
E: Remove all devices
You can add or remove the 1-Wire thermometers.
   
H: HTTP password
Enter Password for access via HTTP:
The I/O WEB control password. If you don’t want to use the password, do not enter any character  
   
Z: System configuration
------- System Configuration -------
T: serial server          ON
S: serial client          ON
E: e-mail                 OFF

The each network parts activation.

  • If there is a serial client ON, the module is working as a client. The data from the RS-232 line will be sent to the Outgoing IP address (set in the previous setup command) to the standard TELNET port 23.
  • If there is an e-mail ON, the module does not send any data from the RS-232 port, but sends the e-mail to the outgoing IP address to the standard SMTP port 25. The e-mail events settings are described in the next part of this text.

We recommend you to switch OFF all the services, you are not using.

 
   
 P: Peripherals config.
--------------I/O ports-------------
id  in   state       id  out   state
------------------------------------
0.  in0   1          8.  out0  0
1.  in1   1          9.  out1  0
2.  in2   1          10. out2  0
3.  in3   0          11. out3  0
4.  in4   0          12. out4  0
5.  in5   1          13. out5  0
6.  in6   1          14. rea   0
7.  in7   0          15. reb   0
-------- Temperature sensors -------
id  name   temperature(gr.C)
------------------------------------
16. term1  29.7
17. term2  Not Present
18. term3  Not Present
19. term4  Not Present
---------------- Ports -------------
P: input capture Period         10(x 5ms)
A: Output state after Reset     0x00
- I/O port type:                Shift registers
S: switch to Shift regs ports
D: switch to Direct ports
N: port name
E: erase all names
- Caption for LOW state:            ---Vyp  
- Caption for HIGH state:           Zap---  
C: change HIGH/LOW captions
H: set to HIGH state(1)
L: set to LOW state (0)
----------- Display Mode -----------
- Mode of 2nd display line:         text mode
T: switch to text mode
I: switch to IP mode
Here you can set the names of each input
(0..7), „state“ indicates the inputs state,

and output (8..15). The name should be long up to 6 characters.

There is also the list of founded 1-Wire thermometers. You can also change the names as you need (16..19).

 

P: How often will be the inputs checked.

A: The HEX value, which will be written to the outputs after the reset.

S: Switch the P1 port to the External Shift Register mode

D: Switch the P1 port to the Direct mode

C: Defines the name of the logical 1 and 0 (ON and OFF, ALARM and OK..)

H,L: Sets the defined pin to 1 or 0.

T,I: Defines the control type of the second LCD display’s line. (both lines text or the second line is displaying the IP address of the last device, which connects the module).

   
 C: Controller
 
Switching on the Serial Line Controller. This option will be described later.
   
 X: E-Mail settings
-------------- e-Mail --------------
F: From - home_controll@web51
T: To   - lsn_web51@smtp_server
S: Subj.- Mousetrap state message

 Mask Patt. Message 
---------------------------------------------
 0x07 0x01  Msg1 - Mouse in the Mousetrap  
 0x07 0x02  Msg2 - Mousetrap - Armed       
 0x07 0x03  Err1 - Mousetrap - No Cheese   
 0x07 0x04  Err2 - Mousetrap - Under Attack
 0x07 0x05  Err3 - Mousetrap - Out Of Order
---------------------------------------------
C: Change Message
The E-mail settings.

There are 5 conditions with the e-mail texts for sending the e-mail, if this option is allowed..

Mask Defines, which input bit will be used for the Patt condition. The conditions are analyzed from the first one to the last one.

Running and Testing the Web51 Home Control Application

Disconnect the SETUP jumper and reset the application. No page will be displayed in the terminal window. The module is in the normal, running mode.

Go to the START-> Run Application and write the command: PING x.x.x.x –t and press the Enter. The number x.x.x.x is the module’s IP address. After that you have pessed the Enter key, the computer tries to find the response of the module. If the module is set and connected well, there will be a response displayed in the window.

Now it’s time to try the WWW connection. Run the internet Explorer or any other internet browser and write the modules www address: http://x.x.x.x for example in my case http://192.168.6.15.

The module generates the HTML page (see the picture on first page), where you can see the states of the peripheries. If you have accessed the page first time or no thermometers are connected, there are no temperatures displayed. Connect the thermometers and run SETUP. You can try to change the outputs values. If there was set a password in the SETUP mode, you have to write it to the text box. Otherwise no changes will be done!

If no LED is lighting, chack the LED jumper position.

The module is now tested. You can start to work with other module’s options now.

Note: After each manipulation with SETUP jumper, you must reset the module!

Používáme teploměr

Connect the thermal sensor as shown on the picture. GND, +5V, and the DQ pin to the P1.0 pin. Set the port to the SHIFT mode in the SETUP. You can add up to 4 sensors using the „A“ and „E“ commands. The thermometers can work in the same time, but if you are connecting a new thermometer, there mus be only one connected to the module. The module reads the sensors serial number.

Jak na odesílání emailů

Select Z: System configuration , set SMTP CLIENT ON and go back using the “M” command. If you are testing, set the direct mode, if you are working with the Charon I&II DB, you can stay in the SHIFT mode and use DIP switches as a binary inputs. The Gateway MUST be different then outgoing SMTP address. If these two addresses are the same, set the Gateway to 0.0.0.0, so the SMTP server is accessible only in local network.

Set the SMTP IP address using the S: Telnet/SMTP Server IP IP command. The SMTP server must be accessible on this IP on port 25.

Use the X: E-Mail settings command to set your own e-mail sending conditions. The mask means, that there will be done the logical AND between the mask and input port. The pattern defines the result after the AND is done. So, the conditions works as follows: The P1 value AND MASK is equal to PATT, than send the e-mail.

Serial Converter – TCP port 23

If the connection with the module is opened (for example from the Telnet application)on the port 23, all the data received by the module on port 23 are sent to the module’s RS-232 line and all the data, received by the module on it’s RS-232 line are sent to the Ethernet. The receiving device is set in the SETUP mode (outgoing IP address). There MUST be set the right Server/Client option in the SETUP mode. If the module does not sends or receives any character in 50 seconds, the TCP connection is closed by the module. The RS-232 communication mode is set also in the SETUP mode.

The limitations of the RS-232 line converter

  • · The Applications supports only one TCP connection in the same time. So, you cannot access the RS-232 line on port 23 and control the I/O pins on port 26 in the same time. The WWW service is independent and should work, if any of these two TCP connections is working

I/O Controller lite – TCP port 26

All the inputs, outputs and controlled peripheries has its own ID. Each periphery can has an alias of 5 bytes. For example, the first thermometer has a default alias “term1” and ID 16. This ID number is useful for the remote control.

The texts of each alias might be changed in the SETUP mode. The alias cannot be changed, if the application is running.

The Alias is used by the Controller with the “$” character, while the ID is signed by “#”.

The syntax of the Controller’s commands

There is used the following syntax for the remote control: port.command <enter>

port Defines, which device is going to be used for the command. The ID can be defined in the following ways:

  • #<ID> for example “#16“ if working with the first thermometer
  • $<alias> for example „$term2“ if working with the first thermometer

command Specifies the command, which would be done

  • ? – The state info
    -for example „#16.?“ – displays the state of the ID=16
    -for example „$in1.?“ - displays the state of the first binary input ID=1
  • s<string> - Other settings (for example displaying a text on the LCD)
    - for example „#24.sHallo“ displays the text Hallo on the first LCD’s line
  • 1 – sets the binary output to the log. 1
    - for example „#8.1“ sets the out1 (first binary output) to the log. 1.
  • 0 - sets the binary output to the log. 1
    - for example „$rea.0“ sets ID=14 (seventh binary output) to the log. 0.

Note: In case, there was set the „IP mode“ in the SETUP, there will be displayed „!-Read Only“ if you are trying to write on the second line of LCD.

Jan Rehak
Jan.Rehak@ HW.cz

DOWNLOAD & Links

  Main page Products Support & Download Pricelist Contacts SiteMap  


HW group - Prague - Czech republic - Europe