How to use this comparator circuit with an MCU? - Page 1
Forum section: electronics / projects

author: YoTech
author_rank: Contributor
timestamp: March 29, 2018, 06:30:30 am
content: How to use this circuit with an MCU?

author: ataradov
author_rank: Super Contributor
timestamp: March 29, 2018, 06:54:52 am
content: Why? Most MCUs have ADC, just digitize the voltage.If you want to use that specific circuit,then just connect outputs of the comparators to the MCU input pins though some voltage converters (simple resistor divider will work).

author: BrianHG
author_rank: Super Contributor
timestamp: March 29, 2018, 07:37:21 am
content: Where the LEDs are connected, change the voltage from +Bat to your MCU vcc. Remove the LEDs, replace with shorts, and change all their resistor values to either 10k or 100k and wire the 4 comarator outputs to the MCU inputs.Though, using your MCU ADC is a much better solution and it uses only 1 ADC input pin and 2 resistors.

author: Zero999
author_rank: Super Contributor
timestamp: March 29, 2018, 08:05:05 am
content: I take it this is about the same projected as the thread linked below?https://www.eevblog.com/forum/beginners/ground-problem-when-monitoring-2-batteries-in-series/msg1464453/#msg1464453If so, then why create another thread? If you keep it to the same thread, then people will know what you're trying to do.Anyway, I told you before: use opt-couplers to interface the isolated circuit to the MCU.

author: YoTech
author_rank: Contributor
timestamp: March 30, 2018, 11:35:32 am
content: The post is edited.Originally if there was a real ground (not the bottom battery's "-") I was asking the same question, but it was unclear what will the ground (1 PCB layer) do. If there were 2 separate grounds (1 layer for each ground is what I was thinking, the block diagram is "with grounds.jpg" in this post) I could have put the upper battery's voltage divider to 1 ground without connecting it to the upper battery's "-" and connect the lower battery's voltage divider to a second ground, so even when the switch between the 2 battery's is turned on, the voltage divider of the upper battery will be functioning without the 12V from the lower battery being applied? Now the problem escalated to this:The problem is this (block diagram in this post, files: "no.grounds.jpg" and "without.grounds.jpg"). The 2 batteries will have a switch between them, to only disconnect the upper battery's "-" from the lower battery's "+" when the load (24V) is disconnected, and charge them separately (1 battery to 1 charger). In this case, what will happen to the voltage divier for 24V ("2.batteries.off.on.block.diagram.jpg")? Also its impossible to use a voltage divider for the upper battery (connected to the upper battery's "+" and upper battery's "-"), as when the 2 batteries are in series (24V), the voltage applied on the upper battery's voltage divider will be 13V (connected to top battery's "+" and top battery's "-", because if we have resistors with a battery under them, the voltage of the battery under them is also applied. I hope this makes it clear. On the other file ("Switch.batteries.comparators.pdf") I have the 2 analog comparator monitor circuits (for each battery of 12V) and I am hoping that everything is ok, but I think on the dividers a higher voltage will be applied again when the switch is on?Voltage dividers:https://www.dropbox.com/s/b91za1bkvqaxfzq/2.batteries.off.on.block.diagram.jpg?dl=0Comparator circuit:https://www.dropbox.com/s/x4bu332c0eloz7k/Switch.batteries.comparators.pdf?dl=0No grounds block diagram:https://www.dropbox.com/s/fllotw5yuljd6hs/No.grounds%20%282%29.jpg?dl=0With grounds block diagram:https://www.dropbox.com/s/wzvv5hjhghkfciy/With.grounds.jpg?dl=0

author: YoTech
author_rank: Contributor
timestamp: March 30, 2018, 12:14:14 pm
content: Is it possible to connect 2 chargers. while the batteries are still in series? 1 charger per battery?

author: Zero999
author_rank: Super Contributor
timestamp: March 30, 2018, 06:12:52 pm
content: Quote from: YoTech on March 30, 2018, 11:35:32 amPlease attach the files, rather than using an external upload service.Putting the reverse protection diode in series with the negative rail of the comparator IC, is a bad idea.The ground point is just a common reference from where all voltages are measured from. It's possible to have more than one ground reference node, at difference voltages, relative to one another.Just build two separate circuits, without connecting their grounds together. As I keep saying, if you need to tell which LED is on, using a microcontroller, use an opto-coupler. If you don't know what that is or how to use it, then use a search engine. Post a schematic and I'll review it.Quote from: YoTech on March 30, 2018, 12:14:14 pmYes, if the charges are powered from isolated power supplies.

author: YoTech
author_rank: Contributor
timestamp: April 01, 2018, 10:48:36 am
content: Here is the circuit for isolated power supplies. It should work. However I am certain that it willl not be that good, most likely both chargers are plugged to 1 extender, so I dont hope for isolated power supplies. What should I do in that case? (Maybe something like a rail splitter, so I can have a second ground compared to which to measure. Or some OPAMP in order to measure only the voltage drop over the resistor of the upper battery.I post the files as an external link, because they are too big.https://www.dropbox.com/s/r6hrg1h8k0xatms/66.V.1.2.jpg?dl=0

author: YoTech
author_rank: Contributor
timestamp: April 01, 2018, 12:24:20 pm
content: As far as I understand isolated power supplies means 2 phases? Given that in Europe the system is 3 pahes, 1 ground, 1 zero, the groud will be common again?Edit: here are the 2 circuits as prommised. On the circuit where the MCU is drawn, we have 4 relays to control which divider will be sampled. There are 2 batteries, but they will be connected either in series, either separately, so I put 2 relays and 2 connectors on each side for each option.The idea behing the circuit where there are only resistor dividers is that the series part is never broken, but there will still be an MCU and 2 relays to sample the voltage.I put them as dropbox links because they are too big and 1000KB is not enough.MCU is drawn circuit:https://www.dropbox.com/s/yuxkuf06l8xuopp/V.2.2.jpg?dl=0Resistor dividers are drawn only:https://www.dropbox.com/s/tnymwld6mahgb63/V.2.3.jpg?dl=0

author: YoTech
author_rank: Contributor
timestamp: April 01, 2018, 02:55:57 pm
content: Sorry for the multiple posting.Do you think this charger is isolated: ABC-1220D by FST. I dont think it has a transformer inside, unless its some impulse transformer and I dont know if that counts as a isolation.Is there any way to use optio couplers in my circuit in order to achieve the isolation I need?EDIT:This is the latest ciruit, but it still takes 2 grounds (they are in different colour).EDIT.2:This is the charger that I will use, it should work even when charging the batteries while they are connected in series.Description of ABC-1220D FST:Short-circuit Protection: Charger O / P cut-off automatically when short circuit. Overload Protection: Charger O / P current-limited automatically when overload. Reverse Polarity Protection: Charger O / P cut-off automatically when batteryreverse connection. Automatic multi-rate charging function: Equalizer Charge and Floating Charge. Parallel Operation Available: Parallel with Battery as DC Power Supply operation available. Unique LCD Display: Indicating both charger status and battery level. 3 LED Display: Red (Power On) , Green (Floating charge) and Yellow (Equalizer charge). Advanced SMD Technology: Reliable and Elegant.Link:https://www.battery-import.eu/p/fst-abc-1220d-12v-20aEdit 3: The other option for a circuit:https://www.dropbox.com/s/r6hrg1h8k0xatms/66.V.1.2.jpg?dl=0

author: YoTech
author_rank: Contributor
timestamp: April 01, 2018, 07:08:13 pm
content: I have to be done with this by Tuesday, so help is appreciated.