w. v. ooijen / f. hanneman wrote: > - include a small relay (powered from the wall wart) which switches > from battery to mains > - use a switch: one side to the battery, the other side to the mains: > doubles as on/off when you pull out the mains. Michael Rigby-Jones wrote: > Or you could even use a power socket with an NC switch built into one > of the contacts, as most fo them have. Much easier, it's what the > vast majority of mains/battery appliances use. (Although their long > term reliability is not terrific) Both these (or all 3) have a problem. I'm just wondering whether he really wanted a "no-break" switching to retain its RAM contents? My feeling is that you use a (Schottky) diode from the battery and a bridge (or half-bridge) rectifier from the power transformer which presumably will produce a somewhat higher voltage than the battery. It doesn't have to be much higher though, as having the reservoir capacitor *after* the diodes guarantees that any supply from the mains keeps the battery diode biassed off. This presumes either that the PIC can tolerate the higher supply voltage or you use a low-leakage regulator and that in either case, low leakage reservoir capacitor after the diodes. This is where things actually become complicated. You don't generally need a switch in the mains supply; it almost certainly uses so little power (or shuts itself down) that you can afford to leave it running. If it has no shut-down function, you will however want a battery on/ off switch, but this can be a simple single pole. OTOH, you could place the switch between all the diodes and the reservoir capacitor. -- Cheers, Paul B.