Eight analog voltages as simple (fewest parts) as possible?

I'm looking at the datasheet for an I2C expander IC MCP23009 http://ww1.microchip.com/downloads/en/DeviceDoc/22121b.pdf and it uses a single pin with a voltage divider (two resistors ~5% tolerance) to determine the I2C address.

For 3 address a three post jumper with a resistor divider would work. Shorting out a resistor would give 0 or VCC and no jumpers would be the voltage from the divider.

Any ideas on how to get all 8 addresses? A simple trimpot seems a little inaccurate IMHO.

Nine equal resistors would work. Each tap would be a different voltage. Note that 0V and Vcc are not among the 8 voltages you can choose from. That's why you use 9 resistors.

It is possible that an R/2R ladder D/A driven by three jumpers would also produce the right outputs. I think that would be 6 or 7 resistors.

You could substitute the MC2309 with a small AVR and program the I2C address to any value you like without requiring additional in-circuit parts whatsoever.

http://dipmicro.com/store/ATTINY44A-PU

I understand this is not quite what you asked and that it involves programing, but it may be useful to keep in mind that microcontrollers are general purpose IC’s.

The way I read the datasheet
"The ADDR pin is used to set the slave address of the MCP23009 (I2C only) to allow up to eight devices on
the bus using only a single pin. Typically, this would require three pins."
you are only setting the I2C address the part responds to, and not changing on the fly to select which GPIO is being accessed - that is via registers.
So setting the voltage once via trimpot and multimeter would be sufficient.

Why not go even simpler, faster, and use the SPI interface instead?

Thanks all.

I wish Microchip would have used a couple of extra pins on the device and allowed address setting the old fashioned way.

  1. seems VCC & GND are valid voltages so 7 equal resistors say 1K @ 3.3V should be possible.
  2. trimpot just seems so sloppy, else it would be a obvious choice and cheap too.
  3. SPI is great & fast but I2C makes it easy to add more slave devices e.g. relay / opto boards, RTCC & EEPROM without adding a CS or CE line for each peripheral. I am open to suggestions though...

How many of this particular chip are you planning to use?

BlueBill:
Thanks all.

I wish Microchip would have used a couple of extra pins on the device and allowed address setting the old fashioned way.

I'm guessing they expect most people to just tie it either high or low to select an address.

BlueBill:

  1. seems VCC & GND are valid voltages so 7 equal resistors say 1K @ 3.3V should be possible.

That doesn't work because you have to produce a voltage at the center of the required range.

Why do you need chain of resistors? I'd put two resistors per chip with suitable values to produce the address.

BlueBill:
2. trimpot just seems so sloppy, else it would be a obvious choice and cheap too.

It would probably work just fine. Each chip 'address' has 1/8th of a turn of tolerance, that's not too bad.

A trimmer also lets you change the chip address easily if you attach another device which clashes. No soldering required.

johnwasser:
Nine equal resistors would work. Each tap would be a different voltage. Note that 0V and Vcc are not among the 8 voltages you can choose from. That's why you use 9 resistors.

No, 7 resistors and 0V and Vcc are among the valid 8 voltages. Fig 1-3 in datasheet. Unless you want to run more than one IO expander just wire ADDR pin to ground.

MarkT:
No, 7 resistors and 0V and Vcc are among the valid 8 voltages. Fig 1-3 in datasheet.

Yes they are, but the allowed range for the first/last rows in the table is bigger.

Think though: With 7 resistors the first voltage in your chain would be 1/7 VDD.

At VDD=5.5 that's 0.7857V - nowhere near any of the target voltages in figure 1.3 (column V2).

This is easy. The intent is to ensure that the flash ADC decodes the correct address for each input voltage. Intuitively, that happens most securely when each input voltage is smack in the middle of the range that yields the corresponding code, except at the endpoints - a 0V input will give a 0 reading from the flash ADC, and VDD will always give a reading of 7, without any concerns about voltage errors.

The bottom of the range for each code is ADDR * VDD / 8, the top is (ADDR + 1) * VDD / 8, so the middle is (2 * ADDR + 1) * VDD / 16. Those values match Figure 1-3 perfectly. It takes 7 resistors: one with a value of 3R, followed by five at 2R, and another at 3R, where R is some convenient value, to get 0V at one end, VDD at the other, and an exact match with Figure 1-3 at the junctions in between.

Any ideas on how to get all 8 addresses?

As crossroads says, have we established that you are going to use 8 of these chips on the I2C bus at the same time.
You should not change the address once it is fixed in your circuit so a simple potential divider with each chip you use is sufficient.

fungus:

MarkT:
No, 7 resistors and 0V and Vcc are among the valid 8 voltages. Fig 1-3 in datasheet.

Yes they are, but the allowed range for the first/last rows in the table is bigger.

Think though: With 7 resistors the first voltage in your chain would be 1/7 VDD.

At VDD=5.5 that's 0.7857V - nowhere near any of the target voltages in figure 1.3 (column V2).

Ah yes, that's odd, I'd have thought they would choose the on-chip resistors appropriate to allow equal external resistors (chip designers usually think carefully about the parts count on external circuit). So you need the two end resistors to be 3/2 the size of the other 5. Or use 9, make the end ones 1/2 the value of the others, and ignore the first and last taps.

Still with 1% resistors 7 equal value ones would actually work I think, on-chip resistors have very good matching.

MarkT:
Ah yes, that's odd, I'd have thought they would choose the on-chip resistors appropriate to allow equal external resistors (chip designers usually think carefully about the parts count on external circuit). So you need the two end resistors to be 3/2 the size of the other 5. Or use 9, make the end ones 1/2 the value of the others, and ignore the first and last taps.

Still with 1% resistors 7 equal value ones would actually work I think, on-chip resistors have very good matching.

I think the chip engineers were expecting people to use two resistors per chip (that's why the datasheet uses "R1" and "R2" in the tables). It's what I'd do...

Well then they weren't thinking about external parts count... Odd.

MarkT:
Well then they weren't thinking about external parts count... Odd.

Huh?

They're probably thinking that attaching eight of these to something is silly, that sensible people would prefer the 16-channel version of the chip if they want that many outputs. A 16 bit chip will save you a hell of a lot more than just a resistor or two.