Loose the 1k resistor , use only rectifier diode ,100k resistor , optocoupler because the optocoupler is current driven. If still doesn't work ,in the processor side must be a pull-up resistor , check if your Current Transfer Ratio of the optocoupler is sufficient. Some have CTR = 1 or less and for 120v main voltage R pull-up must be higher than 20Kohm. The transformer is to big for such a simple task , post a drawing , the value of the main voltage (I guess 120v if you're from Ohio) and the optocoupler you use to help you make-it work.