RAP and the Raspberry Pi – USB IO Module Demonstration


[one_third first]

Plug & Play USB IO

[dropcap3]1[/dropcap3]
Turn your computer with LucidControl Plug & Play IO Modules within minutes to a powerful data acquisition, monitoring and control system.
[/one_third]

[one_third]

Data Acquisition & Control

[dropcap3]2[/dropcap3]
Ready for many automation applications. Measure temperatures, control your home, garden or caravan with the outstanding LucidControl IO devices.
[/one_third]

[one_third]

RPi & Beagle Bone

[dropcap3]3[/dropcap3]
LucidControl is compatible with the Raspberry Pi® and Beagle Bone Black which maximizes the number of possible applications.
[button link=”https://www.lucid-control.com/lucidcontrol-usb-io-module-web-demonstration” style=”info” text=”grey” window=”yes”]Read more about …[/button]
[/one_third]


[hr]

In my last post I tried to explain the advantages of using the Raspberry Pi® instead of proprietary developed computer design.

At the end of the article I mentioned using RAP (Remote Application Platform) for writing Internet based Java control applications.

When we were developing the LucidControl USB IO modules we always had in mind to allow remote web access as it is e.g. a prerequisite for smart home applications.
We did lots of trials with several languages like PHP, Python (which is now my favorite script language) and of course Java and we saw one major problem – the usability.

[gn_heading style=”1″]RAP vs. PHP[/gn_heading]
Especially in PHP we initially saw a candidate for web applications (lots of people write programs in PHP) but in the end the result is always a completely new transmitted website with the updated results after any change.

In our example we wrote a simple PHP application which included a button and a text field. Clicking onto the button toggled a digital output between on and off states. The text field represented the current state of the digital output and was updated once after clicking onto the button.

When the button was clicked and the output was changed this caused recreation of the whole updated PHP page which gives the feeling of a typical HTML web application which was not satisfying our needs.

After some more research we found RAP which is a mature platform for remote applications and gives very impressive results in terms of usability. RAP applications allow using of existing Java code and support complex SWT (Standard Widget Toolkit) technology.

A RAP program is typically developed using Eclipse and it can be deployed to a web server like Apache Tomcat where it runs. Most of the recent browsers are able to run RAP applications without any other software being needed. And yes, the whole application runs on the web server there is nothing needed on the client browser. It runs even on a smartphone – I think this is a very cool thing. And of course the whole server is running on a Raspberry Pi® as you will see below.

Since setting up RAP is a bit tricky I will start with an interactive demonstration here and hope this is a good appetizer to get curious.

[gn_heading style=”1″]Interactive Demonstration[/gn_heading]

This demonstration consists of two parts. At first there is a live video stream showing the demo set up in our laboratory. And there is a user interface application written in RAP through which the demonstration can be controlled.

The live video stream shows the Raspberry Pi®, a LucidControl DO4 – 4 channel digital output module switching 3 lamps which are connected to the channels 0, 1 and 2 of the USB IO module. The states of all 4 channels are indicated by the 4 LEDs at the lower front panel area of the module.

The application above shows the user interface written in Java and SWT with 4 buttons for setting and clearing the output channels. A green button refers to a set output a red button refers to a cleared one.

The complete demonstration is running on the Raspberry Pi® which means the control application as well as the video streaming. The video is captured by the program Motion which makes the live stream available to the web. Many articles about this topic can be found in the Raspberry Pi® forum. As web server Apache and Apache Tomcat are used. Especially Tomcat is needed because it runs the RAP application.

By clicking on the “Channel 0” button not only the output is switched, but also the left lamp on top of the arrangement is switched on and of. The same happens with “Channel 1” and “Channel 2″ button for the middle and the right lamp.

Moreover the application shows how a timer does a periodically update of a label in the browser. Actually, the number is updated once a second and shows how low you are working with this application.

Please see also the menu on top of the application and the dialog which opens when clicking onto “File -> Options…”.
All of these things are running on the Tomcat web server and can be used wherever you are and on mobile devices also. Give it a try!

[gn_heading style=”1”]Conclusion[/gn_heading]

In my opinion RAP is a very good platform for writing remote applications with a great usability which users are expecting from modern applications. Since the code is pure Java lots of programmers have already the skills to create applications which are much more sophisticated than my demonstration without learning a new programming language.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply