A few weeks ago, I bought myself an HTC Desire which is an Android based phone. The phone can be used to read email, browse the web and make a phone call. It can also run a homebrewn applications that have been developed using the Android SDK. My first application should be one related to my line of work. It should be able to send and receive process information using COTS products like the OPC DataHub. The OPC DataHub is an application that collects various types of data from OPC Servers, or other sources and makes that data available to any given client. The image below shows a typical setup in which the OPC DataHub is used.
Writing the Android application was not difficult. Cogent already provides a Java library to interact with the DataHub and the Hello Android tutorial helped me to get started on the front-end. I was able to run my first application in the Android Virtual Device after a few hours of coding and editing XML resource files.
After verifying the application, it was ready to run on the phone. I uploaded the apk file to a webserver and downloaded it from there. The result… well see for yourself.
The application can connect to the OPC DataHub hosted by Cogent or you can connect to your local OPC DataHub.
Here are a few steps to get started on android development:
- Get the Eclipse installation instructions from the Eclipse WIKI
- Get the Android SDK installation instructions from the Android SDK website
- Get the Datahub documentation from the OPC DataHub website
- Download and install the Eclipse IDE for Java developers
- Download and install the Android SDK
- Download and install the OPC DataHub
- Create a new Android Virtual device.
- Import our example that you can download. The source code is easy to read and documented.
- Add the datahub java archive to the project, it is not included in the download. The java library is included in the OPCDataHub download and can be found in: c:\program files\OPC DataHub\Plugin\WebServer\html\Java\
- Read through our example. It is documented and it should help you writing your first Android client for the OPC Datahub.
A few application came to mind when developing this application:
- Monitor OEE data, directly from the shop floor.
- Adjust setpoints on the fly.
- Get the latest equipment alarms.
- Commissioning machinery.
If you have questions about this post, please leave a comment. We will try to answer them as soon as time allows us.
Visit the Cogent support forum if you have question regarding the OPC Datahub. Questions about Android cannot be posted in the various Android newsgroups available. For sales inquiries, contact Cogent or ATS. ATS can also assist you with the implementation of the OPC DataHub in your production environment.