Make an ammeter using PSoC 3

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

cross mob
Anonymous
Not applicable

 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.

0 Likes
11 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

 how to add shunt resistor in TopDesign.cysch ? i am sorry, i am new for this.

   

like this pic or not?

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

 oh, did you mean using voltage divider circuit like this? so the R1 is shunt and R2 is Rreference

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

 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.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

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.

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

 Oh thanks for the tips, i've recently read this method in "AN84783", thank you.

   

like this "try again" pic?

   

 

   

so what is the different for current measurement usig this method, PGA and TIA?

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

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.

0 Likes
Anonymous
Not applicable

 oke, thank you for the tips mister dana.

   

oh ya, so what the pin that i can use for this design?

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

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.

0 Likes