> I've completed a small hardware and software project and I wanted to > share > it with other piclist'ers. I bought a cheap UPS that doesn't have an > AC > power monitering output that I could hook to my PC, so I've ended up > making > one. The software assumes Linux/Unix, but the hardware is OS > agnostic. Only > a serial port is needed for the PC interface. > I would be interested for folks to look over the schematic for me. > Analog > design isn't my strong point and while the circuit works there is > one point > of its operation I'm not happy with. I would like the output of the > circuit > to match as much as possible the full RS-232 voltage swings. When AC > power > is present the output is 8-9 volts, but only goes as low as -1 volt > without > AC power. I would like the negative voltage swing to be greater, but > I've > not thought of a good way to do that yet. Input would be welcome. The reason you are not getting much negative swing is because R3 is returned to ground and not to DTR. Connect this to DTR and you will get full swing. At present, when Q1 is off Q2 base is at about ground and emitter can only fall to about -0.6v before Q2 turns back on. Note that the FET gate has 24v applied when the opto is on. Ensure it is happy about this. Some wouldn't be. I can't imagine that you really need Q1 at all. If you don't mind the extra components then using the FET as you are doing now (subject to comments above ) makes the design easier and dissipates less input power. But - if you want to save a transistor and some Rs: Change R8 to 10k (or even higher), remove R5 and Q1, return R3 to DTR and connect R8 left hand end to Q2 base. You may need some playing with the values of R8 and the drive to the 4N28. The FET Q1 does help make this less critical. At present you have 120V and 1M so say 100 UA peaks (actually more). If the opto has a CTR ("current gain" of 10% (as per spec sheet) then you get 10 uA peaks out of the opto. R4 would need to be 1M. Getting a bit tight. BUT input power is 120^2/1m ~= 15 mWatt! Reducing R2 to 100k gives 150 mW - choose R2 suitably. Now you get 1 mA + pulse to the opto and 100 uA out and with R4 = 1M you can have the better part of 100 uA drive to the transistor. If Q2 has a beta of 100 (modest) you drive DTR with 10 mA ability which should be heaps. RM -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist