input of ADC

Discussion in 'Embedded Systems and Microcontrollers' started by gobi615, Feb 7, 2012.

  1. gobi615

    Thread Starter Member

    Jul 26, 2011
    30
    0
    hi i want measure 230v AC voltage from line and display it in LCD through microcontroller. first i step down the voltage to 5v AC using PT and i want to convert it to digital . in this part i cant get any idea. i chose pic 16f877a and 10 bit resolution with 0.005v per one increment of 1024 . wheather i can give +-2.5v or 0 to 5v to ADC . pls tell how i measure line voltage using microcontroller ..
     
  2. mcgyvr

    AAC Fanatic!

    Oct 15, 2009
    4,770
    970
    What exactly do you want to know?
    You step down the voltage to a usable level (typically 0-5V analog) and read that with the pic's ADC, then convert/display that value.
     
  3. gobi615

    Thread Starter Member

    Jul 26, 2011
    30
    0
    my doubt is we giving input voltage 5 volt to adc and it converts it to digital range from 0 to 1023 for 10 bit resolution , how i convert to original value (before step down value) to display in lcd...
     
  4. mcgyvr

    AAC Fanatic!

    Oct 15, 2009
    4,770
    970
    You need to figure/design that out.
    What are your true requirements (min/max voltages) are you trying to read from 0 to 230V or just 200-250VAC or what?

    But you basically just do math with your micro to get the proper value displayed and make sure you include calibration of some sort..

    So for example maybe reading the pin gets you a number of 500. Then you multiply/divide or whatever works to that 500 number till you get the correct volt reading then just display that on the LCD screen.
     
  5. Mark_T

    Member

    Feb 7, 2012
    47
    8
    Once you have your circuit working you can read your ADC and you will get a range of numbers because its AC. To convert these there are lots of methods/tricks depends on how accurate you require the answer. Simply you can look for the highest and lowest numbers and with averaging each work out the peaks of the sine wave. Then you display these values and measure with accurate meter the real voltage. This you use as calibration in you software. ie if max=800 and min=500 then peak to peak is 300 and if this is 200VAC then simply display =diff /3 *2; Not that accurate but should work.
    Be warned you should have isolation from the mains for this. PT? I'm from UK?
     
  6. gobi615

    Thread Starter Member

    Jul 26, 2011
    30
    0
    i display the measured voltage what ever it is..varing from 0 to 230v ..
    thanks mcgyvr ..
    if we measuring current what will be the input to ADC ..if it is voltage then how i get it .. help if you know..
     
  7. gobi615

    Thread Starter Member

    Jul 26, 2011
    30
    0
    so if input is ac the output is oscillating . so only we go for DC input to ADC . am i correct?..
     
  8. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,388
    1,605
    gobi: The output of an analog to digital converter is a single number. It is a snapshot (fixed picture) of a single moment in time of what the input is doing at that moment. The input is of course allowed to change, if it never changes then why would you need to read it?

    Now to read an AC signal which by definition is always changing takes lots more skill but is still possible. First you have to change the level of your 230V signal down to the 0-5V range of the input. Then you have to sample the signal fast enough to be able to recover the original signal (which is a bare minimum of 2x the frequency), then go thru a ton of math to recreate the signal from the samples and then extract whatever information you want from that.

    Even sizing the signal to the 0-5V input is not simple. I personally would not touch the math needed to do the rest.

    To make a project you may actually complete in your lifetime try converting your 230V AC signal to a 0-5V DC, a peak detector or such. Yes you are loosing some accuracy if the AC is not the waveshape you assume (usually a sine wave) but you get very good results.

    If you want a true RMS then you should look at some ICs that do that conversion and output a DC level.

    To read a current you need to first convert the current to a voltage, perhaps by just using a resistor.
     
  9. gobi615

    Thread Starter Member

    Jul 26, 2011
    30
    0
    thanks ErnieM . my final doubt is if we measure phase angle difference between current and voltage need any synchronizing circuit between controller and supply voltage i am not conform , i didnt know full detail about controller.
     
  10. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,388
    1,605
    It sounds like you are making a power monitor. If so, yes, you need that phase angle to compute power.

    I suggest you look into some reference designs from Microchip.
     
  11. gobi615

    Thread Starter Member

    Jul 26, 2011
    30
    0
    To measure phase angle difference between current and voltage need any synchronizing circuit between controller and supply voltage by using ZCD i am going to activate timer in controller . for this need any synchronising circuit ..
     
  12. gobi615

    Thread Starter Member

    Jul 26, 2011
    30
    0
    To measure phase angle difference between current and voltage need any synchronizing circuit for controller and supply voltage . By using zero crossing detector i am going to trigger timer , for this need any synchronizing. i attached a circuit in that shown a synchronizing i didnt get that please explain ..
     
Loading...