- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a task to make an ammeter using PSoC 3, my teacher give me an example like voltmeter using PSoC 3 in PSoC 3/5 Reference Book, can any one help me for this? what is algorithm for this?
i have found two methods for current measurement, single/multiple channer current measurement using PGA dan current measurement using TIA. Thanks.
- Labels:
-
PSoC 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Use the voltmeter approach and measure the voltage over a shunt resistor. Keep in mind that the input for a PSoC must be in the range of GND < Vin < VDD
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, nearly.R1 is your shunt, but in series to that will be your consumer (another resistor, but unknown). In your picture the volotage you measure will always be Vdd.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
R2 is not the reference, it is the unknown R where the current I flows through. The same current flows through your R1, so with Ohm's law you get I = Umeasured / R1
To reduce errors further, have a look at this application note concerning "Correlated Double Sampling" (CDS)
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
oke, thank you.
i used code like voltmeter example and add some new for current measurement. i hope you can check it and correct me if i'm wrong.
#include <device.h>
#include <stdio.h>
int main()
{
int32 adcResult;
float adcVolts;
float adcAmpere;
float Rshunt;
char tmpStr[25];
PGA_Start();
ADC_Start();
LCD_Start();
LCD_Position(0,0);
LCD_PrintString("PSoC Ammeter" );
ADC_StartConvert();
for(;;)
{
if(ADC_IsEndConversion(ADC_RETURN_STATUS)!=0)
{
adcResult=ADC_GetResult32( );
adcVolts=ADC_CountsTo_Volts(adcResult );
adcAmpere=adcVolts/Rshunt;
sprintf(tmpStr,"%+1.3f ampere", adcAmpere);
LCD_Position(1,0);
LCD_PrintString(tmpStr);
}
}
}
and i make the block diagram like this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A more precision approach would be to eliminate the PGA and use
the A/D differentially, so connect its - input iput to the pin that connects
to the low side of the shunt.
Also set A/D up with bypass buffer so that you can get rail to rail performance.
In your code you did not set the value of Rshunt.
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, thats the correct schematic. Basically by not using TIA or PGA
you eliminate errors associated with their signal path, like V and I offsets,
noise....
Also by using differential mode you eliminate common mode voltage
errors.
Here is more than you want to know about errors -
www.dropbox.com/s/ruaf9booe17jk8n/PCB%20Layout.zip
www.dropbox.com/s/plck7e95v7pw33c/CMR%20Analysis%20IA.pdf
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
oke, thank you for the tips mister dana.
oh ya, so what the pin that i can use for this design?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Take a look at these -
http://www.cypress.com/?rID=40247 AN58827 - PSoC® 3 and PSoC 5LP Internal Analog Routing Considerations
http://www.cypress.com/?rID=39974 AN58304 - PSoC® 3 and PSoC 5LP – Pin Selection for Analog Designs
http://www.cypress.com/?rID=57571 AN72382 - Using PSoC® 3 and PSoC 5LP GPIO Pins
http://www.cypress.com/?rID=39677 AN57821 - PSoC® 3, PSoC 4, and PSoC 5LP Mixed Signal Circuit Board Layout Considerations
Regards, Dana.