I am trying to automate my existing aquarium lighting and ran into an issue I can not seem to figure out. The LED light bar I am trying to control has two circuits, one is for the night lights and other is for the day lights. Both legs use 12V @ 0.3 mA and I want to use a N channel MOSFET to control these two circuits using a 3.3V trigger (ESP01 Chip if possible). When I setup the circuit I can operate each leg perfectly when testing using the 3.3V power pin on the Arduino. However, when I connect two MOSFETs one to control night lights and one to control day lights, It powers both legs regardless of which one is triggered. How can I wire two MOSFETs to work completely independent to turn on either the Night Lights or the Day Lights? Do I need a diode to prevent voltage/current leaking into the non-used MOSFET? Sorry I am pretty new to electronics and looked all over the internet and can't seem to figure out what my problem is. Any help or direction would be greatly appreciated!!! Below is a circuit I put together as best I could and also two pictures of my actual project with some additional information.
Lights
LED Light Bar Power Supply = 12V @ 0.3 mA
States: Off, Night Lights, Day Lights
MOSFET
Type: N Channcel Logic Level (P30N06LE)
Wiring
Source: 12 Volt LED Power Supply Negative (Blue Wire)
Drain: Negative to LED's (White Wire)
Gate: Arduino Uno Pin with 10K Ohm resistor to ground (Yellow Wire) - Using power pins for testing
I was under the impression the MOSFET was switching the negative legs but I was following a RGB example. My resistors are defiantly 10K ohm, its easier to measure them for me than to read the strips! I see your circuit specifically Q3, D5 and K1 but can't really follow what you I need to do? How would I separate the two loads? Sorry for stupid questions and lack of knowledge!
The LEDS come on when I connect the Black wire to negative and the Orange or Green wire to 12+. The black wire is Negative and the Orange and Green are the positive. On the other side I know the polarity of the 12V power supply by checking voltage and looking at the sign. Thanks again for the help!
Oh jeez, well looks like I will have to order some P channels and the NPN transistors. I originally was using mechanical relays but wanted so make everything smaller and learn how to use MOSFETS as switches. Anyhow Ill look up the circuits for common cathode leds and give it a try. Thanks for all the help!
I think I will take your advise...Ive been looking for an example using the P channel MOSFET and can not find anything besides RBD strip lights. Those would be an upgrade from my mechanical relay arduino shield and since these are DPDT I can use one relay for both light legs. Thanks again for the help, ill report back once I get the relays and get it all connected. Happy Holidays and have a great New Year!!
I would like to stay away from taking the LED lights apart if possible! I did get the DPDT relay and I am trying to hook it up with no luck. Do I need to connect the relay any differently for my LEDS being common cathode? Right now I have the relay wired as following: Pin 1 (Coil) = + 12 volt power supply, Pin 16 (Coil) = - 12 volt power supply, Pin 13 (Com) = Pin 5 on Arduino board, Pin 4 (Com) = Pin 6 on Arduino board, Pin 8 (NO) = Day Light Led of LED bar, Pin 9 (NO) = Night Light of LED bar. I also connected the negative of the power supply to ground on the Ardunio so these circuits share the same common ground. I wrote a simple blink program and I can not get my lights to come on at all. I know the polarity of the power supply is correct cause when I measure a voltage I have the correct sign. I also tried to give Pin 4 and 5 a "high" voltage by connecting it directly to the 5v and 3.3 volt power pins on the Arduino and that also didn't work. Any thoughts on what I am doing wrong here?
It looks like it is hooked up corrected but seems like 5v or 3.3v will not trigger the rely. If I touch one of the COM pins 13 or 4 to 12V positive on the power supply the lights for that leg go on. So it seems like its an issue with the arduino and not triggering with 3.3v or 5v.
P.S.How are you adding images directly to the post? I tried copy and paste and it does work so I fiqured I had to make them attachments!
Thanks for all the help Larryd but I can't seem to figure out how to wire based off your diagram...sorry I am a newbie! I do have diodes but only have 1N4007 and do not have any 1N4001. I will use the resistors you mentioned for R3 and R4 but what is 2N2222?
bmmcpeek:
Thanks for all the help Larryd but I can't seem to figure out how to wire based off your diagram...sorry I am a newbie! I do have diodes but only have 1N4007 and do not have any 1N4001. I will use the resistors you mentioned for R3 and R4 but what is 2N2222?
Thanks for the image post as well!
A 2N2222 is a old but common NPN transistor.
You can use a 1N4001 or a 1N4002 or a 1N4003 or a 1N4004 . . . or 1N4007.
The relay pin numbers are shown on the schematic.
To help a bit more, I will re-draw another schematic and post it shortly.
larryd, you are amazing! Thanks for having the patience with me! I have a PN2222A 6E transistor and also the 1N4001 diode and have connected the circuit. From what I can find, the PN2222A is the same as the 2N2222. I will try to get one leg (Day) to work before I have both. Stupid question but COM on the DPDT (Pin 4) is common? or is this communication ie. this is the trigger wire for the relay? I think I have it wired properly and I can hear the relay click when I apply the 5V from the arduino to the 470 ohm resistor and then the transistors base. Either way it clicks but the lights do not come on and I do not see any voltage when I measure between ground and pin 8 of the DPDT.
The DPDT only has wiring on pins 1 (+), 16 (-), 4 (COM) and 8 (NO). I have the diode between pins 1 and 16 with the cathode in pin 1. Then I have 12+ from my supply going to the pin 1 rail and pin 16 is connected to the collector of the transistor. I put all grounds on the ground rail since both circuits share the common ground. I have pin 4 connected to ground and pin 8 is connected to the LED lights green wire (Day). The arduino is grounded to the ground rail and then the orange wire goes to 5.5v on the arduino (just to test for now, ill make a sketch later to turn a pin high) and the 470 ohm resistor and then the base of the transistor. Finally the emitter is connected to the ground rail. See the picture below if you are able to make out how I wired it in a breadboard. Any clue what I am doing wrong?