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.
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 ?
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.
Additional to what Len said, there is no voltage divider component as you asked in PSoC. Comparator is the other option available as mentioned.
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.
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?
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.
- We are using Fluke AVO meter measurement tool, It's known with its accuracy and reliability.
- 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?
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?