I was going to make a similar type of unit for measuring Car battery charge/discharge. It looks pretty easy until you try it !!!! Measuring current flow one way is easy, use one side of the shunt as ground and the other to a Pic A2D for the current sensing, by adding the current / time you can sense the charge. Problem is when the current flows the other way round, you get a negative voltage which the pic cant handle. One idea I had was to amplify the voltage across the shunt using a single rail opamp. Lets say there is a 10mv drop across the shunt per Amp drawn. Using an opamp to amplify this by 100 would give 1v/Amp output. Feed this into an A2D input on the pic and you've got say a charge current. For sensing the discharge current, use an opamp grounded on the other side of the shunt with the same amplification, you'll get a slight offset of the voltages but in theory, I cant see why it wouldnt work. As I said, its easy to sense one way but to try to sense both ways appears to be a bit of a pain. If you come across any easier solution (i.e. running the pic from a split rail supply) then let me know :-) Regards Dom ----- Original Message ----- From: "John Nall" To: Sent: Monday, June 23, 2003 4:39 PM Subject: [PIC]: Counter for how many amps a battery is down > My sailboat has (or at least had) a battery monitor on it. You start with > a full battery, and this monitor displayed a number which represented how > many amp hours had been used. (Usually a negative number, but you could > overcharge the battery and have a positive number). Alas, my monitor seems > to have been murdered. :-( > > The boat took a lightning hit while in the slip, and apparently some of the > electronics in the monitor got zapped. Although I could buy another one, a > large part of the cost is the shunt, which was not harmed. They won't sell > the unit without the shunt, so I figure I should be able to use a PIC to > build another monitor. The shunt is just a resistor, and is described as > follows: > "When current flows through the shunt, a small voltage is developed across > the shunt which is proportional to the current flow. The battery monitor > accurately measures this very low voltage and converts it to the "amps" > reading on the meter. The resistance, which is the ratio between the > voltage across the shunt and the current flowing through it, is a constant > for any particular shunt" > So the PIC would measure the voltage coming from the shunt and use that to > calculate the corresponding current, and use a timer to convert to amp > hours. The shunt itself is a dual MKB-500/50 (the dead monitor was a Link, > made by Heart Interface). > > NOW, please don't flame me for not having a specific, detailed question to > ask!! I merely want to know if someone on the Piclist might have done > something like this, or have information that would be helpful to me in > designing and building such a critter. If so, would appreciate such info > -- offline or online, as you choose. :-) > > Thanks, > John > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.