Battery back up

Hello,

I have an esp8266 and i want to be to detect when psu voltage is lost (12v) and then get power from a 9v battery.

I am using a schematic like this:

Before i hooked up the battery, i took a voltage reading of the battery terminals and i got 11.3v. It save to connect the battery or have i made a mistake some where? (i was expecting zero volts).

OK, I see what you are doing (I think ) Assuming you have 12v or so on the DC jack, then the terminals that would connect to the "battery" could give you a funny reading. You are probably reading it with a high impedance voltmeter and the diodes are a little bit leaky. Put a 100k resistor across the battery connector in your diagram (without the battery connected) and see what voltage you are seeing. The other possibility is you have one of the diodes (like the one from the "battery") in backwards.

SO, i didn't have a 100k resistor, but i had two 48k resistors so i put them in series and put one end to the positive and the other to the negative of the battery terminal and got 400mv.

do you think i'm ok to install the 9v? (i'm assuming the battery acts like a very high resistor similar to to the 100K?

Should be OK. Sounds like the diodes are leaky. 100k (or 96k in your case) is a very slight load and if that takes it down from better than 11 volts to less than 1/2 volt we are only looking at leakage (about 4 uA). Looking at a datasheet for a 1N4001 (50v 1A diode), it says typical 5 uA at the rated voltage of 50v reverse leakage.

A DMM has a typical input impedance of 10Megohm.
You are measuring 11.3uA leakage across 0.7volt.
Could be almost 50uA into your 9volt battery.
Seems quite high.
Is this a schottky diode?
Leo..

here is the diode I am using:

http://www.mouser.com/ds/2/427/sb120-108282.pdf

They show the peak reverse current as high as 10ma at the rated reverse voltage (which for that one is 20 volts). Since I don't know the input impedance of the meter, I had calculated the leakage from I=E/R where the "E" was 400mv (0.4v) and the "R" I just used 100k which gave me the 4 uA current which would be with about 12 volts reverse across the diode. The leakage will go up significantly as the diode gets hotter though. I would be cautious putting 10 ma back into a 9v primary (alkaline etc.) cell, although it would probably be less than that so there should be no problem.

So, I should ideally find a diode with a lower peak reverse current? what other factors do I need to consider (voltage, forward current?)

The diode is about 2cm from a linear regulator that is using the pcb as a heat sink, but I'd say it's not hotter than 40c

You should be OK as it is. Normally, schottky diodes are used for their lower forward voltage drop and fast response (neither of which is really important here). I tend to (for an amp or less) just use from my bag of 1N4007 (1000v @ 1A) diodes (I will buy 50 of them and keep them handy) which are less than 10 cents each if you buy 100 of them at Digikey or Mouser etc.