Aug 12

MQTT.fx 0.0.6 released

I have just released a new version of MQTT.fx (0.0.6).

Introducing Connection Profiles
Instead of choosing a certain broker address and a broker port using the same connection options, I now have implemented Connection Profiles.

A named Connection Profile contains all information for a certain broker connection (address, port, Auth/SSL/TLS settings, Last Will/Testament, etc.). It’s much easier now to connect to different brokers with changed setups and connection options:

mqtt-connprofiles

Now a connection can be established by just choosing the name of a previous defined profile:

mqtt-connprofiles2

Support for SSL/TLS

Also I have started to implement support for SSL/TLS secured connections.
Unsecure:
MQTT.fx - v0.0.6 - connected unsecure
Secured:
MQTT.fx - v0.0.6 - connected secure

Support for Certificate Files
mqtt-certificates

Support for Keystores
Edit Connection Profiles keytores

Hint:
Again the configuration-format has changed, v0.0.6 will conflict with former versions and MQTT.fx won’t start.
In this case just delete (or rename) the mqttfx-config.xml.
Windows: [USER_HOME]\AppData\Local\MQTT-FX\mqttfx-config.xml
OS X: [USER_HOME]/Library/Application Support/MQTT-FX/mqttfx-config.xml

The new configration is automatically created on next app start.

Download binaries HERE.

Jul 28

“PiMac unibody” or a new home for my touch screen

In preparation for the JavaOne 2014 Session my 7″ touch screen from Chalk-Elec finally found a new home.
I bought a 1 mm sheet of aluminium and treated it with my jig saw and a rasp and folded a triangle stand for the screen. Basically there would be room enough for e.g. a Rapsberry Pi and it also stand touching the display:

DSC_9673

DSC_9675

DSC_9672

DSC_9668

Some anti slip pads on the button side

IMG_3589

IMG_3587

The Sketch

PiMac Scetch

Jul 27

MQTT.fx 0.0.5 released

Just released a new version of MQTT.fx.

New:

  • “Publish”, “Subscribe” and “Broker Status” can now be detached to be opened in a separate window: Just drag a tab title and drop it where the window should be placed. Closing of the window restores the content at the former position.
  • also I have done some UI polish

Download binaries HERE.

MQTT.fx0.0.5

Jul 03

MQTT.fx 0.0.4 released

Just released new version of MQTT.fx.
Download binaries HERE.

MQTT.fx - v0.0.4

New:
- revisited UI (return of “real” buttons)
- extended support for $SYS-topics: subscription for mosquitto or Hive MQ can be choosen (in respect to @dobermai).
- publish and subcrive/receive are now different tabs
- experimental support for http-proxy (in respect to @dimaki123).
- last choosen broker & port is restored at next app start
- updated 3rd party libs (e.g. now using features of ControlsFX 8.0.6)
MQTT.fx - v0.0.4 - broker status
MQTT.fx - v0.0.4 - subscribe
MQTT.fx - v0.0.4 - connection options
MQTT.fx - v0.0.4 - validation

Fixed:
- publish to topics even if not subscribed before (in respect to @_efwe_)

Hint:
Configuration-format has changed, v0.0.4 might conflict with former versions.
In this case just delete (or rename) the mqttfx-config.xml.
Windows: [USER_HOME]\MQTT-FX\mqttfx-config.xml
OS X: [USER_HOME]/Library/Application Support/MQTT-FX/mqttfx-config.xml
The new configration is automatically created on next app start.

Jun 14

MQTT.fx 0.0.3 released

Most significant change: I have added a pane to show some status values of the broker:

mqtt-0.0.3

In v0.0.3 these $SYS topics are recognised (Tooltips are showing the descriptions):

Version: $SYS/broker/version
Build: $SYS/broker/timestamp
Uptime: $SYS/broker/uptime
Subscriptions Count: $SYS/broker/subscriptions/count
Changeset: $SYS/broker/changeset
Clients Connected: $SYS/broker/clients/active
Clients Expired: $SYS/broker/clients/expired
Clients Disconnected: $SYS/broker/clients/inactive
Clients Maximum: $SYS/broker/clients/maximum
Clients Total: $SYS/broker/clients/total
Connection: $SYS/broker/connection/#
Messages Inflight: $SYS/broker/messages/inflight
Messages Received: $SYS/broker/messages/received
Messages Sent: $SYS/broker/messages/sent
Messages Stored: $SYS/broker/messages/stored
Messages Publish Dropped: $SYS/broker/publish/messages/dropped
Messages Publish Received: $SYS/broker/publish/messages/received
Messages Publish Sent: $SYS/broker/publish/messages/sent
Messages Retained Count: $SYS/broker/retained/messages/count
Bytes Received: $SYS/broker/bytes/received
Bytes Sent: $SYS/broker/bytes/sent
Load Connections: $SYS/broker/load/connections/+
Load Bytes Received: $SYS/broker/load/bytes/received/+
Load Bytes Sent: $SYS/broker/load/bytes/sent/+
Load Messages Received: $SYS/broker/load/messages/received/+
Load Messages Sent: $SYS/broker/load/messages/sent/+
Load Publish Dropped: $SYS/broker/load/publish/dropped/+
Load Publish Received: $SYS/broker/load/publish/received/+
Load Publish Sent: $SYS/broker/load/publish/sent/+
Load Sockets Count: $SYS/broker/load/sockets/+

Download binaries:
Mac OSX DMG
Windows 32bit Installer
Zipped executable jar

May 14

MQTT.fx 0.0.2

A new version of MQTT.fx is available and I have polished the pre-alpha version and added some new features to MQTT.fx.

Download binaries:
Mac OSX DMG
Windows 32bit Installer
Zipped executable jar

The Video for Jim Weaver’s “Real World Apps” talk @GeeCon2014 in Kraków

Controls to connect to the broker and to subscribe to topics are now placed in the header:

mqtt-fx-1-0.0.2

“Connection Options” can be reached from here:

mqtt-fx-2-0.0.2

“Publish” and “Receive” are place in one tab:

mqtt-fx-3-0.0.2

I have added an option to enable notifications on received messages:

mqtt-fx-3-2-0.0.2

AND NEW: “Arrived Messages” are collected in a separate tab with one color by topic.
The related messaged are colored accordingly thus they can be easily identified:

mqtt-fx-4-0.0.2

Also I found out an easy way to apply a noise and gradient effect via CSS like this:

mqtt-fx-6-noise-0.0.2

May 09

JavaFX based MQTT Testing Utility

New Version: MQTT.fx 0.0.2

Now that MQTT is on its way to become THE industry-standard protocol for IoT and M2M communication the IoT community might have to review current message strategies.

Isn’t it a very good way to start with a JavaFX-Client to get into MQTT ;-)?
So, currently I am working on JavaFX based frontend based on Eclipse Paho.

Featured so far:

  • connect to an MQTT broker (tested with mosquitto yet)
  • modify some connection options
  • subscribe to topics
  • publish to topics
  • continuous logging of arrived messages
  • load and save settings (working directory: [user.home]/mqttfx)
  • an ugly application icon

Like to give it a try?
Download executable JAR (with dependencies) (requires an installed Java8-JRE)
Download Mac OSX DMG
Download Windows (x86) Installer

Main Screen
mqtt-fx-1

Logging Arrived-Messages
mqtt-fx-2

Editing Connection Options
mqtt-fx-3

Stored Configuration and UI-Settings
mqtt-fx-4

Apr 27

NetBeans 8 – Shortcut to Remote Platforms

The recently released NetBeans 8 holds a great gift for all Java Embedded Developers:

Build-in support for Remote Java Standard Edition platform.

To introduce this great and handy feature I created some screencasts:

Part1: headless

Part2: JavaFX on Pi

Part 3 – Remote Platform Debugging

José Pereda has also blogged about this feature in action: He and Mark Heckler used it in a distributed environment for their talk G-Force! Self-Powering Global Sensor Nets for IoT (JFokus 2014).

In addition to the support for a full JRE Environment its also worth to mention there is a nice editor as a fronted to the “recreate”-command provided by the all new EJDK 8:

ejdk

Update/Hint
To launch Raspberry PI Java applications from within Eclipse a project called LaunchPI has been started.

For Intellij/IDEA there is a plugin called “sourcesync” that might be helpful for even remote deployment.

But by now I can’t find other approaches that are such seamless and well integrated as NetBeans Remote Platform support.

Apr 24

Between 0 and 1 – PWM with Raspberry Pi

Switch on and off an LED and let run a motor at one speed and direction is easy, but what if I want to e.g. control the brightness of an LED or control motor-speed?

A kind of analog signal is needed:
This is done with Pulse-width modulation (PWM). PWM is a “modulation technique that conforms the width of the pulse, formally the pulse duration, based on modulator signal information.” (Wikipedia).

In a nutshell:
The average value of voltage is depending on the frequency the load is switched on and off.

Basically there are two ways to create PWM:

Hardware PWM

  • very fast (max. possible frequency / period)
  • software independent, independent from program flow
  • clean signal

BUT:

  • not all pins might support HW PWM

Software PWM

  • each I/O pin can be used for SW PWM

BUT:

  • software controlled timing has to be implemented
  • implementation and timing have to respect CPU usage
  • not a real clean signal

In other words: HW PWM is clearly prefered!

But unfortunately there is only one HW PWM pin (#18) available on the Rasperry Pis GPIO header (also its shared with the Audio system. That means that you can’t use PWM or Servo output and play audio through the 3.5mm jack at the same time).

If a RasPi project needs more than 1 PWM it has to use soft-pwm.
However thank god all the hard work is almost done by using Gordon Henderson’s wiringPi-lib and its Java-API Pi4J.

Pi4J provides a class called “SoftPwm”. As it uses wiringPi functions, the GPIO subsytem has to be initialzed first.
Therefore the programm has to executed as “sudo”!

Here is a simple example:

public class WiringPiSoftPWMExample {
    
    public static void main(String[] args) throws InterruptedException {
        
        // initialize wiringPi library
        Gpio.wiringPiSetup();

        // create soft-pwm pins (min=0 ; max=100)
        SoftPwm.softPwmCreate(0, 0, 100);

        IntegerProperty value1 = new SimpleIntegerProperty();
        value1.addListener((ObservableValue<? extends Number> observable, Number oldValue, Number newValue) -> {
            SoftPwm.softPwmWrite(0, newValue.intValue());
        });

        // continuous loop
        while (true) {
            // fade LED to fully ON
            for (int i = 0; i <= 100; i++) {
                value1.set(i);
                Thread.sleep(25);
            }

            // fade LED to fully OFF
            for (int i = 100; i >= 0; i--) {
                value1.set(i);
                Thread.sleep(25);
            }
        }
    }
}

LED blink

Works!
What’s next?

IMG_3176

3 x optical coupler + RGB LED stripe triggered by JavaFX UI contolled SoftPwms:

Oct 04

Solved: eGalax Touch Screen issues with JavaFX (on Raspberry Pi)

In a former post I wrote about my trouble getting touch support up an running with my eGalax Touch Display, JavaFX and the Raspberry Pi.
Today Simon gave me a hint how he solved that touch event issues with JavaFX.

Many Kudos to Simon Ritter (@speakjava)!

The Clue

It turns out that the screen driver actually creates two event devices in /dev/input: event0 and event1. JavaFX sees /dev/input/event0 and assumes that events come from that, but for some unknown reason no events are actually sent: they all go to /dev/input/event1.

The Cure

Recreate /dev/input/event0 with the same device as /dev/input/event1, so JavaFX gets the information it needs:

eGalax_patch1

Make it suitability for daily usage

Create an init-script to apply the patch at start-up:
Required-Start: $all‘ tells insserv to start the script after all the other scripts, at the end of the boot sequence:

#! /bin/sh
### BEGIN INIT INFO
# Provides:          egalax-patch
# Required-Start:    $all
# Required-Stop:     
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description:
# Description:       Recreates event0 with the same device as event1, so JavaFX gets the information it needs.
### END INIT INFO

. /lib/lsb/init-functions

rm -f /dev/input/event0
mknod /dev/input/event0 c 13 65

log_success_msg "eGalax Touch Screen patch for JavaFX applied."

You can load it here.

  • copy the script to /etc/init.d/
  • make sure it’s executable: sudo chmod 755 egalax_patch
  • then enable the script: sudo insserv egalax-patch

One last thing

The event devices are re-created by the driver when the USB connection was interrupted.
In this case you will have to reboot the Raspi or (much better) execute the script manually:

eGalax_patch2