Lighthouse58 is an Internet of Things learning case based upon the LEGO® Lighthouse Point 31051.
The goal was to enhance the features of the Lighthouse by integrating and controlling devices, e.g. top light, OLED display with a clock & actual weather (at the Lighthouse position gathered from Weather Underground), motion detector, outdoor lights, room lights, lights dimming, ambient light, LEDs.
Its original build has been enhanced to accommodate the various devices. In addition a newly designed Control Unit holds the controllers. Controlled by a Raspberry Pi 2B with TinkerForge Master Bricks & Bricklets. Communication between the controller and the devices is done via MQTT (TinkerForge Brick MQTT Proxy).
Lighthouse58 can be controlled via:
B4J Windows Client - Dashboard to control the various objects with its devices.
B4J Windows Client - Lighthouse Configuration
B4J Windows Client
The list of libraries used can be found in folder libraries.
B4J Server - Multi Client Control running on the Control Unit (Raspberry Pi).
Example shows a Windows Browser (Firefox) and Browser (Firefox) on Android Smartphone.
B4J Server
B4J Server - Download B4J Source here.
Additional information to be found in the documented source.
Summary
Compared to the current Node-RED Browser solution, B4J offers more options for developing additional functionality, client types (Windows, Server, Android), code can be reused across B4X solutions.
Version Control
20161009:UPD B4J Server solution completed.
20161006:NEW Server solution first draft; UPD B4J Windows client completed.
20161001:NEW Lighthouse configuration; UPD Lighthouse with Lighthouse selection & information.
20160929:NEW MQTT console, object form icon buttons, B4J source available.
20160926:NEW first version published.
The goal was to enhance the features of the Lighthouse by integrating and controlling devices, e.g. top light, OLED display with a clock & actual weather (at the Lighthouse position gathered from Weather Underground), motion detector, outdoor lights, room lights, lights dimming, ambient light, LEDs.
Its original build has been enhanced to accommodate the various devices. In addition a newly designed Control Unit holds the controllers. Controlled by a Raspberry Pi 2B with TinkerForge Master Bricks & Bricklets. Communication between the controller and the devices is done via MQTT (TinkerForge Brick MQTT Proxy).
Lighthouse58 can be controlled via:
- Browser Dashboard developed with Node-RED (included in Raspbian Jessie).
- Windows Client Dashboard developed with B4J.
- Multi Client Browser Dashboard running as a server, developed with B4J, on the Control Unit.
B4J Windows Client - Dashboard to control the various objects with its devices.

B4J Windows Client - Lighthouse Configuration

B4J Windows Client
- Messaging based on MQTT using TinkerForge messages. No linkage with Node-RED, means the B4J solution runs without Node-RED.
- Each object (lighthouse, pier ...) is defined as a class module, with a movable non-modal form. The title-bar contains icon buttons. Forms created with B4J Visual designer.
- Switches are clickable image-views with tool-tips.
- CSS styling applied in various ways (CSSUtils library, external CSS file, API javaObject) plus setting dedicated non B4J exposed properties using JavaFX API (look at the ColorPicker or Slider).
- Remote Control (shutdown, get system information) of the Raspberry Pi using the jkSSH2 library (many thanks for providing). A great way to remote control the Raspberry Pi (will apply this to other solutions based on the Raspberry Pi).
- Weather Information from Weather Underground displayed in gauges using the jGauges library (many thanks for providing).
- MQTT Console listing selected (for the bricklets used) messages.
- Settings defined as a map stored in external settings file.
- Lighthouses Configuration form (TableView with textfields; RGB color builder with sliders; Lighthousetype holding information)
The list of libraries used can be found in folder libraries.
B4J Server - Multi Client Control running on the Control Unit (Raspberry Pi).
Example shows a Windows Browser (Firefox) and Browser (Firefox) on Android Smartphone.

B4J Server
- Responsive design using w3.css framework (material design).
- Multiple clients can control the dashboard. The state of the controls is updated in the browser for each connected client.
- Request Weather Information from Weather Underground and display in a Dialog.
- Trigger Control Unit system check (displayed as status message in a label on each connected client) and shutdown.
- Dialogs for showing selected Lighthouse information and About box.
- Messaging based on MQTT using TinkerForge messages. No linkage with Node-RED, means the B4J solution runs without Node-RED.
- Settings defined as a map stored in external settings file - the same file is used by the Windows Client.
- Server application runs on the Control Unit (Raspberry Pi). Access via Browser with URL http://ip-adress-raspberry-pi:51042
- The library TFMQTT is used to control the TinkerForge Bricklets. Other libraries are jserver,jmqtt, json.
B4J Server - Download B4J Source here.
Additional information to be found in the documented source.
Summary
Compared to the current Node-RED Browser solution, B4J offers more options for developing additional functionality, client types (Windows, Server, Android), code can be reused across B4X solutions.
Version Control
20161009:UPD B4J Server solution completed.
20161006:NEW Server solution first draft; UPD B4J Windows client completed.
20161001:NEW Lighthouse configuration; UPD Lighthouse with Lighthouse selection & information.
20160929:NEW MQTT console, object form icon buttons, B4J source available.
20160926:NEW first version published.
Last edited: