I have a non-invasive current sensor (ECS1030-L72) and am attempting to use the PIC18 ADC to read current levels. With the deivce connected to a single AC wire feeding a lamp I can measure about 0.5V when connected directly to the leads. When I connect it directly to the PIC the meter reads 0V, using a 10Ohm, 33Ohm, 1Mohm burden resistor between the leads connected to ground with one lead connected to AN2 on the PIC I get 0 in both result registers. To check my ADC code I connected a 5V source and get nice non-zero readings.
I have tried using a reference voltage (VREF+ on AN3) of 1V and have also used VDD as the reference voltage both with the same results.
Can someone explain why the read voltage goes to 0 when I connect the leads to my PIC?
Sounds like you’ve got a short to ground somewhere when the PIC is connected. What happens if you connect a multimeter and measure voltage between the AN2 and ground pins of the PIC? Does it read zero then?
Where R1 is the burden resistor, 10Ohm, 33Ohm, 1MOhm. I tried the 1Mohm resistor thinking that maybe it was shorting to ground, but alas I get the same results.
Yes, with the circuit in place I get 0V measured between AN2 and GND.
The current sensor output is a small AC current, which a 10 ohm burden resistor will convert into an AC voltage of about 5 mV per sensed ampere (rms). What do you expect to see for a measurement using the PIC ADC?
Normally, people use a current sensor of this type with a precision op-amp rectifier to give a maximum DC output in the 3-5 volt range, suitable for ADC measurements. See this thread, for example: viewtopic.php?f=14&t=28775&p=129154
Thanks for the help, the thread offered by jremington was helpful. I ended up following the advice of one of the replies there and setting it up this way:
Voltage divider to put 1V on Vref+ (AN3)
Voltage divider to put 500mV on one side of the CT sensor (instead of GND)
Connect AN2 (ADC in) to other side of CT sensor
Change 10Ohm burden resistor to 1Mohm!
Now I can get meaningful readings at a 40W load - although I have to sample pretty often as many readings are similar to no-load readings.
I am a systems architect (large scale distributed systems) not an EE so some of the electronics wisdom is indistinguishable from magic - why would the 1Mohm resistor fix my problem when the datasheet shows a 10Ohm resistor?
The sensor (current transformer) generates a current. The burden resistor converts the current to a voltage through the magic of the #1 rule of electronics/electricity (V = I * R). Since the current is very small out of your CT, multiplying that by a small resistor generates a small voltage. Multiply that by a large resistor and you get a large voltage.
So a few things of note.
You can’t increase the burden resistor ad-nausea. The CT was designed for a specific burden resistor to maximize the linearity and safety of the sensor. Using the specified burden resistor will improve accuracy, but puts you in a place of having to amplify the signal to get it into the range of the ADC.
If you do not rectify the AC signal to DC, you will need to sample at least 60Hz*2 to beat Nyquist at his aliasing game. If you don’t know Nyquist, Google it. Now if you take the max sample over a few seconds you will have the max current. This is NOT the current that you would compute from the voltage and wattage of a bulb. A 120 watt bulb at 120V does not have a max current of one amp. It has 1 * sqrt(2) amps maximum current. This is the whole RMS issue you get into with AC circuits.
Another solution is to buy a chip that does all this ‘crap’ for you. Something like the ADE7763. You can follow my blog at www.fll-freak.com/blog to read about my experiences with the chip. Its great. It works. Its much more accurate than rolling your own. My project is currently stalled waiting for some time to design the final boards to be sent out for fab.
You should check the data sheet for the PIC you are using, as the input conditions are probably violating the requirements for the ADC VREF and input impedance. For example, the 18F2455 has a minimum VREF of 1.8 V for 3.0 V supply voltage, and the recommended source impedance is <= 2.5 Kohms.
You guys are giving me a lot of great info - thanks for taking the time to post.
I checked the datasheet for the 18F2550 shows Vref+(delta) minimum is 1.8V, the minimum Vref- is Vss.
As far as the impedance goes, since the CT has an impredance of 250ohms, does the burden resistor matter for the sake of calculating the source impedance?
I want to keep the parts count low and the design simple (a man’s got to know his limitations) so I was hoping to avoid the opamp. I just need to be able to tell when a switch is closed (operating a septic tank pump) and when a pump is running whether the relative load is abnormal (don’t need very high accuracy).
The rule for two parallel resistors is 1/Req = 1/R1 + 1/R2, so 1 Mohm can be ignored relative to 250 ohms. However, the voltage divider has an impedance calculated by the same formula, and this is in series (additive) with the 250 ohm CT winding.
The standard deviation under a 40W load is 3x the standard deviation under no load. This should be enough for me to pick out in firmware to detect if a device is operating on the AC line.