Just to clarify on the answer by Mats Karlsson, if you are using the opto-coupler circuit from the YouTube video, you won't be using the "here > > > > > >" part of the yellow wire because that would be measuring current through a series connection which the RPi can't handle. Instead you would be measuring the potential difference in voltage across a parallel connection. This is what the input GPIO will measure: a HIGH potential or a LOW one. Assuming your posted circuit has a positive voltage coming from the center pin terminal of the barrel connector: The 10K resistor, which has one end going to the transistor base, will have the other end connect to the green wire in your circuit. This way, when the motor comes on, some current will drive the transistor to allow current to flow through the internal LED in the opto-coupler which shines on the receiver and allows the isolated collector-emitter junction to conduct. This would mean that you would not use the resistor, LED, or the 9V supply from the circuit. Instead use a 3.3V pin from the RPi to make use of the isolation a coupler can give you. The whole idea is that no external voltage will be able to reach the GPIOs. The voltage will come from the RPi itself so you're safe as long as you don't draw too much current from your RPi's 3.3V pin. A current limiting resistor with a value from 10K to 100K connected to the 3.3V pin will draw less than 1mA if it gets grounded. You want this current limiting resistor to go from the RPi's 3.3V pin to the GPIO you wish to use to detect if the motor is running. This GPIO will also connect to the collector terminal of the opto-coupler which is the one that used to go to the LED. Then make sure the old ground connection from the opto-coupler's emitter terminal only connects with the RPi's ground. When the motor is running, the transistor will conduct and current will flow through both sides of the opto-coupler. This means that your input GPIO will no longer read a HIGH from the current limiting resistor because the opto-coupler's collector-emitter junction provides a much easier path to ground. This means that the GPIO will sit about 0.1 volts above ground which will be read as a LOW.