We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information that you've provided to them or that they've collected from your use of their services.

Android App

With the use of jQuery, Phonegap and my jQuery plugin I have build a simple app for devices running Android.  After entering a few basic configuration data you should be able to change values of PLC variables and read states of inputs and outputs.  My goal was to show how simple it might be to control a PLC with a small program build with open-source technology.

 

Screen3 Screen2_2 Screen1

After the first installation you will be asked to enter basic configuration data: 

  1. IP of your WAGO PLC controller "http://XXX.XXX.XXX.XXX/"
  2. Names, read/write addresses of your buttons.  The field 'Description' is not used by the program and is aimed to help the user distinguish the buttons.
  3. In each 'room' the maximum number of columns can be set,
  4. The buttons 'Add Screen', 'Add Room', 'Add Button' allow adding elements to the main screen,
  5. The buttons 'Remove'(...) remove the elements,
  6. To switch between 'screens' do a 'swipe' movement (left/right) on the main screen.

Before you start testing please check if your device is connected to the same network as your PLC controller.

'Tap Buttons' can be used to control lights.  In the field 'Name' enter the name you want to see on the button. In 'Read' enter the address of the output controlling the given light circuit ('QX0.0').  In the filed 'Write' enter the address of the variable, used to control a given function block ('MB0').

in the PLC program, in variable definition (for example):

VAR
	VARIABLE1 AT %MB0 : BOOL;
	LIGHT1 : Fb_LatchingRelay; (*z biblioteki Building_common.lib*)
END_VAR

Where ‘MB0’ is the address used for communication with VARIABLE1.

In the PLC_PRG program enter one function block controlling the lights:

LIGHT1(xSwitch:= IN1 OR VARIABLE1);
OUT1:=LIGHT1.xActuator;

Where IN1 is a digital input (for example, a button), OUT1 is a digital output controlling the circuit.  Configure the address of OUT1 as QX0.0 (in Resources/PLC Configuration).

The button 'Read Temp' can be used for reading temperatures from analog inputs.  The 'Write' field is inactive.  The 'Read' field should receive the address of the analog input ('IW0').

The button 'Read Value' can be used for reading statuses of a given input or output, or a value of an variable. The 'Write' field is inactive.  The 'Read' field should receive the address of the input/output/variable ("QX0.0", "IW0", "MB0").

After you finish the configuration ('SAVE' button) the app will read all 'Read' addresses every 5 seconds.  The statuses/values of the fields will be updated accordingly.  In case of the 'Tab Button', its color will be changed (yellow for QX0.0=1, black for QX0.0=0).  In case of the 'Read Temp' field, the received value will be divided by 10 and the units will be added at the end.  In case of the 'Read Value' field, the received value will be updated as is without modification.

If you have any questions, comments or suggestions, post it on the forum.

App at the Google Play