Easiest would be to let the 20mA flow through a resistor (shunt) and measure the voltage across and then have the PSoC3 digitize that with the ADC. Calculate with Ohm's law the needed shunt and the needed max. voltage across.
Dana wil probably advise you to make an error-calculation for your design based on the precision you need for your results...
If you are simply trying to measure a current, A/D and a Rsense to convert
I to V is all thats needed. But then you have to consider common mode
range needed for A/D. If Rsense is place in series with load in ground leg
that will meet CM range of A/D. If you do high side measurement then
you will need an external high side circuit, translator in effect. An example
of one -
Hall effect -
Thanks for your replies.
I wondered if the current 0-20mA could be injected directly into the PSoC and then measured without external component and with a TIA or other things but apparently it is impossible.
The TIA does not have a low enough value R to handle 20 mA.
You could take a look at injecting current into an output pin driven low,
into saturation region of MOSFET output. But problem with this is
device to device variation of Rdson. If you did a production cal at
production test then you could correct for this variability. A/D would
be used on pin to measure voltage, hence compute current based
on measured V and knowlege of Rdson.
Another issue is complience range of a pin used like this would be
Vddio + .5V.
You would also have T to contend with -
Some questions -
1) Is this a 4/20 mA current loop or just a single ended current source sinking to ground ?
2) Current source bipolar or mono ?
3) Range is 0 - 20 mA or 4 - 20 mA ?
4) You want to measure current in hot side of load or ground side ?
5) Accuracy (absolute) you are trying to achive ?
6) Resolution of current measurment ?
7) Sample rate of measurements to be made ?
8) Current source DC or comprising a lot of noise ?
9) Absolute max peak current provided by source ?
The solution with TIA not appropriate. This is because you are settting G with external
R, thereby converting TIA to V amplifier. Reason is the onchip 20K TIA R has, most likely,
a horrible absolute value, 60% according to DS. Rather use a PGA, where G is a f( R/R ),
and onchip accuracies of ratioed R's is quite good, see G spec for PGA, at highest G 5%
Note A/D has a G programmable input buffer, 1, 2 , 4 , 8 G's are available. If more G needed
Looks like you want to use 20MA current loop for digital communication.
I would avoid measuring current directly as it most likely causing GROUNDING issue later on.
I would prefer to use opto-coupling.