I'm using an Infineon type to-220 mosfet in my circuit. To "turn it on" I need to ground one of the pins.....which is only low current hence I'd like to make use of the uno. This pin when not grounded is left floating.
Id like to use a momentary switch, with de-bounce. I've set-up the standard de-bounce sketch on my board no problem and have had a mess around with a few other sketches, BUT I'm having trouble envisaging a way of controlling this ground from the arduino.
The mosfet uses a 24v dc source, and the arduino 5v, common ground. Any time this ground is plugged into the uno board pins it automatically turns on the mosfet. I'm assuming that the pins are pulled to ground. Turning on the switch using the de-bounce sketch has no effect as I guess this only raises the gnd input pin to 5v and the mosfet remains on.
So, can someone give me some guidance on a direction for this project?
CAUTION - I was not able to verify that you will not damage your input pin.
it may be that the voltage on pin 3 is the high side voltage of the FET. if that is the case, then you need to isolate this line with something like an opto or transistor.
looks like all you need to do is to connect your digital pin on the arduino to pin 3 on the FET and then bring your pin LOW to turn on.
I hoped it was that simple but when trying it, the load (bulb in my case) immediately turned on, and could not be turned off. I used the basic de-bounce sketch, but this supplies either 5v (switch press on) or pulled to ground?? (Switch press off). What I need is a pull to ground to turn MOSFET on, and a floating pin effectively to turn it off. Is that possible with mods to the denounce sketch?
visit the how to use this forum page on the top of every forum link
item #7 will show you how to post using code tags.
typically a [ bracket with the word code and then a second bracket
the repeat but this time, between brackets, you put /code
then copy your code and past between brackets
I would offer that you could try the
blink program and change the pin from 13 to whatever you have for the output.
Are you using an N-channel MOSFET, or a P-channel one?
To turn on an N-channel MOSFET, you drive the gate high, and have source connected to ground, and switch the low side.
To turn on a P-channel MOSFET, you drive the gate low, and have source connected to supply, and switch the high side. But for it to be off, the gate voltage must be the same as the source voltage, so absent other components, to turn off a P-channel MOSFET switching 24V, you need 24V on the gate (typically via pullup from the source) - so to control with microcontroller, you need an additional transistor...
It seems this is an N-channel mosfet with build-in charge pump and drive circuitry.
The datasheet states the control pin has to be switched to ground (~1mA current source) to turn the mosfet on.
It is not clear what the open voltage of this current source is, so I would assume mosfet supply.
So an Arduino pin can't do this directly. You need an additional transistor.
A small N-channel fet like the 2N7000, or a NPN transistor with 1k base resistor could be used for this.
A second pin of the mosfet could provide load current information.
Leo..
DrAzzy:
Are you using an N-channel MOSFET, or a P-channel one?
To turn on an N-channel MOSFET, you drive the gate high, and have source connected to ground, and switch the low side.
To turn on a P-channel MOSFET, you drive the gate low, and have source connected to supply, and switch the high side. But for it to be off, the gate voltage must be the same as the source voltage, so absent other components, to turn off a P-channel MOSFET switching 24V, you need 24V on the gate (typically via pullup from the source) - so to control with microcontroller, you need an additional transistor...
As Wawa has said it has a lot inbuilt charge pump etc to this MOSFET, I understand the basic principles of switching a MOSFET on and off.
As yourself and Wawa have suggested an additional transistor in the circuit to control the ground and it works perfectly.
Wawa:
It seems this is an N-channel mosfet with build-in charge pump and drive circuitry.
The datasheet states the control pin has to be switched to ground (~1mA current source) to turn the mosfet on.
It is not clear what the open voltage of this current source is, so I would assume mosfet supply.
So an Arduino pin can't do this directly. You need an additional transistor.
A small N-channel fet like the 2N7000, or a NPN transistor with 1k base resistor could be used for this.
A second pin of the mosfet could provide load current information.
Leo..
Thanks works perfect with another transistor to control the ground.
I'd like to use the other pin 5 on the Infineon MOSFET to effectively act as a circuit breaker. The data sheet suggests this is proportional to the output current, but is in the order of mA. With a load of approx 1.5 amps gives around 1 volt output at pin 5 across a 1k resistor. Would you use this as an analogue input and use a sketch to "cutoff" above a threshold value?