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.

The Raspberry Pi in the Embedded World – An Introduction

[gn_heading style=”1″]Introduction[/gn_heading]

RaspberryPi2 Web
In September 2012 I received the first Raspberry Pi® and I was very impressed what it was able to do. Moreover than being only fascinated I was surprised that this all was possible for less than 30 €.

It is obvious that a computer running Linux can run a web server, database and much more. But that a device which is that cheap can do this is incredible and opens high power computing for lots of applications – at least for me.

When I am talking about high power computing than I refer to the embedded world where I’m doing my developing work normally, and where computer have often clock frequencies of 10 MHz or less.

[gn_heading style=”1″]Embedded Engineering[/gn_heading]
When an embedded designer needs much more power the work becomes really tough. Clock rates of 1 GHz, difficult design of multi layered printed circuit boards are only two of the obstacles you have to break through. Not even talked about the thousands of pages of documentation you have to understand.

I think many developers who created their embedded computer design based on ARM9 or ARM11 for automation equipment which is sold at lower volumes (< 10.000 pcs. per year) will start crying. At least their financial managers would when they calculate how many hours the company invested in the new design and when they compare this with the costs of a Raspberry Pi®. And don’t forget the losses because of the later launched product (time to market).

I know what I am talking about and know companies who went this way and there are many reasons to do this. Let’s imagine you need a modern graphic display with a resolution of 128 x 64 pixels instead of your old 2 x 16 character based one from the 80’s. And there is a request that remote access via the Internet browser would be nice to have. Then the system should be extendable to some degree and logging data to a SD-Card would be great.

At this point I would say someone leaves the standard 8 or 16 bit microcontroller based world and think about computers which more power. Of course there are solutions for low power microcontrollers providing Ethernet access, Internet, etc. But when you compare how long it takes to get all the features from the previous paragraph into a small microcontroller with the savings of your own design you have to sell lots before break even. Remember for microcontrollers like Atmel AtMega®, Microchip Pic®, etc. you have to do the most of your work by yourself.

When you compare this to the simple installation of Apache, Tomcat or MariaDB under Linux computers it’s waste of time and money do reinvent the wheel – at least for the quantities I’m talking about.

Moreover developing applications becomes easier which such a system behind you, also. I can understand when an embedded developer disagrees, but have you ever thought about programming embedded applications in Java, Python and PHP? It is difficult to get familiar with this thought since I refused using even C++ for my applications and stuck with pure C until now.

[gn_heading style=”1″]Advantages[/gn_heading]

Let’s summarize what a Raspberry can do for you as substitution in the embedded world:

  • It is a mature hardware platform providing lots of peripherals working out of the box without any development necessary
    • Powerful ARM11 controller with 700 MHz clock frequency
    • 10Mbit / 100 Mbit Ethernet controller
    • USB Host controller
    • 512 MByte RAM
    • Video Output HDMI and Composite
    • SD Memory Card slot
    • Many General Purpose IO lines
  • Take advantage of the Linux Operating System
    • Develop your application on the same platform where the final application runs. There are now debug adapters of programs needed.
    • Development of embedded applications using the same programming languages that you use on the PC
    • Creating embedded applications become much easier, design professional user interfaces and programs with Eclipse, Java, Python and PHP and make portable embedded designs.
    • Use Apache web server as a mature platform for your web based applications
    • Employ MariaDB as replacement for MySQL® which allows professional logging of any kind of data
    • Get access to your computer by Secure Shell (SSH) from wherever you are, install or update new programs and configure them remotely
  • Other Advantages
    • Add WiFi to your embedded computer without trouble

These are only a few points and the list above is far from being complete.

[gn_heading style=”1″]Conclusion and Perspective[/gn_heading]

LucidControl DO4-S Web ProductFinally, I do not want to praise such computers like the Raspberry Pi® and I do not want to throw the practice of embedded design into disarray. As you can see at our LucidControl IO USB Modules which are based on Atmels ATXMEGA® microcontroller and is programmed in pure C, there are still lots of reasons to program in this style.

Also in points of power aspects small microcontroller have a big advantage and make devices with e.g. AAA batteries possible.

Within the next days and weeks I will complete this article and let you know my experiences with programming the Raspberry Pi® in Java.

I found something very interesting called RAP (Remote Application Platform) which allows making Java applications with SWT user interfaces running on a web server like the Tomcat.

This is a very neat thing because it gives the user the impression having a “real” application running in the browser instead e.g. an HTML based PHP site. Moreover it allows using existing desktop Java applications via the web.

The RAP, Tomcat and also a demo application is already running showing the power of the system and of course of our LucidControl USB IO Modules.

If you are interested in this see the following links:

Remote Application Platform Home (eclipse.org)

Remote Application Platform Demo (eclipse.org)