• 0

## Question

Dear @JColvin,

I am using PMOD AD5 to measure the voltage of current and voltage transformer. I set the output voltage of current and voltage transformer to maximum 3.3V. I would like set the external reference voltage of AD5 to 3.3V, So, how would I set AD5 reference voltage to 3.3V?

Also, please explain the difference between Analog supply voltage (AVdd) and REFIN2+ and REFIN2-, Which pin will be use as external reference voltage pin?

Furthermore, I am using  AD7193.h  library created by Anne Mahaffey and he define variable named  mVref = 2.5, I think it represent a default reference voltage. Suppose if change the AD5 reference voltage to 3.3V. Do I have to change this number to 3.3V in AD7193.h file? Lastly,  Is the mentioned/attached library is suitable for 24-bit ADC?

Many thanks

Edited by irfiee

## Recommended Posts

• 0

Hi @irfiee,

The AD7193 datasheet here shows that:

P1/REFIN2(+) is the digital Output Pin/Positive Reference Input. This pin functions as a general-purpose output bit referenced between AVDD and AGND. When the REFSEL bit in the configuration register = 1, this pin functions as REFIN2(+). An external reference can be applied between REFIN2(+) and REFIN2(−). REFIN2(+) can lie anywhere between AVDD and AGND + 1 V. The nominal reference voltage, (REFIN2(+) − REFIN2(−)), is AVDD, but the part functions with a reference from 1 V to AVDD.

P0/REFIN2(−) is the digital Output Pin/Negative Reference Input. This pin functions as a general-purpose output bit referenced between AVDD and AGND. When the REFSEL bit in the configuration register = 1, this pin functions as REFIN2(−). This reference input can lie anywhere between AGND and AVDD − 1 V.

The power supply has AVDD(Analog power) is from 3 V to 5.25 V  and DVDD(digital power) is from 2.7 V to 5.25 V.

If you want the Vref to be 3.3v then you will need to change the Vref in the library as well as physically on the PmodAD5 as described in the reference manual here. The reference select bit from the default reference of 2.5V to the user supplied reference voltage between pins REFIN2+ and REFIN2-.

thank you,

Jon

##### Share on other sites
• 0

I have  a problem with measuring of 0 - 24 V DC with PMOD AD5 using Arduino UNO. As we know from datasheet, any incoming input voltage to be measured must be within ±(AVDD-1.25V). So,  a Voltage divider to step down the input voltage to below 2 V used. The set up of a Voltage divider is, • The PMOD AD5 is operating at 3.3V,  which means, reference voltage is 2.5V.
• AD7193.h library is used (same one which I mentioned in my first post)

The functions that they have used in the library to measured the voltage are; By applying the above code, I am  getting right reading of the voltage divider should give but this Voltage function is missing a voltage divider ratio, so that's why I am trying to use my function to calculate voltage. The code I am using is;  The output of the above code is 1.25V, Even if there is not input voltage, which mean that it does not work.

My questions are;

Firstly,  I don't know what is mPolarity means in the AD7193.h library?

Secondly, why he used half of 24-bit ADC resolution (float)8388608 ?

Finally, how would I use my own function to calculate voltage by getting raw data from the PMOD AD5 ADC?

Many thanks

##### Share on other sites
• 0

Hi @irfiee,

1) mPolarity deals with the BIPOLAR/UNIPOLAR CONFIGURATION as discussed on page 33 of the AD7193 datasheet here

2) You will need to look more closely to the BIPOLAR/UNIPOLAR section to better understand why they divide the raw data by  (float)8388608﻿.

3. I would first confirm what the Pmod AD5 is configured to. Then make sure that your code reflects the conversion formulas the datasheet gives you.

thank you,

Jon

##### Share on other sites
• 0

Hi

If you are not already, I would also recommend using the libraries I posted on this thread since it defines and uses mPolarity whereas from what I remember other libraries online did not use this parameter.

Thanks,
JColvin

##### Share on other sites
• 0

Thank you @jpeyron @JColvin for your help. I think, the library currently, I am using using mPolarity function but any way i will try to use the new library as well. If i have a problem again, I will come back to you. thanks

##### Share on other sites
• 0
Posted (edited)

Hi @irfiee,

I updated the libraries a bit more since the registers were not being manipulated correctly; I have attached the relevant library files and sketch for it as well.

Thanks,
JColvin

Edited by JColvin