Ishraq Ibne Ashraf
and 1 contributors

NAME

Tinkerforge::BrickletVoltageCurrent - Measures power, DC voltage and DC current up to 720W/36V/20A

CONSTANTS

DEVICE_IDENTIFIER

This constant is used to identify a Voltage/Current Bricklet.

The get_identity() subroutine and the CALLBACK_ENUMERATE callback of the IP Connection have a device_identifier parameter to specify the Brick's or Bricklet's type.

DEVICE_DISPLAY_NAME

This constant represents the display name of a Voltage/Current Bricklet.

CALLBACK_CURRENT

This constant is used with the register_callback() subroutine to specify the CALLBACK_CURRENT callback.

CALLBACK_VOLTAGE

This constant is used with the register_callback() subroutine to specify the CALLBACK_VOLTAGE callback.

CALLBACK_POWER

This constant is used with the register_callback() subroutine to specify the CALLBACK_POWER callback.

CALLBACK_CURRENT_REACHED

This constant is used with the register_callback() subroutine to specify the CALLBACK_CURRENT_REACHED callback.

CALLBACK_VOLTAGE_REACHED

This constant is used with the register_callback() subroutine to specify the CALLBACK_VOLTAGE_REACHED callback.

CALLBACK_POWER_REACHED

This constant is used with the register_callback() subroutine to specify the CALLBACK_POWER_REACHED callback.

FUNCTION_GET_CURRENT

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_VOLTAGE

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_POWER

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_CONFIGURATION

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_CONFIGURATION

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_CALIBRATION

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_CALIBRATION

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_CURRENT_CALLBACK_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_CURRENT_CALLBACK_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_VOLTAGE_CALLBACK_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_VOLTAGE_CALLBACK_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_POWER_CALLBACK_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_POWER_CALLBACK_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_CURRENT_CALLBACK_THRESHOLD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_CURRENT_CALLBACK_THRESHOLD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_VOLTAGE_CALLBACK_THRESHOLD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_VOLTAGE_CALLBACK_THRESHOLD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_POWER_CALLBACK_THRESHOLD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_POWER_CALLBACK_THRESHOLD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_DEBOUNCE_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_DEBOUNCE_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_IDENTITY

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTIONS

new()

Creates an object with the unique device ID *uid* and adds it to the IP Connection *ipcon*.

get_current()

Returns the current. The value is in mA and between -20000mA and 20000mA.

If you want to get the current periodically, it is recommended to use the :cb:`Current` callback and set the period with :func:`Set Current Callback Period`.

get_voltage()

Returns the voltage. The value is in mV and between 0mV and 36000mV.

If you want to get the voltage periodically, it is recommended to use the :cb:`Voltage` callback and set the period with :func:`Set Voltage Callback Period`.

get_power()

Returns the power. The value is in mW and between 0mV and 720000mW.

If you want to get the power periodically, it is recommended to use the :cb:`Power` callback and set the period with :func:`Set Power Callback Period`.

set_configuration()

Sets the configuration of the Voltage/Current Bricklet. It is possible to configure number of averages as well as voltage and current conversion time.

Averaging:

.. csv-table:: :header: "Value", "Number of Averages" :widths: 20, 20

 "0",    "1"
 "1",    "4"
 "2",    "16"
 "3",    "64"
 "4",    "128"
 "5",    "256"
 "6",    "512"
 ">=7",  "1024"

Voltage/Current conversion:

.. csv-table:: :header: "Value", "Conversion time" :widths: 20, 20

 "0",    "140µs"
 "1",    "204µs"
 "2",    "332µs"
 "3",    "588µs"
 "4",    "1.1ms"
 "5",    "2.116ms"
 "6",    "4.156ms"
 ">=7",  "8.244ms"

The default values are 3, 4 and 4 (64, 1.1ms, 1.1ms) for averaging, voltage conversion and current conversion.

get_configuration()

Returns the configuration as set by :func:`Set Configuration`.

set_calibration()

Since the shunt resistor that is used to measure the current is not perfectly precise, it needs to be calibrated by a multiplier and divisor if a very precise reading is needed.

For example, if you are expecting a measurement of 1000mA and you are measuring 1023mA, you can calibrate the Voltage/Current Bricklet by setting the multiplier to 1000 and the divisor to 1023.

get_calibration()

Returns the calibration as set by :func:`Set Calibration`.

set_current_callback_period()

Sets the period in ms with which the :cb:`Current` callback is triggered periodically. A value of 0 turns the callback off.

The :cb:`Current` callback is only triggered if the current has changed since the last triggering.

The default value is 0.

get_current_callback_period()

Returns the period as set by :func:`Set Current Callback Period`.

set_voltage_callback_period()

Sets the period in ms with which the :cb:`Voltage` callback is triggered periodically. A value of 0 turns the callback off.

The :cb:`Voltage` callback is only triggered if the voltage has changed since the last triggering.

The default value is 0.

get_voltage_callback_period()

Returns the period as set by :func:`Set Voltage Callback Period`.

set_power_callback_period()

Sets the period in ms with which the :cb:`Power` callback is triggered periodically. A value of 0 turns the callback off.

The :cb:`Power` callback is only triggered if the power has changed since the last triggering.

The default value is 0.

get_power_callback_period()

Returns the period as set by :func:`Get Power Callback Period`.

set_current_callback_threshold()

Sets the thresholds for the :cb:`Current Reached` callback.

The following options are possible:

.. csv-table:: :header: "Option", "Description" :widths: 10, 100

 "'x'",    "Callback is turned off"
 "'o'",    "Callback is triggered when the current is *outside* the min and max values"
 "'i'",    "Callback is triggered when the current is *inside* the min and max values"
 "'<'",    "Callback is triggered when the current is smaller than the min value (max is ignored)"
 "'>'",    "Callback is triggered when the current is greater than the min value (max is ignored)"

The default value is ('x', 0, 0).

get_current_callback_threshold()

Returns the threshold as set by :func:`Set Current Callback Threshold`.

set_voltage_callback_threshold()

Sets the thresholds for the :cb:`Voltage Reached` callback.

The following options are possible:

.. csv-table:: :header: "Option", "Description" :widths: 10, 100

 "'x'",    "Callback is turned off"
 "'o'",    "Callback is triggered when the voltage is *outside* the min and max values"
 "'i'",    "Callback is triggered when the voltage is *inside* the min and max values"
 "'<'",    "Callback is triggered when the voltage is smaller than the min value (max is ignored)"
 "'>'",    "Callback is triggered when the voltage is greater than the min value (max is ignored)"

The default value is ('x', 0, 0).

get_voltage_callback_threshold()

Returns the threshold as set by :func:`Set Voltage Callback Threshold`.

set_power_callback_threshold()

Sets the thresholds for the :cb:`Power Reached` callback.

The following options are possible:

.. csv-table:: :header: "Option", "Description" :widths: 10, 100

 "'x'",    "Callback is turned off"
 "'o'",    "Callback is triggered when the power is *outside* the min and max values"
 "'i'",    "Callback is triggered when the power is *inside* the min and max values"
 "'<'",    "Callback is triggered when the power is smaller than the min value (max is ignored)"
 "'>'",    "Callback is triggered when the power is greater than the min value (max is ignored)"

The default value is ('x', 0, 0).

get_power_callback_threshold()

Returns the threshold as set by :func:`Set Power Callback Threshold`.

set_debounce_period()

Sets the period in ms with which the threshold callbacks

* :cb:`Current Reached`, * :cb:`Voltage Reached`, * :cb:`Power Reached`

are triggered, if the thresholds

* :func:`Set Current Callback Threshold`, * :func:`Set Voltage Callback Threshold`, * :func:`Set Power Callback Threshold`

keep being reached.

The default value is 100.

get_debounce_period()

Returns the debounce period as set by :func:`Set Debounce Period`.

get_identity()

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' or 'd'.

The device identifier numbers can be found :ref:`here <device_identifier>`. |device_identifier_constant|