Inputs/outputs controller working over the Internet through a SitePlayer Web Server

By on January 3, 2018
Pin It

 

Using a SitePlayer SP1 module, it is possible to control four optoisolated inputs and four relay outputs through an Internet web page. The usage of this module is recommended for industrial and home automation.

 

SitePlayer module is a web server which, as soon as it is connected to the Internet or to an intranet, is able to answer the requests coming from any browser. It answers these requests by sending web pages using the HTML protocol. Web pages of the SitePlayer are dynamic and their parameters can be modified from an external electronic circuit such as a microcontroller connected to a serial port. These parameters can be also modified by commands received from a browser. Finally, it is possible to design an electronic circuit, with digital and analog inputs, digital output and etc., capable of being managed by an Internet web page.

For programming the SitePlayer module, first of all, the developer has to design the HTML page. He can choose to write it or to use tools such as Frontpage or Dreamweaver. Then, some scripts connecting the electronic circuit and the web page must be written in a .sdp file. At the end, SitePlayer Linker software merges the HTML and the .spd files into a binary file. This binary file can be uploaded on the web server module.

This project, through the usage of the SitePlayer SP1 module, allows managing four digital outputs and four digital opto-isolated inputs through a web page. Using a browser, it is possible to check graphically the status of inputs and outputs. It can work in a Local Area Network (LAN) or in a Wide Area Network (WAN) such as Internet.

This module can be used for industrial and home automation in applications like: lighting control, machinery control and heating-cooling plant control.

When it works in a TCP/IP network, it must have a unique Internet Protocol (IP) address (the default IP address is: 192.168.0.250). Subsequently, it is possible to change this address using an appropriate HTML page. The web-server, for communicating, uses the port 80 of the TCP/IP protocol. If the end user wants to have access to the web-server from another LAN, the network where the device works on must be correctly configured to get access to the external network called Internet. The network configuration must allow external requests and forward them to the IP and the port of the web-server.

 

THE ELECTRICAL DIAGRAM

 

The two main components of the board are: the microcontroller PIC16F84 (chip U2) and the SitePlayer module (chip U1). The SitePlayer module is used for interfacing with the intranet network or with the Internet while, the PIC microcontroller, through the B port, manages digital inputs and outputs. The microcontroller also manages the LD7 led and the P1 button. The link between the microcontroller and the web-server module is made by an asynchronous serial protocol working through two wires: RX/TX of the U1 chip and RA1/RA2 of the U2 chip. The microcontroller reads input values and writes them into pre-defined memory cells of the SitePlayer module; in this way, when an end user connects to the web server, the SitePlayer module updates the web page following the new values stored in its memory. Digital output values are set via the web page. The microcontroller reads memory locations related to outputs from the SitePlayer module. Then, it writes them to its digital outputs connected to relays. The IP address of the module is stored in the EEPROM memory of the PIC and at each start up, the microcontroller reads this value and sets it on the SitePlayer module. When the user modifies the IP address from the web page, the web server module sends it to the microcontroller and then, the PIC saves it into its EEPROM memory. The power supply of the board is composed by a LM7805 regulator which provides a 5 V line for the microcontroller and the web server. Because of this IC and because of the relays, this board needs to be powered with a voltage of 12 V.

 

TEST AND USAGE

Firstly, the user has to set the default IP address of the web server to 192.168.0.250. The “P1” button must be pressed, then the board has to be powered on and finally the user has to wait until the LD7 led starts blinking. The board has to be connected to the RJ45 connector of a PC or to a free port of an Ethernet switch. The SitePlayer module just supports communications in 10BaseT format. Through using a browser running on a PC, it is possible to connect to the board just writing the IP address in the address bar. After that, the HTML page, uploaded on the web server, appears on the PC screen. If it does not happen, there are two things to check: either there is another device with the same IP address on the network or the IP address of the PC does not belong to 255.255.255.0 subset (i.e. the IP address of the PC is not similar to 192.168.0.xxx and/or the subnet mask is not set as 255.255.255.0).

 

In the HTML page there are eight indicators related to the four outputs states and to the four inputs states. They also allow to modify the state of the outputs just by clicking them. There is also a button for changing the IP address of the board.

 

 

The board can be accessible via Internet if the router or the gateway (the bridge between the LAN and Internet) is correctly configured. The router has to “open” the port number 80 to the TCP/IP external requests and it has to forward them to the mentioned IP address and the port number of the I/O board. Some networks also have a firewall, so it is necessary to modify its rules in a way to make the I/O board accessible.

 

Download the source code

Source code

 

From Openstore

CONTROLLER I/O LAN SITE PLAYER

About PavanAndrea

Leave a Reply

Your email address will not be published. Required fields are marked *