Hello.
Is it neccesary to isolate with the optocoupler? As I understood, the battery will supply the MCU and you want it to know when it's low.
There are a lot of solutions already made for that; many MCUs have a "low voltage sensor" flag you can use to do anything when that happens (put in stand-by, lower the circuit consumption by turning off circuit parts... saving energy, or to save data and turn off).
Then, if you don't know how to use that (or don't want to), you can use the ADC using the internal bandgap reference to measure the battery voltage.
And my least favourite one, if using the optocoupler, which would be the less accurate method (as you only know when it's low or not, but not an exact or aproximate value), you could aproach the proper inner LED breakdown voltage (read datasheet to know its value) and adding a zener or several diodes to get it turning off to a desired low voltage. That will turn the transistor on and will advert MCU that the battery is low.
EDIT:
Another solution, as I read you don't have ADC... use a transistor with a zener or some diodes in series with the base, and a resistor to the collector (output); if the battery is high, current flows through base and transistor is on. Otherwise, it won't happen, so when you get a "1" at the output (transistor off), the battery is low.
Like this