Questions about MCP4131 output resistance calculation

Hya,

doing a research to build my own steering wheel wired remote control for my Pioneer headunit, i’ve found this very interesting post, where the MCP4131 is used.

Looking at the code, i didn’t find out how to define the MCP4131 output resistance like the following piece of code.

// send command to car stereo, below values are for Pioneer head units
     SPI.transfer(0);  
     switch(currButton) {
      case VOL_UP: SPI.transfer(21); break;  // 16kOhm
      case VOL_DN: SPI.transfer(31); break;  // 24k    
      case PREV_TR: SPI.transfer(14); break;  // 11k
      case NEXT_TR: SPI.transfer(10); break;  // 8k
      case MODE: SPI.transfer(2); break;  // 1.6k
      case MUTE: SPI.transfer(4); break;  // 3k
      default: SPI.transfer(0); break; // nothing
    }

Where can i find the formula or the explanation in how 21 = 16K, 31 = 24K, 4 = 3K by SPI.transfer(code)?

Thanks in advance.

The device data sheet and application notes can be downloaded here: MCP4131

thank you for pointing, and i didn’t understand. could you please educate me?

I THINK those numbers represent the value of N (the number of steps). I assume the person used the MCP4131-104 which is a 100kOhm device with 129 steps (from 0 to 128) to calculate those values.

Now, on page 38 of the datasheet there is an equation to calculate the resistance between the wiper (W) and terminal B, denoted as Rwb

Isolating the variable N yields:

Where Rw = 75 Ohm and Rab = 100kOhms

Selecting Rwb = {16kOhm, 24kOhm, 11kOhm, 8kOhm, 1.6kOhm, 3kOhm} then:

1 Like

my MCP4261 library - GitHub - RobTillaart/MCP4261: Arduino library for MCP4261 SPI based digital potentiometers and compatibles. - is related to the MCP4131, although I did not investigate and implement the whole list (see post belmont1591 above).

At the core of the library there is

bool MCP4261::setValue(uint8_t pm, uint16_t value)
{
  if (pm >= _pmCount) return false;
  if (value > _maxValue) return false;
  _value[pm] = value;

  uint8_t value1 = MCP4261_CMD_WRITE | (pm << 4);
  if (value > 0xFF) value1 |= (value >> 8);  //  high bits
  writeRegister2(value1, value & 0xFF);
  return true;
}

WriteRegister2() sends 2 bytes over SPI,

the first byte contains the potentiometer index (0) + the WRITE_CMD (0) code, which therefor is always zero (0) for the MCP4131.
That is your ``SPI.transfer(0); line

The second byte is the potentiometer position, typically 0..128

As you have a 100K digipot one step is 100K / 128 ~~ 781.25 ohm per step

e.g. 31 * 781.25 = 24.2 Kohm

Or if you want 75 Kohm => 75000.0 / 781.25 => 92 ==> SPI.transfer(92);

(math above did not include the fixed wiper math)

1 Like

thank you so much!!!