• 9849-xxx-xxx
  • noreply@example.com
  • Tyagal, Patan, Lalitpur


Microchip’s MCP6S21/2/6/8 are programmable gain amplifiers that multiply an input voltage by a factor of 1, 2, 4, 5, 8, 10, 16, and 32. The MCP6S22/6/8 also have selectable input channels for working with different signal sources. The multiplication factor and input channel are configured through an SPI interface. This chip is useful for multiplying a small input signal, and selecting among several analog input sources. We demonstrate the six channel MCP6S26 below.

MCP6S26 programmable gain amplifier (Mouser search, Octopart search, $2.56) Datasheet (PDF).

We tested the chip in the circuit shown above with a 3.3volt power supply. A resistor voltage divider (R1-4) outputs a fraction of the supply on channels 0, 2, and 4. We used 5K resistors, but the value isn’t critical. The divider outputs 2.4volts on channel 0, 1.6volts on channel 2, and 0.8volts on channel 4.

Bus Pirate
DS1801 (pin #)

VOUT (1)

VREF (8)

VSS (9)

CS (10)

SI (11)

SO (12)

SCK (13)

VDD (13)

We used our Bus Pirate universal serial interface to demonstrate this chip, but the transaction sequence will be the same for any microcontroller implementation. We connected the Bus Pirate to the MCP6S26 as shown in the table above. We setup the Bus Pirate for raw3wire mode (M, 8) with normal outputs, and enabled the on-board power supply (capital ‘W’).

RAW3WIRE>[0b01000001 0] d
CS enabled <–begin SPI transaction WRITE: 0x41 <–change input channel command WRITE: 0x00 <–change to channel 0 CS DISABLED <–end SPI transaction VOLTAGE PROBE: 2.4VOLTS <–Vout voltage measurement RAW3WIRE>

Writing 0b01000001 (0x41) followed by a channel number changes the active MCP6S26 input. ‘[‘ lowers the chip select line to start an SPI transaction. We send the change channel command (0x41) followed by 0 to select input 0.  ‘]’ raises the chip select line to end the SPI transaction. ‘d’ takes a voltage measurement and shows that input 0 with 0 gain is 2.4volts.

We can’t amplify the input voltage beyond the power supply (2.4volts * 2 = 4.8, 4.8volts > 3.3volts), so we need to change to a lower channel to play with the gain features.

RAW3WIRE>[0b01000001 4] d
WRITE: 0x41 <–change input channel command WRITE: 0x04 <–change to channel 4 CS DISABLED VOLTAGE PROBE: 0.8VOLTS <–Vout voltage measurement RAW3WIRE>

A measurement on channel 4 shows an output of just 0.8volts, plenty of room to test the gain features of the chip.

RAW3WIRE>[0b01000000 0b00000001] d
WRITE: 0x40 <–change gain command WRITE: 0x01 <–gain setting (x2) CS DISABLED VOLTAGE PROBE: 1.6VOLTS <–Vout is now 0.8volts * 2 RAW3WIRE>

A two-byte sequence sets the amount of gain. The command 0b01000000 (0x40) addresses the gain register, the second byte sets the multiplication factor (0x01= gain of 2). setting the gain to 2 multiplies the output voltage by 2, 0.8volts * 2 = 1.6volts.

RAW3WIRE>[0b01000000 0b00000010] d
WRITE: 0x40 <–change gain command WRITE: 0x02 <–gain setting (x4) CS DISABLED VOLTAGE PROBE: 3.2VOLTS <–Vout is now 0.8volts * 4 RAW3WIRE>

This time we set a gain of 4, 0.8volts * 4 = 3.2volts.

RAW3WIRE>[0b01000000 0b00000011] d
WRITE: 0x40 <–change gain command WRITE: 0x03 <–gain setting (x5) CS DISABLED VOLTAGE PROBE: 3.3VOLTS <–not enough headroom to reach 0.8volts * 5 RAW3WIRE>

The maximum output voltage is the chip’s power supply voltage. If we set the gain to 5, the output voltage can’t exceed the power supply of 3.3volts  (0.8volts * 5 = 4volts, 4volts > 3.3volts).

RAW3WIRE>[0b00100000 0] d
WRITE: 0x20 <–sleep command WRITE: 0x00 <–don’t care byte CS DISABLED VOLTAGE PROBE: 0.0VOLTS <–output is disabled RAW3WIRE>

The MCP6S26 has a power-saving sleep mode. Shutdown the chip with the command 0x20, followed by any byte value. Leave sleep by sending any valid command.

Like this post? check out the parts posts you may have missed. want to request a part post? Please leave your suggestions in the comments.

Leave a Reply

Your email address will not be published. Required fields are marked *