Add device support: MCP4728 (#1888)

* Initial MCP4728 docs

* Fixed doc reference labels and links

* Fixed link to mcp4728 component.

* Changed parameter name

* Update components/output/mcp4728.rst

Added default value

Co-authored-by: Otto Winter <otto@otto-winter.com>

* Update components/output/mcp4728.rst

Added default value

Co-authored-by: Otto Winter <otto@otto-winter.com>

* Update components/output/mcp4728.rst

Added default value

Co-authored-by: Otto Winter <otto@otto-winter.com>

* Update components/output/mcp4728.rst

Added default value

Co-authored-by: Otto Winter <otto@otto-winter.com>

* Reduced image size

* Extended parameter and output voltage explanation.

* Changed index position to keep alphabetical order.

Co-authored-by: Otto Winter <otto@otto-winter.com>
This commit is contained in:
Arturo Casal 2022-02-21 12:46:50 +01:00 committed by GitHub
parent ba616dc327
commit bae87951ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 101 additions and 0 deletions

View File

@ -0,0 +1,100 @@
MCP4728 Output
==============
.. seo::
:description: Instructions for setting up MCP4728 outputs on the ESP.
:image: mcp4728.jpg
.. _mcp4728-component:
The MCP4728 output component allows to use `12bit external quad DAC
<https://www.adafruit.com/product/4470>`__
in order to have analog outputs on any board by using :ref:`I²C <i2c>`. Devices default address is ``0x60``.
.. code-block:: yaml
# Example configuration entry
# Set a global I²C connection
i2c:
sda: 21
scl: 22
scan: true
# Set the component with default (address: 0x60 / global I²C)
mcp4728:
- platform: mcp4728
id: dac_output
Configuration variables:
------------------------
- **id** (**Required**, :ref:`config-id`): The id to use for this output component.
- **address** (*Optional*, int): Manually specify the I2C address of
the DAC. Defaults to ``0x60``.
- **store_in_eeprom** (*Optional*, boolean): Use SEQ_WRITE mode to also write to EEPROM sequentially. Defaults to ``false``.
Output
******
The MCP4728 output component exposes 4 MCP4728 channels of a global :ref:`MCP4728 <mcp4728-component>` as float outputs.
.. code-block:: yaml
# Individual outputs
output:
- platform: mcp4728
id: ac_dimmer_1
mcp4728_id: dac_output
channel: A
vref: vdd
power_down: normal # default
- platform: mcp4728
id: ac_dimmer_2
mcp4728_id: dac_output
channel: B
vref: vdd
power_down: gnd_1k
- platform: mcp4728
id: ac_dimmer_3
mcp4728_id: dac_output
channel: C
vref: internal
gain: X1
power_down: normal # default
- platform: mcp4728
id: ac_dimmer_4
mcp4728_id: dac_output
channel: D
vref: internal
gain: X2
on_...:
then:
- output.set_level:
id: ac_dimmer_1
level: 100%
Configuration variables:
------------------------
- **id** (**Required**, :ref:`config-id`): The id to use for this output component.
- **mcp4728_id** (*Optional*, :ref:`config-id`): Manually specify the ID of the
:ref:`MCP4728 <mcp4728-component>`.
Use this if you have multiple MCP4728 chains you want to use at the same time.
- **channel** (**Required**, string): Chose the channel of the MCP4728 chain of
this output component. One of ``A``, ``B``, ``C`` or ``D``.
- **vref** (**Optional**, string): Chose the VREF source. One of ``vdd`` or ``internal``. Defaults to ``vdd``.
- **gain** (**Optional**, string): Chose the GAIN multiplier for internal VREF. One of ``X1`` or ``X2``. Only useful when ``vdd=internal``. Defaults to ``X1``.
- **power_down** (**Optional**, string): Chose the power down mode. In power down mode (value different from ``normal``) the output pin will be connected to GND using a resistor (1kOhm, 100kOhm or 500kOhm). One of ``normal``, ``gnd_1k``, ``gnd_100k`` or ``gnd_500k``. Defaults to ``normal``.
- All other options from :ref:`Output <config-output>`.
Output voltage range will be different depending on the ``vref`` source and ``gain``.
When ``vref=vdd``, output voltage will range from 0.000V to VDD.
When ``vref=internal``, output voltage will range from 0.000V to 2.048V with ``gain=X1`` and from 0.000V to 4.096V with ``gain=X2``.
See Also
--------
- :doc:`/components/output/esp32_dac`
- :ghedit:`Edit`

BIN
images/mcp4728.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -431,6 +431,7 @@ Output Components
SM16716, components/output/sm16716, sm16716.svg
SM2135, components/output/sm2135, sm2135.svg
MCP4725, components/output/mcp4725, mcp4725.jpg
MCP4728, components/output/mcp4728, mcp4728.jpg
MCP47A1, components/output/mcp47a1, mcp47a1.svg
BLE Binary Output, components/output/ble_client, bluetooth.svg
Modbus Output, components/output/modbus_controller, modbus.png