# Cypress Developer CommunityTM

## Make an ammeter using PSoC 3

Summary: 11 Replies, Latest post by danaaknight on 01 May 2015 06:24 PM PDT
User
15 posts

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.

User
9241 posts

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

User
15 posts

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

like this pic or not?

Attachments:
User
9241 posts

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

User
15 posts

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

Attachments:
User
9241 posts

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

User
15 posts

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()

{

float Rshunt;

char tmpStr[25];

PGA_Start();

LCD_Start();

LCD_Position(0,0);

LCD_PrintString("PSoC Ammeter" );

for(;;)

{

{

LCD_Position(1,0);

LCD_PrintString(tmpStr);

}

}

}

and i make the block diagram like this.

Attachments:
User
7646 posts

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.

User
15 posts

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?

Attachments:
User
7646 posts

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.

User
15 posts

oke, thank you for the tips mister dana.

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