Output - GP8403 Dual channel DAC 0-10V

GP8403 Dual channel DAC 0-10V

Plugin details

Type: Output

Name: GP8403 Dual channel DAC 0-10V

Status ESP32: COLLECTION G

Status ESP8266: COLLECTION G

GitHub: P166_GP8403.ino

Maintainer: tonhuisman

Used libraries: modified version of DFRobot_GP8403

Description

The GP8403 DAC (Digital Analog Converter) has 2 output channels, can be configured for an output voltage range of 0-10V or 0-5V, has a 12 bit resolution (4096 steps) and works from a single 3.3V or 5V power source. When powering the module with 5V, a level converter should be used on the I2C lines, to protect the ESP and other I2C devices on the same bus. The outputs can supply up to 20 mA.

../_images/P166_DFRobot_GP8403_board.png

(Image (c) DFRobot)

Configuration

../_images/P166_DeviceConfiguration.png
  • Name: Required by ESPEasy, must be unique among the list of available devices/tasks.

  • Enabled: The device can be disabled or enabled. When not enabled the device should not use any resources.

I2C options

  • I2C Address: The device supports 8 addresses, and by default comes configured for address 0x5F, as reflected in the available options:

../_images/P166_I2CAddressOptions.png

Available addresses are in the range 0x58 to 0x5F.

The available I2C settings here depend on the build used. At least the Force Slow I2C speed option is available, but selections for the I2C Multiplexer can also be shown. For details see the I2C Bus page

Device Settings

  • Output range: Select the desired output voltage range:

../_images/P166_OutputRangeOptions.png

Available options:

  • 0-5V: The maximum available voltage is 5V. When not using a voltage > 5V, this would be the apropriate settings, both for accuracy, and to avoid the risk of applying up to 10V to an input that might not be able to handle that.

  • 0-10V: (Preconfigured default) The maximum available voltage is 10V.

The DAC does not support a different output range setting per output.

The DAC can supply up to 20 mA per output, so the input or device that is connected to this output should be configured to not overload the output.

  • Restore output on warm boot: (Enabled by default) When the outputs are set to a specific value and the ESP unit is restarted, f.e. when updating the ESPEasy firmware, the output values will be restored. On cold boot, or after saving the settings, the configured Initial value per output will be set.

  • Initial value output 0:

  • Initial value output 1: The output value at startup, or after power-loss, can be configured here per output. The allowed range is 0-10V. Although the resolution is in milli Volt, the resolution of the DAC is limited to 12 bit (4096 steps). If a voltage is set here that exceeds the Output range (f.e. when set to 0-5V, and 7V is configured), the setting will not be applied!

Preset values

  • Preset value 1..25: This table allows to configure up to 25 named presets, where the name can be up to 16 characters long, and the voltage in range 0-10V. When all available inputs are filled, Submitting the page will add more inputs until the limit of 25 is reached.

When leaving the Name field empty, that preset will not be saved, thus effectively deleted from the list.

Data Acquisition

This group of settings are standard available configuration items.

  • Single event with all values: When this setting is enabled, all available values will be sent in a single event <TaskName>#All, with all values in order as arguments to the event.

  • Show derived values: When checked, the Devices overview page, and the /json endpoint (used for updating the Devices overview page) will include any Derived values as defined. See the TaskValueSetDerived and TaskValueSetPresentation commands.

  • Event & Log derived values: When checked, the Derived values will be generated as Events, to be handled in Rules, and sent to logging devices like the Syslog server and/or SD-card logging.

(The derived values options are only available if String variables feature is included in the build.)


  • Send to Controller: Select the Controller(s) to send the Values to, either on a TaskRun command applied to the task, or on an Interval time action.

Send to Controller is only visible when one or more Controllers are configured.

Depending on the controller capabilities, some configuration settings may be shown:

../_images/Task_config_page_Controllers_section.png

All configured Controllers are shown here, including the enabled or disabled state (multiple Controllers can be enabled, only a single MQTT Controller can be enabled at one time!).

For each controller the user can select wether the data should be sent on each Interval (or explicit TaskRun).

For the Domoticz controllers the value index (IDX) has to be configured.

For some controllers, like Home Assistant/openHAB, there are extra options available.

  • Group: This represents the group id to combine all values from multiple tasks into a single grouped-device during MQTT AutoDiscovery. Groups, by design, can span multiple ESPEasy devices, if desired, as long as the Task/Valuename combinations are unique. If a group should only combine Tasks from a single ESPEasy unit, the group id should be unique across multiple ESPEasy units. The group description, default Group <n>, can be adjusted in Home Assistant. If the Group value matches the current Unit nr, the Unit name, %sysname%, is used instead of Group <nr>.

  • Retained: For MQTT Controllers, this setting can be enabled to send the values for the current task with the Retain flag set. The Publish Retain flag in the Controller settings will override this by sending all task values with Retain flag enabled.

  • Send derived: This checkbox determines if any configured Derived values should also be sent to the controller (and included in the AutoDiscovery if that’s available and enabled).

  • Resend MQTT Discovery: When checked, will start a resend of the MQTT Discovery process for this task after a random delay, when Submit is clicked, so any changed settings will be updated in the MQTT broker. This setting is only available if the controller is enabled, the Auto Discovery feature is available and enabled for the controller. This setting is not stored.

Other controllers, like f.e. FHEM HTTP, do not support additional settings besides the checkbox to enable sending the data.


  • Interval By default, Interval will be set to 0 sec. The data will be collected and optionally sent to any configured controllers using this interval. When an output value is changed, the data will be sent to any configured controller, and an event will also be generated when the Rules are enabled (Tools/Advanced).

Values

The plugin provides the Output0 and Output1 values, analogue to the availabe output connections. A formula can be set to recalculate the displayed, and sent, value. The number of decimals can be set as desired, and defaults to 2.

In selected builds, per Value is a Stats checkbox available, that when checked, gathers the data and presents recent data in a graph, as described here: Task Value Statistics:

Commands available

Command Syntax

Extra information

<ch> = Output channel, 0, 1 or 2 (both channels)

When successfully changing an output value, the data will be sent to any configured Controller, and an event will also be generated when the Rules are enabled (Tools/Advanced).

gp8403,volt,<ch>,<value>

Set the output value for the channel(s) in volt. The range is determined by the configured Output range setting.

gp8403,mvolt,<ch>,<value>

Set the output value for the channel(s) in milli volt. The range is determined by the configured Output range setting.

gp8403,range,<5|10>

Set the output range to either 5 (0-5V) or 10 (0-10V). Is also set to the Device configuration, but not saved.

The range is applied to both channels, no separate configuration per channel supported by the chip.

gp8403,preset,<ch>,<name>

Set the output value for the channel(s) to the value configured for the preset stored with <name>.

The value is range-checked before it is applied, so when configured for Output range 0-5V, a preset of 7V will be ignored.

When using duplicate names, the first matched preset will be used.

gp8403,init,<ch>

Set the output value for the channel(s) to the configured initial value(s). When both channels are addressed (2), each will get its own configured value.

Get Config Values

Get Config Values retrieves values or settings from the plugin, and can be used in Rules, Display plugins, Formula’s etc. The square brackets are part of the variable. Replace <taskname> by the Name of the task.

Config value

Information

[<taskname>#preset<X>]

Returns the numbered preset value <X>, range preset1..``preset25``, as shown in the configuration. Only configured values, having a name, can be retrieved.

[<taskname>#initial0]

Returns the configured initial voltage for output 0.

[<taskname>#initial1]

Returns the configured initial voltage for output 1.

[<taskname>#range]

Returns the configured Output range value 5 (0-5V) or 10 (0-10V)

Change log

Changed in version 2.0:

added 2024-01-30 Initial release version.