how to measure current using PIC

Thread Starter

walid el masry

Joined Mar 31, 2009
133
hi, i wanna measure the current flow coming from a hall effect sensor to the tesla meter so that taking that current and find the magnetic field by using formula on pc program so my idea is as the following

i put a small shunt resistor in series with the sensor so that i measure the voltage drop across the 1ohm resistor and then find the current by ohm law an so on but trouble begins to show up

it is supposed that the current flow will be at maximum is 10A and because the magnetic field has 2 directions so it would be -10A or +10A so the limits for the voltage measurements is -10v or +10v

and as we know
1. pic can't handle voltage greater than the range 0v to +5v
2. pic can't handle negative voltage

i put a design to a circuit it suppose to convert negative voltage to positive an in the same time do a voltage level shift from range (-10v~0v) or range (0v~+10v) to to the range (0v~+5v) so that the pic can handle it

here is my design
http://lookpic.com/c1/i2/2113/pcMlkWJ3.jpeg
or
http://img269.imageshack.us/img269/7452/voltagelevelshift.jpg

and here is the design file
http://www.mediafire.com/?mwiuk2puz6u469o

at general what is the best method to measure a dc positive or negative current in range of -/+ 10A using pic ?
 

thatoneguy

Joined Feb 19, 2009
6,359
Typically, sense resistors are in the 0.01Ω or less range so they do not cause a significant voltage drop to the device drawing the current.

From the sense resistor, the signal is run through a high impedance / instrumentation operational amplifier, which amplifies the voltage change to levels that can read by an ADC, such as a PIC.

There are cases where the sense resistor directly feeds the ADC as well, omitting the op amp, but when you need to work with opposite polarities, some form of amplifier and bias insertion is required.

--ETA: Your images took a while to load from the link. You are on the correct path, use a smaller sense resistor, then set the op amp to have a range of 0-5V, with 2.5V being "zero". The PIC can then read that signal to process.
 
Last edited:

Thread Starter

walid el masry

Joined Mar 31, 2009
133
i afraid i can't get you correctly do you agree with my though or you explain the general method to do that any way if it not bothering you i need more details specially in my case dc -/+ 10A
 

thatoneguy

Joined Feb 19, 2009
6,359
What you are looking for is a voltage level shifter.

There is the additional possible problem of the large value sense resistor. Using a smaller sense resistor will give more accurate results for current, and not disturb the device drawing the current. The smaller sense resistor will also result in a smaller voltage, which will need to be both amplified and level shifted.
 

t06afre

Joined May 11, 2009
5,934
Your setup is a typical current to voltage conveyor. I have used it in skin conductance applications. Using a constant AC source, and R1 in your schematic is the skin unknown skin admittance. But your setup is kind of dodgy. Can you tell us more what you want to do? In most cases the setup recommended by Thatoneguy is the most useful and practical . In order to measure current. Break the loop and insert a small resistor. Then measure the voltage drop over this resistor with a instrumentation amplifier
 

Thread Starter

walid el masry

Joined Mar 31, 2009
133
i hope i can make it clear to you t06afre, the condition is there is a tesla meter in a lab and it show measurements depend on a sensor with cable connected to the meter, the is an experiment which depend on expose a material to +ve magnetic field for duration of time an then to a -ve magnetic field for another duration and during the whole process values are taken from the meter manually and then saved in excel sheet

what we wanna do is to computerize the process so that make it more faster so the solution showed up was like the following

the expected current flow from the sensor in case of +ve magnetic field is +10A and for the -ve is -10A the i will put a small power resistor (1ohm) in series with the sensor and measure the voltage drop across it and calculating the current flow from ohm law and then calculate the magnetic field by taking that current and put it in equation on a pc program i will write it

the problem here is to make the pic microcontroller able to measure that voltage and since we know that it's ADC can't handle voltage out range 0~+5V what i have to do it to shift voltage drop (0~+10v for +ve field or +10v~0 for -ve field) to the level of 0~5v

the description for my suggestion is we have 1st stage inverting amplifier with gain 0.5 and 2nd stage inverting amplifier with gain 1 and the two stages are cascaded and the output from each other is connected to analog signal multiplexer and there is a comparator which test if the input voltage is +ve or -ve so that give the multiplexer the correct selection and then the desired signal will be available at the output to be read from the pic and i might take the comparator output also to the pic to define if the input signal was +ve or -ve then i will send the value read by the pic and the polarity from the comparator and send it to the pc

just it i hope i was clear and if there are any question please tell me and remember what i want to know am i thinking wright or there are any thing am missing and if there are any better solution to my condition it is very welcomed
 

thatoneguy

Joined Feb 19, 2009
6,359
This Article Shows a simple circuit for level shifting, along with a good description.

Is a 10V drop across the resistor going to effect the operation/output of the device? I'd lean toward a precision 0.1Ω resistor instead, the levels would not only be closer to the input requirements of an ADC, but the power dissipated would be far less as well.
 
Top