Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

PSoC™ 6 Forum Discussions

Khaz_4682641
Level 1
Level 1
First like given

Hi All,

I'm using cy8ckit-062-ble and I'm working in Modus ToolBox.

I'm using a battery as a power supply for the MCU and I directly connecting the battery to the MCU from VTARG pin.

I need to measure the battery voltage with SARADC. however, the battery is the supply for the ADC

I tried to measure the battery voltage with the ADC and the output keeps show me the Vref that I assigned.

Best regards,

Khalil

0 Likes
1 Solution
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hello Khalil,

In order to measure a voltage we need a reference, independent of the signal. Otherwise our results will be affected. In your use case, you are trying to use the battery voltage to power the device and measure using the ADC. If the ADC voltage reference is set to VDDA, we will not get right results. To avoid this problem, use internal Vref(1.2V) as the reference. Use high value resistors(to reduce current drawn) and divide the battery voltage into a value below 1.2V. This can be used to measure the battery voltage level.

Best Regards,
Vasanth

View solution in original post

0 Likes
10 Replies
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hello Khalil,

In order to measure a voltage we need a reference, independent of the signal. Otherwise our results will be affected. In your use case, you are trying to use the battery voltage to power the device and measure using the ADC. If the ADC voltage reference is set to VDDA, we will not get right results. To avoid this problem, use internal Vref(1.2V) as the reference. Use high value resistors(to reduce current drawn) and divide the battery voltage into a value below 1.2V. This can be used to measure the battery voltage level.

Best Regards,
Vasanth

0 Likes

Vasanth thank for your reply,

Is there anyway else to measure the MCU battery voltage without the ADC?

Edit : Does the cypress have voltage divider to the analog input ?

Regards,

Khalil Azouz

0 Likes

Khalil,

On a PSoC4 I once measured VDD without the ADC.

By using the LVD comparator circuits I set the threshold for VDD detection in steps until VDD was above or below the threshold selected.

This technique did not use the ADC.  It used a comparator circuit devoted to the Low-Voltage Detect circuit.

I don't know if a similar method is available to the PSoC6.  Since it has a LVD circuit, I would think: Yes.  If not, I know the PSoC6 has comparators.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hey Khalil,

Additional to what Len said, there is no voltage divider component as you asked in PSoC. Comparator is the other option available as mentioned.

Best Regards,
Vasanth

0 Likes
RodolfoGL
Employee
Employee
250 sign-ins 5 comments on KBA First comment on KBA

Another method is to use the PSoC 6 internal Low Voltage Detector. If you just need to trigger an interrupt based on a threshold, this is the best method you can use, since it doesn't require any extra hardware resource (like an ADC or Comparator).

Please refer to the PDL documentation > LVD driver.

0 Likes
Khaz_4682641
Level 1
Level 1
First like given

Thank you all for reply,

I tried the LVD comparator and its output is inaccurate, the output of LVD is above the 2.8V and blow the 2.9V when the VDDD voltage is 2.93V.

And I tried to test it multiple times with different VDDD voltages and there were inaccurate results of the output.

Here what I did :

     I enabled the LVD comparator and set the threshold voltage for 2.9V and I waited for 20uS ,after that I got the result then I changed the threshold voltage to 2.8 and waited for 20uS and I got the result 

Is there something wrong I shouldn't do?

regards,

Khalil Azouz

0 Likes

Khalil,

The vref feed to the LVD comparator is accurate but not uber-accurate.  (Trying to locate the spec on this).

Be careful trusting your measuring device.  If you're using a multi-meter, what is it's accuracy and when was it last calibrated (component values do shift over time).  If you're using a scope to make the measurement, the accuracy is usually not great.  Most scopes are 8-bit ADC accurate across a vertical full-screen at the input range selected.  Therefore to maximize the scope resolution, you would need the signal to appear at the very top off the screen with the GND reference @ center vertical of the screen.  Note:  The 8-bit resolution also includes signals below the GND reference.  Therefore if your signal is "+" to GND then it is only a 7-bit resolution.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
Khaz_4682641
Level 1
Level 1
First like given

Len,

  1. We are using Fluke AVO meter measurement tool, It's known with its accuracy and reliability.
  2. Moreover, we are using it while testing a batteries and a regulated voltage and its result are accurate with 100%.

So, what we should measure the battery supply?

Khalil

0 Likes

Khalil,

I'm assuming by "AVO" you're referring to a Ampere-Voltage-Ohm meter.

I've used Fluke meters at work in the past.  They are good.  We need to have them calibrated once a year.

We're currently using Agilent (Now Keysight) meters (slightly better for uA current measurements).

What are you using to step-down the battery voltage?  Are you using a linear power supply?  (Switching power supplies can be very useful but can be noisy for making good reliable measurements with the experiments you are doing.)

If you are using a charged cap and remove the power with a switch, the issue is that the Fluke meter has long measurement and averaging cycles.  If the Fluke is averaging the discharging voltage, it might register a higher value at the time of the LVD trigger.

It sounds like your result with the LVD above was good for the LVD set at 2.8V but questionable for the LVD set to 2.9V.

With your reading of 2.93V and the LVD setting @ 2.9V there is only a difference of 1%.  (Still could not find the LVD vref accuracy).  Is this sufficient for your needs?

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes

Khalil,

If you're interested, I found the LVD accuracy specification.

pastedImage_0.png

From the table above, the LVD accurarcy is about +/- 4%.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes