Electronics > Projects, Designs, and Technical Stuff
Arduino - Control fqP30N06L N-channel mosfet with 74hc595 shift register?
kylegp:
Hi there,
I am trying to control my N channel mosfets (fqP30N06L) with a 75hc595 shift register.
I can get the shift register to work with regular small LED's on the outputs with 220ohm resistor just fine.
However I can't get the outputs of the shift register to turn on or off the mosfets.
I tried a 10K ohm resistor tied from the gate to ground and I also tried a 100ohm resistor from the output line of the shift register to the mosfet.
My actual circuit consists of 12V LEDs which I have 12V+ running to and then the negative side of the LEDS connects to the drain of the mosfets. Im powering the arduino separately but have tied all grounds together.
Can anyone offer any guidance on how I can use these shift registers to drive these mosfets? Or do I need different mosfets or something in addition?
Thanks for any help, I'm still just getting into shift registers and controlling high power devices from low power on Arduino.
I attached my circuit diagram.
Here's my arduino code:
--- Code: ---
// Define Connections to 74HC595
// ST_CP pin 12
const int latchPin = 5;
// SH_CP pin 11
const int clockPin = 4;
// DS pin 14
const int dataPin = 6;
void setup ()
{
// Setup pins as Outputs
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
}
void loop() {
// Count from 0 to 255 and display in binary
// ST_CP LOW to keep LEDs from changing while reading serial data
digitalWrite(latchPin, LOW);
// Shift out the bits
shiftOut(dataPin, clockPin, MSBFIRST, B00000000); // or B11111111 to turn on leds
// ST_CP HIGH change LEDs
digitalWrite(latchPin, HIGH);
}
--- End code ---
Dabbot:
Can you light the LED via the MOSFET when you manually connect the gate to +5 or +12?
kylegp:
--- Quote from: Dabbot on August 25, 2020, 11:15:01 am ---Can you light the LED via the MOSFET when you manually connect the gate to +5 or +12?
--- End quote ---
I did more testing with just the arduino, mosfet, shift register and a regular 5V LED with resistor. Everything works perfectly fine, turns on and turns off. In other words, if you replace the 12V LED in the diagram with a standard 5v LED and dont use any 12V in the circuit, it works as expected.
Although the reason I wish to use this mosfet is obviously to ground side switch a 12V LED.
The shift register outputs around 5v when on, and 0 when off as it should.
So just something with the mostfet. It stays on for some reason.
Anyone have any ideas why this might be happening? Something occurs when the 12V circuit is introduced.
I would post pictures of the project but it's a bit of a mess to understand.
Dabbot:
--- Quote from: kylegp on August 25, 2020, 01:27:32 pm ---Although the reason I wish to use this mosfet is obviously to ground side switch a 12V LED.
--- End quote ---
So, taking everything out of the picture except for the MOSFET, an LED and a resistor as required with the +12V supply, can you manually control the MOSFET by alternately connecting the gate to +12V and 0V?
kylegp:
--- Quote from: Dabbot on August 25, 2020, 02:21:34 pm ---
--- Quote from: kylegp on August 25, 2020, 01:27:32 pm ---Although the reason I wish to use this mosfet is obviously to ground side switch a 12V LED.
--- End quote ---
So, taking everything out of the picture except for the MOSFET, an LED and a resistor as required with the +12V supply, can you manually control the MOSFET by alternately connecting the gate to +12V and 0V?
--- End quote ---
Yes, and I wired everything up in a simple circuit and it sort of worked.
When the shift register is told to turn the output off, the led becomes dimmer but doesn't turn off completely. When you turn the shift register output on, the led lights up full brightness.
I measured the output of the shift register when it's told to be OFF and there's still 0.40v coming out of it which means the mosfet is still somewhat on I think. When I unplug the arduino from the PC, the mosfet turns off completely as expected and the LED is completely off. Even if I disconnect the 12V and just check the shift register output as I just mentioned, it's still 0.40v on the shift register output/mosfet gate.
So somewhere the mosfet is still getting a small amount of voltage on the gate.
I have already tied a 10K resistor from the gate to the source.
Any ideas?
Navigation
[0] Message Index
[#] Next page
Go to full version