How to set up photo interrupter to turn mosfet OFF?

I have this Mosfet and I’m trying to use a photo interrupter to turn it off. Basically when the photo interrupter (slot type) is blocked, the mosfet should turn off. I am running my circuit design off 5V.

Is there any photo interrupter (slot type) out there that would work for this mosfet? I am happy to change the mosfet too if needed. It’s to turn on an N20 motor that runs on 70mA 5V.

Is there an Arduino in this circuit?

how many Arduinos does it take to turn on an LED?

Yes there is an Arduino. This circuit is part of a larger circuit that I figured is not worth posting because it would over complicate the question or confuse people.

Got a link to the photointerrupter datasheet?

The MOSFET needs a high voltage to turn on, >2,5V up to 4.5V.
Connect one side of the motor to +5, the other side to the D pin, the S pin connects to Gnd.
Connect the Gnd to the Arduino Gnd so they have a common reference.
Connect a diode, like 1N4001, or whatever you have handy. Something that can handle 70mA.
Cathode connects to +5, Anode connects to the same side as the MOSET.

The Arduino connects to the G pin.

Drive the G pin high, the MOSFET will conduct and the motor will turn on.
Drive it low, the MOSFET will turn off, the motor spinning will create some current as it winds down, the diode gives the current a place to go, dissipating itself in the motor.
Add a 10K to 100K resistor from the G pin to Gnd to keep the in low when nothing is connected.

You can use two in series to make an inverter if your photointerrupter normally has a high output.

I was going to use this photo interrupter but it doesn't produce a voltage output to power on the mosfet.

Due to my project, I would like to connect the photo interrupter and mosfet without an Arduino. No space for a 2nd Arduino and the first is fully used up.

Is there a way to hardwire a photo interrupter and mosfet to work as explained in the first post?

Something like this?
optoMtr1.png

optoMtr.png

optoMtr1.png

That could work. I would use a Schmitt trigger so it doesn’t oscillate

shai:
I was going to use this photo interrupter but it doesn't produce a voltage output to power on the mosfet.

Exactly.
Commonly known as open collector output.
Many sensors use this configuration.
As per the circuit provided above, one has to add components for it to work as required.
In this instance , R1.
If you eliminate R2, Q1, motor, and the diode above, you would see the voltage at point 4 go up and down as the LED is turned off and on respectively.

Perhaps a dumb question as I'm not too experienced - but how will the gate turn on/off if it's directly connected to 5V? Can you explain what exactly happens when the photo interrupted is open/blocked?

Sure.

To begin, the gate of the mosfet is not directly connected to 5V.

Gate is via R1 to 5v rail.

When LED turns on, transistor turns on and pulls R1 and collector point to ground. (or near to)

When Led turns off, transistor turns off and the same point goes high (5V).

Ok thanks, that makes sense! And R2 is there for what purpose?
Also, I can use the same photo interruptor I linked to originally?
What SMT transistor would you recommend for this application? I’m unsure which specs it should have.

Gate is via R1 to 5v rail.
When LED turns on, transistor turns on and pulls R1 and collector point to ground. (or near to)
When Led turns off, transistor turns off and the same point goes high (5V).

Basically when the photo interrupter (slot type) is blocked, the mosfet should turn off.

I think that @shai needs the circuit to invert the photo interrupter output…

shai:
Ok thanks, that makes sense! And R2 is there for what purpose?
Also, I can use the same photo interruptor I linked to originally?
What SMT transistor would you recommend for this application? I'm unsure which specs it should have.

R2 makes sure the mosfet is held off when it is supposed to be.

If you want the circuit to invert, I normally add another transistor and resistors between the opto and the mosfet.

You could try this though I guess....

OOPS! Didn't see:

Basically when the photo interrupter (slot type) is blocked, the mosfet should turn off.

Maybe:
optoMtr2.png

optoMtr2.png

I don’t like it... how do you know the mosfet will be saturated? Nothing worse than it being barely on or barely off.

Ok I'm getting confused now, which way is the right way to do it?

EDIT: I need the motor to be ON until something blocks the infrared light in the optical sensor. When the optical sensor is blocked, motor OFF. Also take note this optical sensor does not output voltage! Its a phototransistor output: https://www.digikey.com/product-detail/en/omron-electronics-inc-emc-div/EE-SX1330/Z6364CT-ND/6600987

shai:
Ok I'm getting confused now, which way is the right way to do it?

EDIT: I need the motor to be ON until something blocks the infrared light in the optical sensor. When the optical sensor is blocked, motor OFF. Also take note this optical sensor does not output voltage! Its a phototransistor output: https://www.digikey.com/product-detail/en/omron-electronics-inc-emc-div/EE-SX1330/Z6364CT-ND/6600987

As I said an thought I had explained already, it is an open collector.
No voltage there until you connect a pullup resistor on the collector to the positive rail.

As far as confused. me too. I've no idea what #15 is referring to. Perhaps #14 post, who knows.

Anyhow, in case you did not bother to look at the link i provided, I'll put it here for you.
Disregard the input section, it's the output you need to see.

Opto.jpg

Opto.jpg

Post #14 is fine... I would put a small gate resistor on the mosfet. 50-150 Ohm is good.

shai:
I need the motor to be ON until something blocks the infrared light in the optical sensor. When the optical sensor is blocked, motor OFF.

Are you sure you need an Arduino for this? It sounds like a direct connection of sensor to motor on/off control.