How can i convert an AC output from an outlet to a digital signal?
This is best done with a opto-isolator.  That not only handles the level conversion, but also isolates the digital signal from the AC line.

All you really need is a single opto-isolator.  However, if you want to also get a good idea of when the zero crossings are, two opto-isolators will give you a nicely symmetric signal:



Each half of the AC waveform turns on one of the opto-isolators.  That drives the output either positively low or positively high.  The other half of the waveform activates the other opto, which drives the output actively to the other state.  Each LED protects the other from large reverse voltages.

R1 and R2 cause the digital signal to float in the middle when there is no AC voltage applied to the input.  When used with a Schmitt trigger input, that keeps the input from getting toggled from stray pickup.  By measuring the analog level of OUT, you can distinguish between no input, versus stuck at one polarity, like DC applied.

Again, you don't need all this fanciness, but it's something I've used for a universal AC detector that can also sense the presence and polarity of rectified AC.

R3-R8 limit the current thru the LEDs.  In this case, multiple 0805 resistors were used instead of single larger 120 k&Omega; resistor.  This was done for stocking reasons.  20 k&Omega; 0805 resistors were already used in many other places.  Having to buy small quantities of 120 k&Omega; resistors resistors that can handle the power and voltage would have cost more.

This circuit can be used to sense AC line voltage anywhere in the world.  The total value of the input resistance, the power dissipation, and the minimum current transfer ratio of the optos have been carefully taken into account.