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.

How to get more accurate result for ADC?

Other Parts Discussed in Thread: MSP430G2553, ENERGIA

Hello everybody,

I have done a small ADC program which read analog voltage and produces digital value. I have given 1 Vpp, 1 KHz sine wave as input but after conversion from digital value to voltage (voltage = 3*(sensorValue)/1023), i am getting the output voltage maximum 0.42 V.

So what can be problem in this? why not it is giving 1 V or nearly 1 V?

Whether the conversion formula is correct or wrong ? (for MSP430 10-bit ADC)

following are the details and code

Launchpad using: MSP430G2553

MCU- MSP430

for programming i am using Energia software

code-

void setup()

{

Serial.begin(9600);

}

void loop()

{

int sensorValue = analogRead(A3);

Serial.print(sensorValue);

float voltage = sensorValue * (3.0/1023);

Serial.print(voltage);

delay(1000);

}

when i try by changing the frequency of input signal then it doesn't affect the maximum value. I checked for 100 Hz, 1KHz and 10 KHz also.

So please help me to get correct output ...

Thank you

  • Perhaps you connected 1vpp signal with 0V DC offset. This means signal goes between -0.5v to +0.5v. No wonder you do not see +1V ADC readings because ADC of msp430g2553 sample positive voltages.

    Also 10KHz sine is very fast changing signal. To "hit" it's maximum amplitude often, ADC sample rate shall be quite high, like 200KHz or so.

    You shall start measuring DC voltages first. Then learn how to connect AC signal to ADC, how to sample it and how to interpret results.

  • Thank you very much..
    actually i did it for low frequency signals but now i want for high frequency, and msp430 is having 200 ksps sampling rate. so how to achieve this maximum sampling rate?
  • >how to achieve this maximum sampling rate?

    I am afraid that using Energis it is not possible. You shall run ADC at maximum speed, store results in the memory using DTC. You shall read users guide and source code examples.

  • Ok.
    may i know what is reason why we can't achieve maximum sampling rate using energia? what is the problem with it?
    Can i use high sampling rate external ADC with MSP430?
    please suggest me if any.
    Thanx...
  • >may i know what is reason why we can't achieve maximum sampling rate using energia? what is the problem with it?
    CPU code execution speed, also code overhead introduced by Energia. I don't even know - it is possible to use DTC with Energia or not.

    200000 samples per second means 400 kilobytes per second of data to process by this tiny CPU.

    200000 samples per second at 16MHz CPU clock equals 80 CPU cycles (not even instructions) per sample. You shall do everything: wait for next sample to arrive, read it from ADC, process data during just those 80 CPU cycles.

    >Can i use high sampling rate external ADC with MSP430?

    You can. Unfortunately it does not make sense because ADC of msp430 is already faster than you can process by it's CPU data coming out of it's ADC :)

  • so here problem is CPU clock speed not ADC speed right?
    due to less clock frequency (16MHz) it can't process at full speed.

    Another problem is that when i applied 2Vpp with DC offset of 1V , still i am getting only 1.66 V as maximum voltage of output sample. How can we achieve that to 1.9 V? Where is the voltage gets attenuate ?
  • thank you so much...
    now if i want to store ADC readings or export to excel sheet then what to do?
    if i able to store the readings then i think the problem will be solve.
    My aim is to find the peak amplitude from high frequency signal (acoustic emission sensor).
  • >Another problem is that when i applied 2Vpp with DC offset of 1V , still i am getting only 1.66 V as maximum voltage of output sample. How can we achieve that to 1.9 V? Where is the voltage gets attenuate ?

    Perhaps you do not sample AC waveform fast enough, skipping lot of signal samples including those having maximum amplitude. Perhaps sample time is too slow for given signal and you are getting averaging. As only you have access to your circuit, only you can find where problem is. Test using 1V and 2V DC input voltages, check that you are getting expected ADC values. When everything is ok with DC input, _only_ then proceed further with AC signal. Then start with really slow AC signal, 10Hz or so.

    >My aim is to find the peak amplitude from high frequency signal (acoustic emission sensor).

    You can read buffer of 50..100 signal waveform samples into memory using DTC, then stop ADC, then using math calculate amplitude of the signal. Other way would be to build peak detector circuit and directly read it's output voltage which would be signal amplitude, using ADC.

  • Thank you very much
    your suggestions will definitely help me.

**Attention** This is a public forum