This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Potentiometer Selection

Other Parts Discussed in Thread: MSP430G2553

I am using a potentiometer to read an angle using an ADC10 peripheral.  My plan is to tie one end to ground, the positive end to a I/O pin and the wiper to the ADC input.  When I want to take a reading I will turn on the I/O pin and take the measurement.  This will limit the current draw from the battery.  My question has to do with the size of the potentiometer.  I am using a CR2032 to power the project and would like to limit the current usage.  If I understand correctly CR2032's have about 220mAh with a max of about 5mA at one time.  In order to save current it seems I would want to pick the potentiometer with the largest resistance I could find.  Is this a good idea or am I missing something?

Take care,

Jon

  • You need to meet the requirements of input to ADC10 too.

  • Jonthornham said:
     In order to save current it seems I would want to pick the potentiometer with the largest resistance I could find.  Is this a good idea or am I missing something?

    This is good idea for low power designs. You shall read your chip series manual, chapter ADC10 (ADC12) "Sample timing considerations". Main rule - the higher input series resistance, the longer shall be sampling time. Using formulas from particular chapter you can calculate maximum allowed resistor value for selected sample timing. If you select 64 ADC clocks and run ADC on lowest supported clock freq, your input resistor can have surprisingly high resistance still giving correct ADC readings.

    For 10-bit ADC having 27pF input capacitance, formula is: Tsample > (Rs+2kOhm)*7.625*27pF

  • Thanks old_cow_yellow.

    Jon

  • llmars,

    Thanks for the response.  Great info.  I have two question?  Currently I have been using 16 cycles to sample.  The tsample time that is calculated, is this this the time for the minimum 4 cycle sample with ADC10CLK?  If I want to use 16 cycles would I simply multiply tsample by 4? 

    Take care,

    Jon

  • Jonthornham said:
    The tsample time that is calculated, is this this the time for the minimum 4 cycle sample with ADC10CLK?

    tsample = (1/ADC_clk_freq)*nsamples

  • Thanks llmars.  Last question.  If I am planning to use a continuous turn potentiometer I will be measuring voltages from 0V-3V if I connect the wiper directly to the ADC input.  If the pot is at 0 ohms then I am concerned that I will damage the MCU.  However I am not sure if the 2KOhm Ri resistor is used to prevent this from happening.  Will I need to place an inline resistor prior to the pin or does the 2KOhm resistor handle this for me?  I also searched for the input current range for the ADC inputs and could not find the acceptable range.  Do you know the range?

    Take care,

    Jon

    For anyone else who has been trying to figure out time constants and sample hold times on the ADC10 here are a few notes I took.

    ADC10 Notes
    Tao = Time Constant (page 413 in MCU Basics, and Sample Timing Considerations in the Family User's Guide)

    The time constant is the same thing as an RC (resistor capacitor) circuit.  We calculate the time constant using the following equation.  

    Tao = (Rs + Ri) * Ci

    Rs = External Resistance (my potentiometer for example)

    RI = 2KOhms and is the internal resistance value for ADC inputs.  This is standard.

    Ci = 27pF and is the internal capacitance for the ADC inputs.  This standard.

    Therefore we are left with the following. 

    Tao = (Rs + 2KOhms) * 27pF

    In order to get an accurate reading from the ADC10 you need to sample the input for 7.625 time constants.  This means if Tao = 1 second you would need to sample the ADC input for 7.625 seconds.  This is then related to clock cycles so we can determine the number of cycles required to sample the input to get an accurate measurement.  Measurements can be sampled in 4, 8 ,16 and 64 cycles.  Using the following values we find the following.

    Rs = 7KOhms

    Tao = (7KOhms + 2KOhms) * 27pF = 0.24us

    Therefore we need to sample the input for 7.625 * 0.24us = 1.85us

    In order to determine the number of cycles needed to make the reading we assume the clock is at it's max speed.  We do this since the most cycles will happen when the clock is the fastest.  If it slows down fewer cycles will happen in the same amount of time and we will be ok.  

    Max Speed of ADC10CLK = 6.3 MHz

    Therefore 1.85us * 6.3MHz = 12 clock cycles.  This means that it takes 12 clock cycles to sample for 1.85us.  Since we have the option of selecting 4, 8, 16 or 64, we select 16 to makes sure we get an accurate sample.  Therefore we pick ADC10SHT_2 in the ADC10CTL0 register. 

  • Jonthornham said:
    If I am planning to use a continuous turn potentiometer I will be measuring voltages from 0V-3V if I connect the wiper directly to the ADC input.  If the pot is at 0 ohms then I am concerned that I will damage the MCU.

    If you are doing everything right and pin is always configured as input, then you can't damage uC because input voltage range for analog or logic inputs includes 0V upto VCC. (Right?) However if you are not sure (about your programming), then you are advised to add "safety" series resistor like 1kOhm between wiper and (supposedly) input pin, also include it into tsample calculation. 

    Jonthornham said:
     However I am not sure if the 2KOhm Ri resistor is used to prevent this from happening.

    No, it wont. Mentioned ADC input 2kOhms is internal resistance of analog mux which is not active while pin is configured as output.

    Jonthornham said:
    I also searched for the input current range for the ADC inputs and could not find the acceptable range.  Do you know the range?

    Datasheet knows. If there's no input leakage current specified for ADC inputs then you shall refer just to port input pin leakage data which i'm sure is specified (Leakage Current, Ports Px).

    p.s. Don't unnecessary overdo with pot resistance ;) For example calculate current for 10k and you will see that it's already quite low consuming to be useable for short periods of ADC sampling.

  • 您好,我在用CCS5.2编译MSP430G2553的工程是遇到了一个问题,就是警告我中断向量没有服务程序,无论我有没有用到这个中断。在CCS5.1上边没有这个问题。程序如下:

    警告如下:

    论坛里有关于这个问题的提问,但是没有明确的答案,希望您可以给我一点建议,谢谢您

  • Li,

    I suggest that you try to post in English. As a last resort, you could use translate.google.com
    But that might have been blocked by your government. In that case, I will try to help if you send me private message. Either way, do not do anything that is “illegal” in your country to get yourself in trouble.

    The following is what translate.google.com did with the above paragraph from English to Simplified Chinese. I know it dose not make much sense in Chinese. But it still gives some hints.

    -- OCY

    我建议你尝试发布英文的。作为最后的手段,你可以使用 translate.google.com
    但是,很可能已经被你的政府。在这种情况下,我会尽力帮助,如果你给我发私人讯息。无论哪种方式,不要做任何事情,在你的国家,以让自己陷入困境“非法”。

  • Hi,

    What Li said was, he needs help to understand why CCS gave him the warnings as shown.

    -- OCY

  • Thank you sir.

    I thought you are Chinese, sorry.

    My problem is when I debug the project of msp430g2553 using CCS5.2, it gives me several warnings.Just like this:

      

  • Li,

    I do not use CCS and cannot answer your question. I was trying to get others to help you.

    I am a "Chinese American". I can read and write 傳統的中國文字 but not 简体

    -- OCY

  • Thank you. I'd

    be very grateful if you could help me.

  • I guess one of the following might work.

    a) Write dummy useless ISR (ISRs) and make those vectors point to it (them).

    b) Find an option to turn off those warning messages.

    c) Ignore those warning messages

    d) Do not use that version of CCS. Use a different version of CCS

    e) Do not use CCS. Use something else.

  • OK. This may be a bug of CCS5.2, I will use another version. Thank you for helping me!

**Attention** This is a public forum