By dave | April 25, 2022

Control embedded menu application from browser - embedCONTROL.js

Instead of the desktop version, on Raspberry PIs you can serve a React.JS based single page web application that needs no installation. It works on a wide range of mobile phones, desktop and tablet devices. It is not supported in the Arduino or mbed environment directly at the moment.

Using the deployed app

To open the app, simply browse to the device on the configured host and port. For example if the device were and the port were 8080, you would connect to, in the case of port 80 you can omit the port number.

Note: On the Raspberry PI and any other Unix distribution, by default you cannot listen on ports less than 1024 without being the root user. There are a few options to get around this, the simplest of which is to run the webserver on port 8080.

Once the application loads, it will immediately attempt to connect using a websocket back to the server that initiated the connection. Once a connection is established and the initial state has been loaded each menu item is presented vertically, if the item is editable you’ll be able to change it using the appropriate UI. An example layout is presented below.

There are far more limitations with the web version, consider this only for very light usage.

How it works

This version of embedCONTROL is deployed to a web server and the server will serve up the application, with any updates and commands being sent on a websocket but essentially still using TagVal protocol over a websocket.

Should you wish to customize / build / look at / star it, the repository is here

By default, the designer UI can take the most recently built version and auto deploy it to a Java application running on a Raspberry PI. Further, embedded Java on Raspberry PI even supports menu in menu to combine many sets of device data together into a single browser page.

Using global settings to set your device name

Before pairing, go to the settings (top right button) and change the device name.

Controlling and monitoring the menu

Unlike the desktop version, the web version only controls one device, the one the board connected to (although if it happened to be a Raspberry PI using menu-in-menu you could be controlling more than one menu indirectly).

Analog, enum and scroll items are edited using up-down buttons. Dates and times use a date time control, while color items use a color wheel. All other items are edited as text.

There is a fair amount of validation before sending an item to the server, it should not be possible to send a bad value.

When you change an item locally, it will not show the new value until the server confirms the value by echoing it back. In that time the item will show in the pending color. Once the update is received the item will change to the updated color momentarily.

Should there be a problem with either sending the update, or you enter a bad value, the control will momentarily go red.

Pairing with the device

When you connect to a board for the first time, it may be the case that you need to pair with the device. This is only the case if you turned on Authentication in tcMenu Designer. When you try to connect the UI automatically detects that pairing is needed and presents a pairing dialog. Make sure you have the embedded device close by as you’ll need to accept the request there.

Once ready start the pairing process and accept it on the device screen. Note you should only ever accept pairing requests when you know for sure you initiated it.

Other pages within this category

comments powered by Disqus

This site uses cookies to analyse traffic, and to record consent. We also embed Twitter, Youtube and Disqus content on some pages, these companies have their own privacy policies.

Our privacy policy applies to all pages on our site

Should you need further guidance on how to proceed: External link for information about cookie management.

Send a message

Please use the forum for help with UI & libraries.

This message will be securely transmitted to our servers.