Main Page | Projects Index Gallery IndexSite log


µSCADA(p) V1.X



uSCADA(p) is primarily intended to link an intelligence device such as a microconrtoller or PLC to an Android Phone or Tablet, using the MODBUS protocol over Bluetooth.

The idea was to give developers a system that could quickly provide projects with a usable interactive front end.

This program is an extension to the uMODBUS(m) software and as a result shares some of its methodology and functionality.

The Bluetooth medium was selected as with this a direct device to device serial connection can be made that does not rely on any supporting networks, in this way the software can be used for the development of portable applications.

A project can be built up using the various sections of the software so that Digital and Analogue Inputs can be read back from the intelligent device and displayed in a readable form.

Additionally by taking advantage of some of the capabilities of the Android system, digital inputs may be given alarm sounds by associating mp3 files and spoken responses to state changes. Theses associated sounds and phrases are configurable and do not have to be used.

With uSCADA(p) the raw data provided by a remote ADC may be prepared and scaled to provide a meaningful analogue for display. Units can also be added and level alarms may be generated when threshold trigger points are reached. These functions are also configurable.

Digital and Analogue Outputs options are also provided and allow user entry on the Android device to be prepared and written back to the Intelligent device.

State changes may be logged and the condition of analogue inputs can be periodically archived to file.

The final output of the software is to provide 8 fully configurable display lines that can be set to perform any desired IO function.

What follows is a step by step guide on how to configure and use the software.


Staring uSCADA(p):


Once uSCADA(p) has been installed the first screen you will see is the Connection/Project Manager: 

From here uSCADA project profiles can be created, managed and launched and at any one time
up to 100 profiles may be made available. Out of these 7 may be selected for quick launch
and placed on this screen.

On each line the name of the project profile is also shown to make easy selection possible. If it is the first time the program had be ran all 7 lines will say “No Project Found!" 

Each project profile can be given a number of 1 to 100 and it is this number that is shown in the left hand column of the quick launch screen. The project profiles that are shown on this quick launch list can be simply changed by pressing the numbers down the left hand side, for each location on the list any project number may be selected.

If a project profile is valid and can be launched this is shown in the top right hand
corner in green, to begin with no valid profiles are ready so we need to create one.

Creating a new project profile :

To create a new project select any line on the quick launch screen and press new/edit, the screen
should then change to:

If the line was unused then you can start to build your project profile striate away, if however it was occupied first change the ID number to one that is currently unused. 

To build your project profile follow the steps below:

  • Change the ID number
    (if required)
  • Enter a project name
  • Press load defaults
    (this will load standard values into the communications scan and timeout cells)
  • Press BT scan to find the Bluetooth slave associated with the uMODBUS/uSCADA task
    (if this is the first time that the Bluetooth device has been used then it
    will need to be paired with your device, by default most Bluetooth devices
    user “1234” or “0000” as a pair code)
  • Save the project profile and return back to the launch screen

Once populated the screen will look something like this:

 and on selecting return your new entry should appear in the list:


If your new profile dose not appear on the list then one of the entries on the quick launch
screen must be changed so that it points to your new project profile, to do this touch
one of the ID numbers down the left hand side and change it to the ID of your new profile.

Once your profile appears on the quick launch list then the top right hand indicator should
go green to show all the correct parameters have been entered successfully. The communications baud rate and parity settings will depend on your Bluetooth device and the manual for your device should be consulted if you are unsure what these are.

You are now ready to quick launch into your uSCADA task.


Setting up MODBUS Communications:


Once the uSCADA task is launched then the screen will change to that below:

If all is well, and the MODBUS slave is responding to read requests then you should
hear a system message stating that the MODBUS link has been established.

The important factors to consider here is that the Slave address is correct(otherwise the remote slave will not respond) and the read and write locations are valid for the device (valid locations for MODBUS usually range fro 40001 to 49999 for the functions used).

Initially the read and write locations are 40001 for Read and 40010 for Write, but these can be changed to anything within the valid range.

The maximum number of reads or writes for this software is upto a block of 8, but again initially these are set to one.

The number of write locations may be reduced to zero, but the minimum number of read locations
is set to one. This is required to maintain the communications poll to the MODBUS slave.

Reading Inputs: 

Once communications with the MODBUS slave has been established the result of the
MODBUS reads may be viewed by pressing the Raw Inputs button, on selection the screen
should change as below.

The number of lines displayed will depend on the number of read locations selected on the MODBUS R/W Setup page. Both the integer and binary versions of the returned values are displayed on this screen. 


Here if we know the start address of the block read, the line numbers can be related to the source location from where the data was read. For example if 4 read registers were selected starting at 40001 then the display lines correspond to the source registers as below:

In:0 = 40001
In:1 = 40002
In:2 = 40003
In:3 = 40004 

Writing Outputs: 

If any MODBUS write locations have been selected on the MODBUS R/W Setup page then by selecting the Raw Outputs button a number of MODBUS write locations will be displayed as below:


Again both the integer and binary representations of the locations are displayed, however this time by touching the integer or binary representations the contents can be altered. On accepting the change the entered value is sent to the MODBUS slave.

Again the line number can be related to the final destination of the MODBUS write:

Out:0 = 40010
Out:1 = 40011
Out:2 = 40012

By selecting the integer representation a simple entry window allows the transmitted number to be changed, however if we select the binary representation the following window will open that allows a bit by bit alteration of the transmitted word:


Here the entered binary representation of the transmit word are depicted in both integer and hexadecimal form. Once the required alteration to the word is made various options are available as the word could be written to the the salve, reset to before any alterations were made or we can return back to the Raw Output word screen. 

Checking Communications:

The last of the options on the MODBUS configuration page is Comms Monitor, this simply allows the communication traffic between the master and the slave to be monitored. This can be useful for fault finding and diagnostics.



Changing Software Options:


In order alter the way in which the software operates some options may be viewed and modified as below,this screen can be accessed by pressing the mode change button and selecting Options&Setting from the list.

These functions serve specific purposes and these are listed below:

Keep Alive - This has been included as most android device go into power save if the screen is
not pressed for a period of time. By selecting this function and saving the changes.
The phone will not go to sleep while the program is running. If uSCADA(p) is quit then
this function is released and the android device will be able to sleep normally again.
Also if the battery drops to below 30% then this function is again released.   

Disable Return Button - This has been added as on some devices the return button (sometime
represented by an arrow folding back upon itself) can be easily accidentally pressed quitting
the communications program.

Play Connection Sounds - With this function selected (this is selected by default) the
communications state of the program are announced to the user.

Create States Log - If this option is enabled then a running log of digital states
will be generated, these will include changes in communication states, digital input and
level alarms on analogue inputs. These records will be located in the \LOGS\
directory of the project on the devices local memory. An outline of how to locate these
is given later on.

Create Analogue Log - This is similar to above with the exception that a record will be generated
of any analogue inputs which have been set to produce an archive.

Archive Every - This is the common archive period for all analogue records.


Creating a uSCADA Project Interface:


As mentioned previously uSCADA(p) allows the user to create a basic interface that is driven from
the data that is retrieved in the MODBUS read cycle, or to take user entries and make MODBUS writes to the slave device. The creation of a simple interface is briefly outlined below that uses one of each of the four element types available, these are namely DI (Digital Inputs), AI (Analogue Inputs), DO (Digital Outputs) and AO (Analogue Outputs).  

To facilitate this program we will set up the MODBUS Comms as below:

Number of reads: 2
Start of Reads: 40001
Number of Writes: 2
Start of Writes: 40010

this will give us an I/O map equate to:

In: 0 = 40001
In: 1 = 40002
Out:0 = 40010
Out:1 = 40011

this information will be used when we construct the interface in a moment.

To change to the interface builder select the change mode button and
pick build interface from the list. on doing so you should then see:

DI - Digital Input Element:

If we press the line marked up "line not used - press to change" a pick list will appear that will allow us to choose the function of interface line: 0.

For now if we select Digital input, the display will then change to that shown below. For each input type a number of screens will need to be populated, for the digital input element there are 3 screens "i/o type", "True States" and "False states". These can accessed by simply touching the tags names for the sections.

Here we need to supply specific information in order to build the digital input display line.

The function of these are briefly outlined below:

As mentioned above in the MODBUS configuration section we configured the digital inputs to have the following mapping.

In: 0 = 40001
In: 1 = 40002

In this example we have specified that the state that will be considered for this digital
input element will be located at Bit 0, Word 0 and this equates to Bit 0 of MODBUS location

We will consider the operation of this Digital Input later in the testing section below.

Before continuing click the  "SAVE>CONFIG" button to save the interface so far to file.

AI - Analogue Input Element:

You may have noticed while changing between the three screens on the last section the
interface line at the top of the page is "Unlocked" while on the "i/o Type" page and "Locked"
while on the "True State" and "False State" pages.

I we check that we are on the "i/o Type" page then by touching the Interface Line indicator
(the button that now states it is unlocked) and a popup menu will allow you to change between
Interface lines, for now change the number from 0 to 1, the screen should then clear down
and the process type will once more state that the line is not used as before however this
time we are looking at the configuration for the second line.

Once again by pressing the "Line not used - press to change" we will be requested to choose
the function of this interface line, this time we should choose "Analogue Input" from the list,
although we could choose any of the options.

On doing so the screen should change to that below:


As before we need to supply specific information in order to build the Analogue input channel, the function of these are briefly outlined below:


Scaling options-

As the source of the analogue input is a single signed binary word supplied by the MODBUS read,
in order to convert this into something that can easily represent real world values it must
first be manipulated in some way.

uSCADA(p) offers two ways in which this could be done, these are namely my multiplication or scaling.

Multiplication by a factor:
This signed binary word can represent a number range of +32767 to -32768, the simplest way to convert this to a value with decimal places is to simply multiply it by a factor. For example by multiplying this binary word with 0.1 then we now have an output range of  +3276.7 to -3276.8. As long as we are careful not to over range this is a quick and simple way of representing real world numbers.

A more sophisticated way of producing a ranged output is to scale the signed binary word. This is useful when a a digital input device contains something like an ADC which will generate a known output depending on input.

For example the ADC may be connected to a potential divider so that the input range of 0-5 volts to the ADC represents the voltage of a supply battery of 0-15V. For a 10 bit ADC the output would then range from 0-1023 for an input of 0-15V. These factors could be entered into the program as that a direct representation of the input voltage could be displayed. To do this we would simply set the raw Max/Min values to 1023/0 and the scaled Max/Min values to 15.0/0.0.

Alternily if we wish to measure 4-20mA signals then if we pass the current though a 250ohm resistor and connect this to the channel, by scaling the channel to have raw Max/Min values of 1023/204 and the scaled Max/Min values to 20.0/4.0 a direct reading of the loop can be mesured.

Analogue Level Alarms-

As part of the configuration of the AI channel we have the option of setting up some analogue alarms, these are the HiHi, Hi ,Lo and LoLo references in the last half of the analogue input configuration. These can be setup to act in a number of ways and the simplest way to explain their operation is to refer to the drawing below:

In this diagram the default thresholds and deadband are represented. 


No Trigger Action
If this option is selected when no analogue alarms are required, if this option is used non of the other Alarm Trigger entries will have any effect.

Trigger Above
If this option is selected then with an input of 0-1.5 no alarms will sound, however as the input level increases then progressively the LoLo,Lo,Hi&HiHi alarms will sound.

Trigger Below
Alternately if this option is selected then with an input of 100-99.5 no alarms will sound, but as the input level decreases then progressively the  HiHi,Hi,Lo&LoLo alarms will sound.

Trigger about
Finally if this option is selected then with an input of 24.5-75.5 no alarms will sound, however as the input level decreases then progressively the  Lo&LoLo alarms will sound, conversely as the input increase above the mid range then the Hi&HiHi level alarms will be triggered.

The selection of which option is used depends heavily on the intended application, in the example above as we are monitoring the voltage of a battery we have selected the 'trigger below' option.

DO - Digital Output Element:

Once again in order to add another element to our project move back to the "i/o Type" page
and change the line number from 1 to 2, the screen should then clear down and the process
type will once more state that this line is not used.

Once again by pressing the "Line not used - press to change" cell we can select a function
type for this interface line.

If we select DO for digital output then the screen should change to:


Once again to configure the interface line some basic information needs to be supplied as below:


Most of this is self explanatory, the one thing that is worth noting is how the source and target Word/Bit addressing works.

If we recall previously the output MODBUS write was set to:
Out:0 = 40010
Out:1 = 40011

Therefore by setting the target word and bit to zero, we are actually targeting the output at bit
zero of 40010.

AO - Analogue Output Element:

The last of the IO types available is the Analogue output, to configure an interface line
to this function once again we must change the line number to one that is currently unused.
Currently we have programmed line 0,1 and 2 so if we change the line number to 3, the screen
should then clear down and the process type will once more state that this line is not used.

Once again by pressing the "Line not used - press to change" cell we can select a function
type for this interface line.

If we select AO for analogue output then the screen should change to:


In order to configure the interface line to operate as desired we must supply
some data in order to guide its over all function, a breakdown of the
necessary data is as follows:


Once again the data can be scaled or multiplied before it is sent to the MODBUS location, the
user entry can be hidden and replaced with "*" and the key presses on the interface keyboard
can be set to give feedback.

Here we have opted for visible entry and multiplication with a factor of 0.1, for convenience
this factor is the same used for analogue inputs so strictly speaking should the the inverse of
the number shown. Here if the user enters 78.9 then 789 will be sent to 40011 as set up in the
MODBUS section previously.

Finally the last feature that is worth mentioning here is the function of the Anal o/p Max/Min when multiplying and Anal Raw Max/Min on scaling. These values act as the minimum and maximum
range of the data that can be sent to the target location and is intended to prevent data overruns
on the target register. If the Min/Max values have been exceed indication will be given on the
interface line, this will be outlined in the interface testing next.


Running the uSCADA Project Interface:

Now we have built a basic interface, once we have arranged a device to talk to we can start running the interface. On first running the interface it appears as below:

DI-Quick Test:

Initially the remote registers at 40001 and 40002 are both at zero, firstly if we set bit 0 of 40001 to true the display will alter to as previously we configured a true state on the bit to represent a failed state.


AI - Quick Test:

Next if we set 40002 to 138 this will be displayed as 13.8 Volts on the second input line: 

If we then drop the input to 121, this will be displayed as 12.1 Volts and a Hi Alarms the threshold of the alarm was 12.3 Volts with a 0.1 Volt dead band.

 DO - Quick Test:

Next if we set the output and acknowledge the requested then bit 0 of 40010 will be set to True. 


AO - Quick Test:

Finally to use the Analogue output we need to touch the cell containing the value we wish to
alter, in this case it should say 0 Degrees Celsius. On doing this the Analogue Output
screen should open: 


From here we can enter the desired value, here the CLR button clears the input window,
RST resets it to the value prior to entry, WRT writes the input to the target
destination and EXT returns to the previous interface window.

Here if we try to enter 103 degrees we get the following response from the interface stating that the entry is "Outside Range",  also if we check the target MODBUS location in this case we will find that it is 1023 and this was the O/P Max configured previously.

We need to enter a value that will result in an output of 0-1023 or with the multiplier 0-102.3, so if we enter 83.7 this will be accepted and a correct scaled output will be found at 40011 of 837.

If we press EXT to return back to the main interface the entered value is displayed.


So far we have discussed setting up the Bluetooth link, configuring the MODBUS Reads & Writes and building a basic interface. There are also some additional functions that are worth mentioning that allow fast interface startup and generating and reading logs, these are the topic of the final section. 


Additional Functions:

If we look back at the options section previously you may notice that there are some additional options that we did not select these are namely 'Start Interface on startup' , 'Create States log Archive' , 'Create Analogues Archive' and 'Archive Every:30'. The first of these 'Start Interface on startup' if selected will allow an interface to be launched from the quick launch screen skipping all of the configuration screens. These can still be accessed if required they are just hidden for convenience and simplicity.

 The next of these 'Create States log Archive' if selected will create a log of events such as those below: 

- program startup, paused and resumed logs
- serial connection state comms failure
- digital input transitions
- Analogue level alarms

These logs are stored in a directory on your device 'sdcard/uSCADA//Project001/Logs/' the files here have time indexes within the names and can be views on a text viewer or spreadsheet viewer. if opened within the text viewer the states log typically looks as below:

Similarly the 'Create Analogues Archive' and 'Archive Every:30'  will create an ongoing analogue log, the code is designed to continually file write up to 10000 entries so on 30 seconds will run out of space in 3.47 days. Again if this file is viewed will look something like below:




Useful Data:


Links to Instructional Videos