The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Tinkerforge::BrickletVoltageCurrent - Device for high precision sensing of voltage and current

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.

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 callback :func:`Current` and set the period with :func:`SetCurrentCallbackPeriod`.

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 callback :func:`Voltage` and set the period with :func:`SetVoltageCallbackPeriod`.

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 callback :func:`Power` and set the period with :func:`SetPowerCallbackPeriod`.

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:`SetConfiguration`.

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:`SetCalibration`.

set_current_callback_period()

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

:func:`Current` 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:`SetCurrentCallbackPeriod`.

set_voltage_callback_period()

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

:func:`Voltage` 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:`SetVoltageCallbackPeriod`.

set_power_callback_period()

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

:func:`Power` 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:`GetPowerCallbackPeriod`.

set_current_callback_threshold()

Sets the thresholds for the :func:`CurrentReached` 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:`SetCurrentCallbackThreshold`.

set_voltage_callback_threshold()

Sets the thresholds for the :func:`VoltageReached` 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:`SetVoltageCallbackThreshold`.

set_power_callback_threshold()

Sets the thresholds for the :func:`PowerReached` 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:`SetPowerCallbackThreshold`.

set_debounce_period()

Sets the period in ms with which the threshold callbacks

* :func:`CurrentReached`, * :func:`VoltageReached`, * :func:`PowerReached`

are triggered, if the thresholds

* :func:`SetCurrentCallbackThreshold`, * :func:`SetVoltageCallbackThreshold`, * :func:`SetPowerCallbackThreshold`

keep being reached.

The default value is 100.

get_debounce_period()

Returns the debounce period as set by :func:`SetDebouncePeriod`.

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|