Ah your beautiful circuit is a nice locking down Monday jig saw puzzle. Now let me think alound.
(1) The opto-isolator output is not connected to anything, so I guess that is not relevant.
(2) The current passing the LED should be 9V / 20k ~= 0.45mA, seems a bit too small.
(3) I guess the input terminal is what you want to input to the Rpi GPIO. Please correct me otherwise.
(4) Assuming boundry case that the LED voltage is 0.5V or less, so input V ~= 9V x (10k / (10k + 10k) ~=5V
(5) So now you need to step down the too strong input 5V signal to about 3V for the weak Rpi.
(6) You can use another voltage divider with resistors x, y, to step down 5V to 3V, say 5V x (x / y ) = 3V.
(7) The x and y above must be a bit bigger than those of the first divder, so not to “load down/distort” the first divider, I would choose 300k / 500k.
(8) The EE guys would usually use CD4050 to do the step down, at the same time protecting the Rpi GPIO from “latching up” and melting down.
(9) No guarantee no nothing won’t melt down or blow up. Best of luck to you circuit. Cheeres.
Blynk an LED on Raspberry Pi – 49,930 views 2017apr17