Shop OBEX P1 Docs P2 Docs Learn Events
ADC Aref pin question, and a few mcp3208 details? — Parallax Forums

ADC Aref pin question, and a few mcp3208 details?

rwgast_logicdesignrwgast_logicdesign Posts: 1,464
edited 2013-03-17 22:55 in General Discussion
I have been Googling and Googling this and I don't see anyone doing it. I have a board with a Propeller and and Atmega328. I would like to use the AVRs built in ADC and attach an mcp3208 to the Prop. At this point I have no idea what all I want to do with these ADCs besides monitor batterys and read the pot wipers inside a few servos. So I think it would be in my best intrest to be able to adjust my AREF pins on both ADCs. I was thinking the best way to do this would be to connect the wiper of a trimmer pot to each AREF pin. The issue is, is that I know I can not be the first person to think of this idea, but I can't find an example of anyone else doing it. This makes me wonder if maybe it isn't such a slick idea?

Secondly I was wondering if someone could help me understand the difference in the mcp3208s single ended 8 input mode, and double ended 4 input mode. In double ended mode does the IN- pin act as the ground reference? If so what advantages does this have? I read the data sheet a few times but I still can't figure out what the advantage of double ended mode may be. Also would the V+ input benefit from an LC filter the same way the AVR ADC does? The data sheet only refers to using a .1uf decoupling cap, no filters.

Comments

  • Mark_TMark_T Posts: 1,981
    edited 2013-03-17 18:26
    I have been Googling and Googling this and I don't see anyone doing it. I have a board with a Propeller and and Atmega328. I would like to use the AVRs built in ADC and attach an mcp3208 to the Prop. At this point I have no idea what all I want to do with these ADCs besides monitor batterys and read the pot wipers inside a few servos. So I think it would be in my best intrest to be able to adjust my AREF pins on both ADCs. I was thinking the best way to do this would be to connect the wiper of a trimmer pot to each AREF pin. The issue is, is that I know I can not be the first person to think of this idea, but I can't find an example of anyone else doing it. This makes me wonder if maybe it isn't such a slick idea?

    Secondly I was wondering if someone could help me understand the difference in the mcp3208s single ended 8 input mode, and double ended 4 input mode. In double ended mode does the IN- pin act as the ground reference? If so what advantages does this have? I read the data sheet a few times but I still can't figure out what the advantage of double ended mode may be. Also would the V+ input benefit from an LC filter the same way the AVR ADC does? The data sheet only refers to using a .1uf decoupling cap, no filters.

    I know the ATmega328 wants quite a stiff AREF (I don't think a decoupling cap is enough, you may need to buffer the value with an opamp, datasheet will
    be definitive). You also have to set the relevant register correctly to get external reference (otherwise an internal FET connects AREF to VCC).
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2013-03-17 19:37
    I was reffering to Decoupling cap/LC Filter on the VCC pins not AREF, sorry about the confusion.
  • kwinnkwinn Posts: 8,697
    edited 2013-03-17 19:55
    The ADC Vref should be a low impedance source so a pot followed by an op amp is preferred, but a low resistance pot can be used with some reduction in accuracy and stability.

    Differential mode allows you to measure the difference in voltage between the two inputs rather than the voltage in relation to ground.
  • frank freedmanfrank freedman Posts: 1,983
    edited 2013-03-17 20:19
    Hey RW,

    The second part is easy. Using the double ended mode more commonly called differential mode helps eliminate common mode noise. I don't know how much scope time/experience you have, but when working on low level video noise is a big problem. The way to reduce that noise is to use both channels of the scope; place B channel into invert and hook to the video ground at the source, A channel to the video pin needed for testing with the A/B selector set to A+B. This will cancel out a lot of the common noise picked up in the probe cables. (Also helps to twist the cables as much as possible to further reduce noise). The invert and add is all you are really doing with the MCP3208 in 4 channel differential mode. Common mode noise will be reduced. For say a motor current feedback with a 1 ohm resistor and an expected 500 mA iMax gives a full scale voltage of 500mV. Here, noise could be a big problem. You could take a twisted pair from both sides of the resistor used to montitor the current through the motor, and run one side back to the + and the other side to -. Depending on your circuit, - may be ground or it may not. but what you will have is the actual voltage being seen across the + and - pins, with the noise picked up from various sources greatly reduced because the differential configuration rejects common mode noise. If it proved cheaper to spend on a few quad op amps and discrete parts, you could leave the MCP3208 in 8 single ended mode and use the op amps as differential amps with the output to each to the MCPs inputs. Heck, you might need to do just that if your environment is such that the MCPs common mode rejection is not able to quiet the input noise and require you to build a quieter input stage. Data sheets may give you the needed data to figure that one out.

    As to the first part, there are a couple ways you could go about this. You could use DACs to create a bunch of reference voltages which would require the DACs, buffers and code to make it work, or you could use a good solid Vref to all the ADCs at whatever the max Vref is for the device and then use op amps, voltage dividers and etc. to scale the input values down to the same range as the 0-Vref into the device. The former would be customizable in code and probably much more expensive than the second option since you will still have to adapt the inputs to the ADCs with dividers and op amps and etc. With the second option, you invest in a Vref source (they make these, but be especially careful of putting caps on their outputs though as you could introduce a whole nuther class of problems) and just scale the inputs without spending on circuitry to customize multiple custom references.

    I have seen both ways used in systems for auto-cal (or at least software assisted cal) for adjustment in various circuits used to control motors, tube currents, kV references etc. All depends on your needs and how much you are willing to spend to meet the needs of your function.

    FF

    I have been Googling and Googling this and I don't see anyone doing it. I have a board with a Propeller and and Atmega328. I would like to use the AVRs built in ADC and attach an mcp3208 to the Prop. At this point I have no idea what all I want to do with these ADCs besides monitor batterys and read the pot wipers inside a few servos. So I think it would be in my best intrest to be able to adjust my AREF pins on both ADCs. I was thinking the best way to do this would be to connect the wiper of a trimmer pot to each AREF pin. The issue is, is that I know I can not be the first person to think of this idea, but I can't find an example of anyone else doing it. This makes me wonder if maybe it isn't such a slick idea?

    Secondly I was wondering if someone could help me understand the difference in the mcp3208s single ended 8 input mode, and double ended 4 input mode. In double ended mode does the IN- pin act as the ground reference? If so what advantages does this have? I read the data sheet a few times but I still can't figure out what the advantage of double ended mode may be. Also would the V+ input benefit from an LC filter the same way the AVR ADC does? The data sheet only refers to using a .1uf decoupling cap, no filters.
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2013-03-17 21:59
    Thank you Frank and Kwinn, that helped clear up a lot of confusion! I have to look at the chip but I have a little TI 8 pin 12 bit dac somewhere that I have never had a use for. I could connect this to the prop and make it generate voltages on two different channels then run those channels to each AREF, or would I need more circuitry than that, you mentioned a buffer. Also would there be an issues with the ADCs starting up before the DAC can send an AREF signal, how about changing the AREF on the fly with the ADCs running?
  • frank freedmanfrank freedman Posts: 1,983
    edited 2013-03-17 22:55
    May need to buffer the DAC output. If so, go low output impedance from the reference ckt. Saw that somewhere here. (yeah, what kwinn said.....) Same applies to the inputs of the ADC if you use anything to scale the inputs.

    As to starting ADCs before reference voltages are up, that's on you as the developer. As part of the init, you will set up the order in which things are initialized, as well as testing values and delays between startup functions. How much depends on things like degree of people/machine safety, reliability of operation, and costs of failure.
Sign In or Register to comment.