MCP4461 Component¶
The MCP4461 output component enables the use of an 8‑bit external quad digital potentiometer/rheostat via I²C. See the MCP4461 Datasheet for more information.
# Example configuration entry
mcp4461:
- id: mcp4461_output
Configuration variables:¶
id (Optional, ID): The id to use for this output component.
address (Optional, int): Manually specify the I2C address of the digipot. Defaults to
0x2C
.disable_wiper_0 (Optional, bool): Disable wiper 0. Defaults to
false
.disable_wiper_1 (Optional, bool): Disable wiper 1. Defaults to
false
.disable_wiper_2 (Optional, bool): Disable wiper 2. Defaults to
false
.disable_wiper_3 (Optional, bool): Disable wiper 3. Defaults to
false
.
MCP4461 Output¶
The MCP4461 output component exposes 8 MCP4461 (wiper-)channels of a global MCP4461 as float outputs.
# Individual outputs
# A-D are volatile wipers 0-3
# E-H are nonvolatile wipers 0-3
# (AE, BF, CG, DH belonging together)
output:
- platform: mcp4461
id: digipot_channel_0
mcp4461_id: mcp4461_output
channel: A
initial_value: 0.5 # always initialize volatile wiper 0 with wiper @ medium resistance range on start
- platform: mcp4461
id: digipot_channel_1
mcp4461_id: mcp4461_output
channel: B
- platform: mcp4461
id: digipot_channel_2
mcp4461_id: mcp4461_output
channel: C
- platform: mcp4461
id: digipot_channel_3
mcp4461_id: mcp4461_output
channel: D
- platform: mcp4461
id: digipot_channel_4
mcp4461_id: mcp4461_output
channel: E
- platform: mcp4461
id: digipot_channel_5
mcp4461_id: mcp4461_output
channel: F
- platform: mcp4461
id: digipot_channel_6
mcp4461_id: mcp4461_output
channel: G
- platform: mcp4461
id: digipot_channel_7
mcp4461_id: mcp4461_output
channel: H
Configuration variables:¶
id (Required, ID): The id to use for this output component.
mcp4461_id (Optional, ID): Manually specify the ID of the MCP4461. Use this if you have multiple MCP4461 ICs you want to use at the same time.
channel (Required, string): Choose the channel of this MCP4461 output component. One of
A
,B
,C
,D
,E
,F
,G
orH
.initial_value (Optional, float): Set initial wiper value, valid range is
0 - 1.0
terminal_a (Optional, bool): Set to
false
if terminal “A” shall be disabled on boot. Defaults totrue
terminal_b (Optional, bool): Set to
false
if terminal “B” shall be disabled on boot. Defaults totrue
terminal_w (Optional, bool): Set to
false
if terminal “W” shall be disabled on boot. Defaults totrue
All other configuration variables from Output.
The tap count for 7 and 8-bit digipot/rheostat devices is usually 100/257.
For the MCP4461, valid output states in range from 0 - 1.0 will be multiplied internally by 256 to get the integer tap count in range [0-256].
Note
If you do not specify the initial_value
configuration variable, you can use read_state()
and
update_state()
to fetch the current state at boot. The potentiometer (not rheostat) can be handled in the same
way. See the example below.
esphome:
on_boot:
priority: 100
then:
- number.set:
id: digipot_volatile_0
value: !lambda |-
uint16_t wiper_level = id(digipot_wiper_0).read_state();
return wiper_level;
- lambda: |-
id(digipot_wiper_0).update_state();