openHAB - Industrial Digital Out 4 Bricklet 2.0

This is the description of the openHAB API bindings for the Industrial Digital Out 4 Bricklet 2.0. General information and technical specifications for the Industrial Digital Out 4 Bricklet 2.0 are summarized in its hardware description.

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

Thing

UID:
  • tinkerforge:brickletindustrialdigitalout4v2:[UID]
Required firmware version:
  • 2.0.0
Firmware update supported:
  • yes
Channels:
Actions:
Parameters:
  • Status LED Config – Type: Choice, Default: Show Status
  • The status LED configuration. By default the LED shows communication traffic between Brick and Bricklet, it flickers once for every 10 received data packets. You can also turn the LED permanently on/off or show a heartbeat. If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
  • Options: Off, On, Show Heartbeat, Show Status

Channels

Output Value (Pin 0)

The logic level that is currently set on the pin.

Type:
  • Switch
UID:
  • tinkerforge:brickletindustrialdigitalout4v2:[UID]:BrickletIndustrialDigitalOut4V2OutputPin0
Read only:
  • No
Parameters:
  • LED Configuration – Type: Choice, Default: Show Channel Status
  • Each channel has a corresponding LED. You can turn the LED off, on or show a heartbeat. You can also set the LED to \"Channel Status\". In this mode the LED is on if the channel is high and off otherwise.
  • Options: Off, On, Show Heartbeat, Show Channel Status
Output Value (Pin 1)

The logic level that is currently set on the pin.

Type:
  • Switch
UID:
  • tinkerforge:brickletindustrialdigitalout4v2:[UID]:BrickletIndustrialDigitalOut4V2OutputPin1
Read only:
  • No
Parameters:
  • LED Configuration – Type: Choice, Default: Show Channel Status
  • Each channel has a corresponding LED. You can turn the LED off, on or show a heartbeat. You can also set the LED to \"Channel Status\". In this mode the LED is on if the channel is high and off otherwise.
  • Options: Off, On, Show Heartbeat, Show Channel Status
Output Value (Pin 2)

The logic level that is currently set on the pin.

Type:
  • Switch
UID:
  • tinkerforge:brickletindustrialdigitalout4v2:[UID]:BrickletIndustrialDigitalOut4V2OutputPin2
Read only:
  • No
Parameters:
  • LED Configuration – Type: Choice, Default: Show Channel Status
  • Each channel has a corresponding LED. You can turn the LED off, on or show a heartbeat. You can also set the LED to \"Channel Status\". In this mode the LED is on if the channel is high and off otherwise.
  • Options: Off, On, Show Heartbeat, Show Channel Status
Output Value (Pin 3)

The logic level that is currently set on the pin.

Type:
  • Switch
UID:
  • tinkerforge:brickletindustrialdigitalout4v2:[UID]:BrickletIndustrialDigitalOut4V2OutputPin3
Read only:
  • No
Parameters:
  • LED Configuration – Type: Choice, Default: Show Channel Status
  • Each channel has a corresponding LED. You can turn the LED off, on or show a heartbeat. You can also set the LED to \"Channel Status\". In this mode the LED is on if the channel is high and off otherwise.
  • Options: Off, On, Show Heartbeat, Show Channel Status
Monoflop Pin 0

Triggers a monoflop as configured

Type:
  • Commands (String)
UID:
  • tinkerforge:brickletindustrialdigitalout4v2:[UID]:BrickletIndustrialDigitalOut4V2MonoflopPin0
Read only:
  • No
Commands:
  • Accepts any string
Parameters:
  • Monoflop Duration – Type: integer, Default: 1000, Unit: ms, Min: 0, Max: 4294967295
  • The time (in ms) that the pin should hold the configured value.

  • Monoflop Value – Type: boolean, Default: true
  • The desired value of the specified channel. Activated means relay closed and Deactivated means relay open.
Monoflop Pin 1

Triggers a monoflop as configured

Type:
  • Commands (String)
UID:
  • tinkerforge:brickletindustrialdigitalout4v2:[UID]:BrickletIndustrialDigitalOut4V2MonoflopPin1
Read only:
  • No
Commands:
  • Accepts any string
Parameters:
  • Monoflop Duration – Type: integer, Default: 1000, Unit: ms, Min: 0, Max: 4294967295
  • The time (in ms) that the pin should hold the configured value.

  • Monoflop Value – Type: boolean, Default: true
  • The desired value of the specified channel. Activated means relay closed and Deactivated means relay open.
Monoflop Pin 2

Triggers a monoflop as configured

Type:
  • Commands (String)
UID:
  • tinkerforge:brickletindustrialdigitalout4v2:[UID]:BrickletIndustrialDigitalOut4V2MonoflopPin2
Read only:
  • No
Commands:
  • Accepts any string
Parameters:
  • Monoflop Duration – Type: integer, Default: 1000, Unit: ms, Min: 0, Max: 4294967295
  • The time (in ms) that the pin should hold the configured value.

  • Monoflop Value – Type: boolean, Default: true
  • The desired value of the specified channel. Activated means relay closed and Deactivated means relay open.
Monoflop Pin 3

Triggers a monoflop as configured

Type:
  • Commands (String)
UID:
  • tinkerforge:brickletindustrialdigitalout4v2:[UID]:BrickletIndustrialDigitalOut4V2MonoflopPin3
Read only:
  • No
Commands:
  • Accepts any string
Parameters:
  • Monoflop Duration – Type: integer, Default: 1000, Unit: ms, Min: 0, Max: 4294967295
  • The time (in ms) that the pin should hold the configured value.

  • Monoflop Value – Type: boolean, Default: true
  • The desired value of the specified channel. Activated means relay closed and Deactivated means relay open.

Actions

Actions can be used in rules by creating an action object. All actions return a Map<String, Object>. Returned values can be accessed by name, sometimes the type deduction needs some hints, as shown below:

val actions = getActions("tinkerforge", "tinkerforge:brickletindustrialdigitalout4v2:[UID]")
val hwVersion = actions.brickletIndustrialDigitalOut4V2GetIdentity().get("hardwareVersion") as short[]
logInfo("Example", "Hardware version: " + hwVersion.get(0) + "." + hwVersion.get(1) + "." + hwVersion.get(2))

Basic Actions

brickletIndustrialDigitalOut4V2SetValue(boolean[] value)
Parameters:
  • value – Type: boolean[], Length: 4

Sets the output value of all four channels. A value of true or false outputs logic 1 or logic 0 respectively on the corresponding channel.

Use Output Value (Pin 0) to change only one output channel state.

All running monoflop timers and PWMs will be aborted if this function is called.

For example: (True, True, False, False) will turn the channels 0-1 high and the channels 2-3 low.

brickletIndustrialDigitalOut4V2SetSelectedValue(int channel, boolean value)
Parameters:
  • channel – Type: int, Range: [0 to 3]
  • value – Type: boolean

Sets the output value of a specific channel without affecting the other channels.

A running monoflop timer or PWM for the specified channel will be aborted if this function is called.

brickletIndustrialDigitalOut4V2GetValue()
Return Map:
  • value – Type: boolean[], Length: 4

Returns the logic levels that are currently output on the channels.

brickletIndustrialDigitalOut4V2GetChannelLEDConfig(int channel)
Parameters:
  • channel – Type: int, Range: [0 to 3]
Return Map:
  • config – Type: int, Range: See constants, Default: 3

Returns the channel LED configuration as set by the configuration of Output Value (Pin 0)

The following constants are available for this function:

For config:

  • val CHANNEL_LED_CONFIG_OFF = 0
  • val CHANNEL_LED_CONFIG_ON = 1
  • val CHANNEL_LED_CONFIG_SHOW_HEARTBEAT = 2
  • val CHANNEL_LED_CONFIG_SHOW_CHANNEL_STATUS = 3

Advanced Actions

brickletIndustrialDigitalOut4V2SetMonoflop(int channel, boolean value, long time)
Parameters:
  • channel – Type: int, Range: [0 to 3]
  • value – Type: boolean
  • time – Type: long, Unit: 1 ms, Range: [0 to 232 - 1]

The first parameter is the desired state of the channel (true means output high and false means output low). The second parameter indicates the time that the channel should hold the state.

If this function is called with the parameters (true, 1500): The channel will turn on and in 1.5s it will turn off again.

A PWM for the selected channel will be aborted if this function is called.

A monoflop can be used as a failsafe mechanism. For example: Lets assume you have a RS485 bus and a IO-4 Bricklet is connected to one of the slave stacks. You can now call this function every second, with a time parameter of two seconds. The channel will be high all the time. If now the RS485 connection is lost, the channel will turn low in at most two seconds.

brickletIndustrialDigitalOut4V2SetPWMConfiguration(int channel, long frequency, int dutyCycle)
Parameters:
  • channel – Type: int, Range: [0 to 3]
  • frequency – Type: long, Unit: 1/10 Hz, Range: [0 to 232 - 1], Default: 0
  • dutyCycle – Type: int, Unit: 1/100 %, Range: [0 to 10000], Default: 0

Activates a PWM for the given channel.

To turn the PWM off again, you can set the frequency to 0 or any other function that changes a value of the channel (e.g. Output Value (Pin 0)).

The optocoupler of the Industrial Digital Out 4 Bricklet 2.0 has a rise time and fall time of 11.5us (each) at 24V. So the maximum useful frequency value is about 400000 (40kHz).

A running monoflop timer for the given channel will be aborted if this function is called.

brickletIndustrialDigitalOut4V2GetMonoflop(int channel)
Parameters:
  • channel – Type: int, Range: [0 to 3]
Return Map:
  • value – Type: boolean
  • time – Type: long, Unit: 1 ms, Range: [0 to 232 - 1]
  • timeRemaining – Type: long, Unit: 1 ms, Range: [0 to 232 - 1]

Returns (for the given channel) the current value and the time as set by Monoflop Pin 0 as well as the remaining time until the value flips.

If the timer is not running currently, the remaining time will be returned as 0.

brickletIndustrialDigitalOut4V2GetPWMConfiguration(int channel)
Parameters:
  • channel – Type: int, Range: [0 to 3]
Return Map:
  • frequency – Type: long, Unit: 1/10 Hz, Range: [0 to 232 - 1], Default: 0
  • dutyCycle – Type: int, Unit: 1/100 %, Range: [0 to 10000], Default: 0

Returns the PWM configuration as set by SetPWMConfiguration().

brickletIndustrialDigitalOut4V2GetChipTemperature()
Return Map:
  • temperature – Type: int, Unit: 1 °C, Range: [-215 to 215 - 1]

Returns the temperature as measured inside the microcontroller. The value returned is not the ambient temperature!

The temperature is only proportional to the real temperature and it has bad accuracy. Practically it is only useful as an indicator for temperature changes.

brickletIndustrialDigitalOut4V2GetStatusLEDConfig()
Return Map:
  • config – Type: int, Range: See constants, Default: 3

Returns the configuration as set by the thing configuration

The following constants are available for this function:

For config:

  • val STATUS_LED_CONFIG_OFF = 0
  • val STATUS_LED_CONFIG_ON = 1
  • val STATUS_LED_CONFIG_SHOW_HEARTBEAT = 2
  • val STATUS_LED_CONFIG_SHOW_STATUS = 3
brickletIndustrialDigitalOut4V2GetSPITFPErrorCount()
Return Map:
  • errorCountAckChecksum – Type: long, Range: [0 to 232 - 1]
  • errorCountMessageChecksum – Type: long, Range: [0 to 232 - 1]
  • errorCountFrame – Type: long, Range: [0 to 232 - 1]
  • errorCountOverflow – Type: long, Range: [0 to 232 - 1]

Returns the error count for the communication between Brick and Bricklet.

The errors are divided into

  • ACK checksum errors,
  • message checksum errors,
  • framing errors and
  • overflow errors.

The errors counts are for errors that occur on the Bricklet side. All Bricks have a similar function that returns the errors on the Brick side.

brickletIndustrialDigitalOut4V2GetIdentity()
Return Map:
  • uid – Type: String, Length: up to 8
  • connectedUid – Type: String, Length: up to 8
  • position – Type: char, Range: ['a' to 'h', 'i', 'z']
  • hardwareVersion – Type: short[], Length: 3
    • 0: major – Type: short, Range: [0 to 255]
    • 1: minor – Type: short, Range: [0 to 255]
    • 2: revision – Type: short, Range: [0 to 255]
  • firmwareVersion – Type: short[], Length: 3
    • 0: major – Type: short, Range: [0 to 255]
    • 1: minor – Type: short, Range: [0 to 255]
    • 2: revision – Type: short, Range: [0 to 255]
  • deviceIdentifier – Type: int, Range: [0 to 216 - 1]

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). The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet connected to an Isolator Bricklet is always as position 'z'.

The device identifier numbers can be found here

Internal Actions

brickletIndustrialDigitalOut4V2ReadUID()
Return Map:
  • uid – Type: long, Range: [0 to 232 - 1]

Returns the current UID as an integer. Encode as Base58 to get the usual string version.