On Wed, Mar 24, 2004 at 02:29:24PM +0200, Lucian wrote: > The purpose of the comparators is to do some line supervisory. If the > wire is cut or if it is shortened, the alarm goes on. Is there any > simpler solution ? Sure there is. You're using a PIC which presumably has ADC. You can get an exact value reading the wire voltage using the ADC. This completely eliminates the need for a comparator, though you may still need an opamp circuit to drop the voltage to a reasonable range. The exact circuit you need is listed in Figure 3-17 of this Motorola alarm system design document on page 44: http://e-www.motorola.com/files/microcontrollers/doc/ref_manual/DRM008.pdf They simply power the line with Vcc, which is presumably 5V. But even if you powered it from the unregulated battery voltage, you only need very minimal regulation. Here's what I'd do: 1) Create a minimal 9V supply using a low valued resistor (200 ohms) and a 9V zener. Then tie 5K pullup resistors to that supply, represented by the R25 in the diagram. 2) Use 2.5k resistor for R1, 1K for RS and tie a 5V zener across the each alarm line between RS and the 5K pullup. So here's that happens in the 4 states: OK (armed): 1.5V line voltage 9V * 1K/(1K+5K) ALARM: 3.7V line voltage 9V * (1K + 2.5K)/(1K + 2.5K + 5K) SHORT: 0V CUT: 5V clipped by the 5V zener. With that much separation it's easy to figure out the alarm state. And by using the higher voltage (instead of the 5V regulated line), you can get a full range of values from 0-5V. Finally if you have multiple doors/windows in an alarm circuit, you can put different values of resistors across the switches so you can detect exactly which door/window switch is open. The PIC has the tools to pull this off, why not use them? No need for comparators at all. > Most of the sensors accept voltages between 9V and 16V. So I think they > could be powered from 13.8V unregulated. Right. > The battery could be charged with 13.8V with minimum circuitry (when it > has reached the maximum capacity, stop charging, and when it has > discharged under some value, disconnect it from the load). No need if the line voltage is 13.8V. You can charge indefinitely at that voltage. So other than maybe a simple power shunt to keep the voltage below 13.9V or so (safety feature), you need no control at all between the line voltage and the battery. And you never want to to disconnect the battery from the load. That's the only way not to have it glitch. Line feed battery, battery feeds regulator, nothing ever switches. > From the 13.8 > unregulated, feed a 5V regulator. Did I understand correctly ? That last part yes. > The values for current (3A for each) are the maximum needed values, the > circuit won't necessary draw so much current. Shouldn't matter as long as the regulator can handle it. Batteries are designed to dump hundreds of amps of current if necessary. Thanks for the discussion. It gave me a few minutes to formulate exactly how to handle the alarm line issues for my alarm. BAJ -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.