Pages: [1]   Go Down
Author Topic: Eight analog voltages as simple (fewest parts) as possible?  (Read 1459 times)
0 Members and 1 Guest are viewing this topic.
Toronto, Canada
Offline Offline
Newbie
*
Karma: 0
Posts: 40
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Bill

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 179
Posts: 8070
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Edison Member
*
Karma: 3
Posts: 1001
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 439
Posts: 23728
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Toronto, Canada
Offline Offline
Newbie
*
Karma: 0
Posts: 40
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

Bill

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 439
Posts: 23728
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Valencia, Spain
Online Online
Faraday Member
**
Karma: 118
Posts: 4553
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

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.

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.


Logged

No, I don't answer questions sent in private messages...

0
Offline Offline
Shannon Member
****
Karma: 161
Posts: 10434
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

[ I won't respond to messages, use the forum please ]

Valencia, Spain
Online Online
Faraday Member
**
Karma: 118
Posts: 4553
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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).

« Last Edit: October 07, 2012, 09:02:12 pm by fungus » Logged

No, I don't answer questions sent in private messages...

USA
Offline Offline
Sr. Member
****
Karma: 12
Posts: 322
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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. 

Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 508
Posts: 31448
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.
Logged

0
Offline Offline
Shannon Member
****
Karma: 161
Posts: 10434
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

[ I won't respond to messages, use the forum please ]

Valencia, Spain
Online Online
Faraday Member
**
Karma: 118
Posts: 4553
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...

Logged

No, I don't answer questions sent in private messages...

0
Offline Offline
Shannon Member
****
Karma: 161
Posts: 10434
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

[ I won't respond to messages, use the forum please ]

Valencia, Spain
Online Online
Faraday Member
**
Karma: 118
Posts: 4553
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

http://ww1.microchip.com/downloads/en/devicedoc/22103a.pdf
Logged

No, I don't answer questions sent in private messages...

Pages: [1]   Go Up
Jump to: