I am making a speed controller with current-logging and am using the hall-sensor approach. Basically I have a sensor with 3 mV/Gauss sensitivity and at 5v supply it will be nominally at 2.5v out with linear operations to 0.5 and 4.5 volts. Since I will be measuring large currents I use a thick wire through a ferrite toroid and have a slit in the toroid where the sensor is glued in. I don't wind the wire on the toroid as it needs to be too thick. Don't know how well this will work yet, but I had the foresight to add a amplifier with adjustable gain so I can amplify to correct signal-strength before before having to read it with the PIC. This setup registers both posetive and negative current. Kyrre ----- Original Message ----- From: "Dwayne Reid" To: Sent: Sunday, June 20, 2004 11:21 PM Subject: Re: [EE]: Current sensing > At 05:08 AM 6/20/2004, Philip Pemberton wrote: > > >OK, so the gist of it is, I want to do something like this: > > > >Battery |-X-** R **-----Ground > > | > > | ------ > > ---------> opamp\-----> PIC A/D In > > |______/ > > > >So, rather than getting -1V to +1V at the resistor/battery junction, I get 0V > >to 2V from the opamp's output, which gets fed to the PIC. > >Now, the clincher is, I know I can get the opamp to shift the voltage, but > >that requires a negative supply. Is there any way to do the shifting with > >just Vcc and ground? > > Yep - easy as pie. There are several easy circuit configurations - I'll > describe one. > > Configure your op-amp stage as an inverting amplifier with whatever gain > you desire (eg. -10). In other words, voltage from current sense resistor > gets fed through a resistor to the (-) input of the op-amp. Feedback > resistor is from op-amp output back to (-) input. Gain is the ratio of > feedback resistor over input resistor. > > Now offset the (+) input of the op-amp to a positive voltage. Use a > resistor divider from some regulated supply such that the (+) pin is at > whatever voltage your want the zero current point to be. For example, if > you wanted the zero current output voltage to be 1V. If the gain is -10 > and you want the idle point to be 1V, the desired offset at the (+) pin is > 1V / 10 = 0.1V. Notice that this voltage needs to be stable - if it > drifts, so does the zero current point (offset). > > Now you have a setup where the op-amp is idling (offset) at 1V. As your > circuit begins to consume current from the battery, the op-amp voltage > increases above the idle point. The current consumption is the amount of > increase above that idle point. In other words, I= (Vout - Voffset) / > (Resistor * Gain) > > If the battery is charging, the op-amp voltage decreases below the zero > current offset. Charge current is the amount of decrease below the idle > point. I= (Voffset -Vout) / (Resistor * Gain) > > In other words, all you have to do is introduce an offset into your amplifier. > > The easiest way to calibrate this is to short the current sense resistor - > this allows you to measure or adjust the idle voltage. > > The op-amp has to include ground within its common mode range - op-amps > that do this are usually described as "single supply" op-amps. You want to > pick one that has fairly low Input offset voltage - one that comes to mind > is a LT1013. There are *many* other choices. > > Hope this helps. > > dwayne > > -- > Dwayne Reid > Trinity Electronics Systems Ltd Edmonton, AB, CANADA > (780) 489-3199 voice (780) 487-6397 fax > > Celebrating 20 years of Engineering Innovation (1984 - 2004) > .-. .-. .-. .-. .-. .-. .-. .-. .-. .- > `-' `-' `-' `-' `-' `-' `-' `-' `-' > Do NOT send unsolicited commercial email to this email address. > This message neither grants consent to receive unsolicited > commercial email nor is intended to solicit commercial email. > > -- > http://www.piclist.com hint: PICList Posts must start with ONE topic: > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.