![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
pandu.ranganadh
Joined: 28 Apr 2008 Posts: 12 Location: hyd
|
Problem with Multiple ADC channels |
Posted: Sun May 04, 2008 7:40 am |
|
|
Hi
I am using PIC16f877 controller, I have downloaded ccs compiller at 1 month back, I am using PIC demo old board.
My aim is, Read voltage and current from power supply and display on LCD which is built in LCD.
I have successfully displayed voltage on LCD. link is
http://www.ccsinfo.com/forum/viewtopic.php?t=32168&start=1
Next i need to display current, Please tell me how to display current.
I have connected power supply to ADC channel-0.
Is there any modifications in Circuit connections ?
Please send me replay with sample code.
Thanking you,
Bye. |
|
![](templates/subSilver/images/spacer.gif) |
filjo
Joined: 29 Apr 2008 Posts: 9
|
|
Posted: Sun May 04, 2008 9:07 am |
|
|
Hi
PIC dont meter current but if you need meter current is easy...
Put on your circuit one resistor very very litle +-0.1Ohm and use for your calcs U=R*I and you have I=U/R, you have voltage and you know resistor, is easy display current...
you have make a new program and put more ADC ports...
EDIT:atention because power of resistor buy one resistor with 10 or more watts...
regards |
|
![](templates/subSilver/images/spacer.gif) |
foodwatch
Joined: 18 Apr 2006 Posts: 66
|
|
Posted: Sun May 04, 2008 10:51 am |
|
|
There are two ways to measure current using the small value resistor suggested in the earlier post. The problem is you must measure the voltage drop ACROSS the resistor and not to ground which is how the PIC usually works. You can either remove the - ref from ground or the easier way is to use two adc ports and measure each side of the resistor against ground, then subtract the load side adc value from the source side adc value and the difference is then divided by the resistor value in ohms.
For example, if you use a .1 ohm resistor and measure 5.00v on one side and 4.90 volts on the other. .10v/.1ohms = 1 amp. The problem here is the adc resolution. At 5v VCC and using the max resolution of 10 bits, the smallest step you can measure is .00488 volts and noise may be an issue at this level. By increasing the resistor value to 1 ohm, you could get an adc step size of around 100ma. If you increse the resistor value more, at some point the series resistor reduces the output voltage which may be of some concern. If you choose to sample current before the voltage regulator, be EXTREMELY careful as the PIC is not happy at all when the ADC input voltage exceeds the PIC's VCC.
You don't mention how much current you would exopect to draw and what kind of resolution you need when reading it.... This would greatly effect a design strategy. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Sun May 04, 2008 2:29 pm |
|
|
It is worth realising, that all modern current meters, basically read voltage. The internal modules are ADC's feeding LCD displays, typically with resistors used to convert current to voltage, just as has already been mentioned. The big problem is also outlined though, that you either need the sensor itself running off a separate supply (as in the DVM normally), or need significant signal processing in front of the ADC input (you will almost certainly need some, to bring the voltage derived from the sense resistor 'up' to a sensible level anyway...). One alternative suggestion, which has the advantage of providing isolation, is a Hall effect sensor IC. In the past, these were complex, and expensive, but nowadays, quite reasonably priced chips are available, that give a voltage output directly related to a magnetic field. Allegro, make devices, that are reasonably priced, and give a nice voltage output for a given current. Also, TI, make current sensor IC's, that carry all the processing needed to sense the voltage across a resistor on the +ve RAIL, and give an output in the voltage range needed by the PIC.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
filjoa
Joined: 04 May 2008 Posts: 260
|
|
Posted: Sun May 04, 2008 4:11 pm |
|
|
Hi
PS: I'm a user "filjo" but my correct nick name is "filjoa" if is possible admins remove nick "filjo", thanks
Ttelmah, I don't remember this IC's I read litle about this... you know some references of this IC's? |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Mon May 05, 2008 2:32 am |
|
|
The Allegro devices are the ACS712 to 715 (and higher accuracy versions in the ACS75x). The Texas devices are the INA19x and 138/139 168/169.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
Ken Johnson
Joined: 23 Mar 2006 Posts: 197 Location: Lewisburg, WV
|
|
Posted: Mon May 05, 2008 6:41 am |
|
|
"It is worth realising, that all modern current meters, basically read voltage"
Ttelmah, it struck me as I read this that all our "old" voltmeters (the moving coil variety), actually read current!
Fascinating
Ken |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Mon May 05, 2008 7:01 am |
|
|
Yes, I was going to say that most meters read voltage, then realised exactly this...
The impedance was high on most, so you could almost treat them as if they did read voltage, the current through the meter itself was so small, but it is one of those 'changes of principle', that has 'sneaked up' on us in the last few decades.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|