Measuring Voltage from battery whilst keeping it isolated? - Page 1
Forum section: electronics / projects

author: lja246
author_rank: Contributor
timestamp: December 09, 2022, 04:11:59 am
content: Hi all,I'm trying to make a circuit for a caravan that can connect the cars battery to the caravans battery and then disconnect it in certain situations. I am trying to figure out how to measure the voltage of the cars battery as I will be using N-channel mosfets to connect the two, so the positive rail will always be connect and only the ground connection will be interrupted. Is there any way to measure the cars voltage whilst keeping it isolated as any connection from the micro controller's ground to the car batteries ground will complete the circuit and make the mosfet's useless.I was thinking maybe I could use an external ADC and use it in differential mode however, i'm unsure if it would keep the batteries isolated.

author: ledtester
author_rank: Super Contributor
timestamp: December 09, 2022, 04:20:57 am
content: Can you provide a schematic of the situation?It seems you could always use a separate mcu for each battery and have them communicate over an isolated link.Update: There's also this recent thread which touches on the same topic:https://www.eevblog.com/forum/projects/reading-a-voltage-which-is-grounded-to-a-different-potential/In reply #6 some "exotic" ideas are mentioned:Quote from: Wolfram on October 06, 2022, 02:39:02 pm

author: lja246
author_rank: Contributor
timestamp: December 09, 2022, 05:48:39 am
content: The project is still in the idea phase at the moment so I haven't got a proper circuit drawn out but here is a quick circuit.The caravan battery will always be connected and used to power the micro controller which will be an ESP32 and the car battery will be connect or disconnected using the mosfets. The car battery is the one that I am interested in measuring. If I was to use a separate controller to measure the voltage and then communicate it to the esp32 with optical isolation for example, could you suggest a cheap controller for this and an isolated form of communication?

author: inse
author_rank: Super Contributor
timestamp: December 09, 2022, 07:23:12 am
content: Keep in mind that you need a floating supply for the gate driver of the back-to-back MOSFETs.A (bistable) relay is not an option?

author: Kleinstein
author_rank: Super Contributor
timestamp: December 09, 2022, 07:44:39 am
content: A 2nd controller would be an option, but quite complicated.As the 2 batteries are connected at the positive side, they are not really isolated. One can measure the voltage in the car battery quite similar to the caravan battery. The initial point to measure would be the difference between the 2 batteriesm which is the voltage over the 2 MOSFETs. Use a voltage divider and maybe difference amplifier. It may need some care with the protection, because the car system is only 12 V nominal, but can still have quite some voltage spikes from switching large loads and inductive kickback.

author: pcprogrammer
author_rank: Super Contributor
timestamp: December 09, 2022, 07:46:41 am
content: Maybe I'm totally off, but is a car battery not connected to the chassis with its negative terminal (ground) and as such connects the caravan chassis to this ground when hitched on to the car?And would it then not be better to have the switched coupling between the positive terminals?Also what is the purpose of this connection? Charging the caravans battery or raise the available power?

author: pcprogrammer
author_rank: Super Contributor
timestamp: December 09, 2022, 07:49:39 am
content: Quote from: Kleinstein on December 09, 2022, 07:44:39 amThere are probably loads of examples on wireless connections between two ESP32 boards, so using one to measure the car battery and another for the caravans and using a wireless link to communicate the results is not that big of a deal.

author: coromonadalix
author_rank: Super Contributor
timestamp: December 09, 2022, 03:23:05 pm
content: use an ssr relay it will automatically give you isolated control linesyou have miniatures volts and amps displays who could fit pretty well in a dash, or some are wireless enabledsome of them don't need an isolated supply, they will feed over the sourceand normally the frame of the vehicle is grounded, and or ground level, sometimes you see flexible braid strap between the frame and the motor

author: mawyatt
author_rank: Super Contributor
timestamp: December 09, 2022, 04:27:15 pm
content: Quote from: pcprogrammer on December 09, 2022, 07:46:41 amMost cars we've seen have a battery negative to chassis ground, which as you say could complete the negative connection when the trailer hitch engages if both sides are at chassis potential.Agree, using the + battery seems like a better solution, either by means of a regular relay or Opto-relay.Best,

author: bdunham7
author_rank: Super Contributor
timestamp: December 09, 2022, 05:25:37 pm
content: Reading an isolated battery can be accomplished by using a TL074 and a few resistors, just look up a typical differential probe circuit to get the idea. It won't be totally isolated but if you use 2x 1M resistors as input voltage dividers you'll be close enough. However, unless all the the electrics in your caravan are totally isolated, I don't see how are going to manage to keep your grounds isolated between the car and the trailer. It sounds like a sparky idea. You're going through all this just to avoid using a high-side switch?

author: Zero999
author_rank: Super Contributor
timestamp: December 09, 2022, 05:49:39 pm
content: A small relay and capacitor? Switch on the relay to take a sample. Choose high values for the potential divider, so they don't draw much power from the circuit being measured.

author: lja246
author_rank: Contributor
timestamp: December 09, 2022, 08:05:18 pm
content: Thanks everyone for the replies,I already tested the caravan and I found that the negative of the battery isn't connected to the chasis but you all raise a good point about just switching the high side to make it easier.I think i'll go with a latching relay to break the positive rail but i'm unsure about what rated relay I should use to deal with the inrush current. It is possible that the caravan battery can be as low as 11v and the car battery be at 14.4v and since I can't really measure the resistance between the two connections I can't determine the inrush current.Does anyone know roughly what type of inrush current I'd be looking at here because in my experience its never really the continuous current draw that kills the relays, but it's usually the inrush current.Also if there are any suggestions about another way of high side switching I'm all ears.

author: bdunham7
author_rank: Super Contributor
timestamp: December 09, 2022, 08:49:59 pm
content: Quote from: lja246 on December 09, 2022, 08:05:18 pmWhat is the maximum current you want to draw from the car to charge the caravan battery?

author: ledtester
author_rank: Super Contributor
timestamp: December 09, 2022, 09:18:59 pm
content: In searching for "trailer charger" I came across what is called a "trailer breakaway kit":Quoteand you can see a teardown of one in this video:Trailer Breakaway Kit - Unboxing - With Some Explanation. -- SyEnsabilityhttps://youtu.be/rU3161yks5UAt around 2:30 you can see that the battery has it's own charger PCB. So in this design you have:Code:main battery ----- charger pcb ----- trailer batteryand they are always connected (normally).

author: lja246
author_rank: Contributor
timestamp: December 09, 2022, 09:36:55 pm
content: Quote from: bdunham7 on December 09, 2022, 08:49:59 pmI'd say probably 10 - 15 Amps max from the car battery ideally but I'm not sure how to regulate the current as the relay will just act as a simple on/off switch and I wouldn't be able to use PWM or something.

author: bdunham7
author_rank: Super Contributor
timestamp: December 09, 2022, 09:41:21 pm
content: Quote from: lja246 on December 09, 2022, 09:36:55 pmSince you wanted to have an ammeter, just use a 0.1 ohm shunt in series with a 20A or 30A circuit breaker. Your inrush will be limited to ~30A and you wouldn't be likely to see more than 15-20A unless you have a large load on the caravan battery, in which case the breaker will pop and you can take care of whatever the issue is.

author: inse
author_rank: Super Contributor
timestamp: December 10, 2022, 04:29:59 am
content: @coromandelixNon polarized DC SSR, do they exist?An AC SSR would not be suitable as the incorporated TRIAC will not switch off until the load current drops to zero.

author: Zero999
author_rank: Super Contributor
timestamp: December 10, 2022, 05:43:48 pm
content: Quote from: inse on December 10, 2022, 04:29:59 amAn SSR with two MOSFETs connected back-to-back will work with DC of either polarity.https://www.infineon.com/dgdl/Infineon-PVN012-DataSheet-v01_00-EN.pdf?fileId=5546d462533600a401535683f185294dhttps://www.vishay.com/docs/81646/vo14642a.pdf

author: Terry Bites
author_rank: Super Contributor
timestamp: December 10, 2022, 07:32:32 pm
content: Use a low cost isolated ADC like an AD7400. A zener and a few resistors and your done.Well, you might want to arange to wake it up a few times an hour to reduce battery drain to zero. A cmos 555?

author: inse
author_rank: Super Contributor
timestamp: December 10, 2022, 09:10:54 pm
content: I feel like this discussion is leading nowhere…Take a step back and think of a simple reasonable solution.Why do you need a uC to decide how to connect the batteries?

author: lja246
author_rank: Contributor
timestamp: December 10, 2022, 10:30:05 pm
content: As the cars battery is directly connected to an Anderson plug at the towbar the caravan plugs into that, there is no low voltage protection for the vehicle so on a few occasions the vehicle has struggled to start because both batteries have been drained so when the voltage reaches a certain value i'd like the vehicle to disconnect first so there's no issue with starting it. There have also been occasions where a large current will flow from the caravan battery to the vehicle when starting so if it detects that there is a reverse current flow i'd also like them to disconnect. And it will kind of be integrated into a smart system that's in the caravan already so i'd figured i'd just basically add onto that.

author: ledtester
author_rank: Super Contributor
timestamp: December 11, 2022, 04:08:56 am
content: The "trailer breakaway kit" solves these problems with a battery charger. I'm sure there is a battery charger which can handle:- main power source not connected- main power source voltage < battery voltageas well as performing safe charging when these conditions are not present.

author: ledtester
author_rank: Super Contributor
timestamp: December 11, 2022, 06:58:47 am
content: Ok, I just thought of one scenario you still have to consider:- main power supply connected but battery is being usedShould the charger be connected to the battery? Maybe you don't want to be charging the trailer battery if it also is being used -- something to consider.

author: inse
author_rank: Super Contributor
timestamp: December 11, 2022, 07:09:52 am
content: An automotive relay that switches the Anderson connector when the motor is running does not solve the basic problem?Or if you want to mount it on the caravan side, a simple Schmitt trigger or voltage monitor that connects at >13V car voltage and disconnects below.

author: lja246
author_rank: Contributor
timestamp: December 12, 2022, 04:04:04 am
content: I think i'll just go with a relay that switched the high side and I can use a normal voltage divider to measure the voltage of the car battery. I'll have the relay controlled by a micro controller that can communicate with the "smart system" that's already in the caravan.

author: NiHaoMike
author_rank: Super Contributor
timestamp: December 12, 2022, 05:16:57 am
content: Quote from: lja246 on December 10, 2022, 10:30:05 pmHave a manual override for when you intentionally want the reverse current in order to do a jump start.