MQTT - Segment Display 4x7 Bricklet

This is the description of the MQTT API bindings for the Segment Display 4x7 Bricklet. General information and technical specifications for the Segment Display 4x7 Bricklet are summarized in its hardware description.

An installation guide for the MQTT API bindings is part of their general description.


The example code below is Public Domain (CC0 1.0).


Download (example-simple.txt)

# Change XYZ to the UID of your Segment Display 4x7 Bricklet

    # 102 = 0x66 = the segments to show a 4
    # 91  = 0x5b = the segments to show a 2
    # 79  = 0x4f = the segments to show a 3
    publish {"segments": [102, 91, 91, 79], "brightness": 7, "colon": false} to tinkerforge/request/segment_display_4x7_bricklet/XYZ/set_segments # Will display 4223


All published payloads to and from the MQTT bindings are in JSON format.

If an error occures, the bindings publish a JSON object containing the error message as member _ERROR. It is published on the corresponding response topic: .../response/... for .../request/... and .../callback/... for .../register/....

Basic Functions

  • segments – Type: [int, ...], Length: 4, Range: [0 to 127]
  • brightness – Type: int, Range: [0 to 7]
  • colon – Type: bool
  • no response

The 7-segment display can be set with bitmaps. Every bit controls one segment:

Bit order of one segment

For example to set a "5" you would want to activate segments 0, 2, 3, 5 and 6. This is represented by the number 0b01101101 = 0x6d = 109.

The brightness can be set between 0 (dark) and 7 (bright). The colon parameter turns the colon of the display on or off.

  • empty payload
  • segments – Type: [int, ...], Length: 4, Range: [0 to 127]
  • brightness – Type: int, Range: [0 to 7]
  • colon – Type: bool

Returns the segment, brightness and color data as set by request/segment_display_4x7_bricklet/<UID>/set_segments.

Advanced Functions

  • value_from – Type: int, Range: [-999 to 9999]
  • value_to – Type: int, Range: [-999 to 9999]
  • increment – Type: int, Range: [-999 to 9999]
  • length – Type: int, Unit: 1 ms, Range: [0 to 232 - 1]
  • no response

Starts a counter with the from value that counts to the to value with the each step incremented by increment. length is the pause between each increment.

Example: If you set from to 0, to to 100, increment to 1 and length to 1000, a counter that goes from 0 to 100 with one second pause between each increment will be started.

Using a negative increment allows to count backwards.

You can stop the counter at every time by calling request/segment_display_4x7_bricklet/<UID>/set_segments.

  • empty payload
  • value – Type: int, Range: [-999 to 9999]

Returns the counter value that is currently shown on the display.

If there is no counter running a 0 will be returned.

  • empty payload
  • uid – Type: string, Length: up to 8
  • connected_uid – Type: string, Length: up to 8
  • position – Type: char, Range: ["a" to "h", "z"]
  • hardware_version – Type: [int, ...], Length: 3
    • 0: major – Type: int, Range: [0 to 255]
    • 1: minor – Type: int, Range: [0 to 255]
    • 2: revision – Type: int, Range: [0 to 255]
  • firmware_version – Type: [int, ...], Length: 3
    • 0: major – Type: int, Range: [0 to 255]
    • 1: minor – Type: int, Range: [0 to 255]
    • 2: revision – Type: int, Range: [0 to 255]
  • device_identifier – Type: int, Range: [0 to 216 - 1]
  • _display_name – Type: string

Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier.

The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port). A Bricklet connected to an Isolator Bricklet is always at position 'z'.

The device identifier numbers can be found here. If symbolic output is not disabled, the device identifier is mapped to the corresponding name in the format used in topics.

The display name contains the Segment Display 4x7's name in a human readable form.


Callbacks can be registered to receive time critical or recurring data from the device. The registration is done with the corresponding .../register/... topic and an optional suffix. This suffix can be used to deregister the callback later.


Using callbacks for recurring events is always preferred compared to using getters. It will use less USB bandwidth and the latency will be a lot better, since there is no round trip time.

Register Request:
  • register – Type: bool
Callback Response:
  • empty payload

A callback can be registered for this event by publishing to the .../register/segment_display_4x7_bricklet/<UID>/counter_finished[/<SUFFIX>] topic with the payload "true". An added callback can be removed by publishing to the same topic with the payload "false". To support multiple (de)registrations, e.g. for message filtering, an optional suffix can be used.

If the callback is triggered, a message with it's payload is published under the corresponding .../callback/segment_display_4x7_bricklet/<UID>/counter_finished[/<SUFFIX>] topic for each registered suffix.

This callback is triggered when the counter (see request/segment_display_4x7_bricklet/<UID>/start_counter) is finished.