Here is a major redesign. it seems to work well, and I think is more "solid" than the discrete design we were working on, especially the current sense circuit.. The timing on the input current source and the pushbutton switch are just for simulation purposes.
Your TL431 circuit was only putting 2.5V on the comparator. I changed it to 5V. You don't need that NPN with the TL431.
I also simplified the switch that turns on the battery charger.
The current sense amp has a gain of 20V/V, so with 15mA and 26mA, the sense amp output levels are 15mA*8.2Ω*20=2.46V, and 26mA*8.2Ω*20=4.26V. The sense resistor was chosen to keep the output below 4.8V, which is the AD8211's maximum output voltage. U1b slices the sense amp's output ≈halfway between the 15mA level and the 26mA level to drive the relay and set the FF. U1c slices ≈halfway between 15mA and 0mA to reset the FF when the pushbutton is pressed.
Note that all the comparators have power pins. This is only for simulation. The actual IC is a quad comparator, LM339, and only has one set of power pins.
The CD4001 power pins don't show, but it is a quad NAND gate, and only has one set of power pins (Vcc and GND).
LTspice is free, and is not castrated like student or demo versions of commercially available simulators. It is very powerful, and when you get good at using it, you can add models from IC mfrs, create new symbols, etc. The learning curve is pretty steep.
A simulator should NOT be used to "design" a circuit. If you don't understand circuit design, a simulator will probably lead you astray. I use it to verify my designs, and to help me discover subtle "gotchas" which I might have missed.
Your TL431 circuit was only putting 2.5V on the comparator. I changed it to 5V. You don't need that NPN with the TL431.
I also simplified the switch that turns on the battery charger.
The current sense amp has a gain of 20V/V, so with 15mA and 26mA, the sense amp output levels are 15mA*8.2Ω*20=2.46V, and 26mA*8.2Ω*20=4.26V. The sense resistor was chosen to keep the output below 4.8V, which is the AD8211's maximum output voltage. U1b slices the sense amp's output ≈halfway between the 15mA level and the 26mA level to drive the relay and set the FF. U1c slices ≈halfway between 15mA and 0mA to reset the FF when the pushbutton is pressed.
Note that all the comparators have power pins. This is only for simulation. The actual IC is a quad comparator, LM339, and only has one set of power pins.
The CD4001 power pins don't show, but it is a quad NAND gate, and only has one set of power pins (Vcc and GND).
LTspice is free, and is not castrated like student or demo versions of commercially available simulators. It is very powerful, and when you get good at using it, you can add models from IC mfrs, create new symbols, etc. The learning curve is pretty steep.
A simulator should NOT be used to "design" a circuit. If you don't understand circuit design, a simulator will probably lead you astray. I use it to verify my designs, and to help me discover subtle "gotchas" which I might have missed.
Attachments
-
8.1 KB Views: 13
-
60.7 KB Views: 23