Fish Tank LED Light Bar - Help with N channel MOSFET

Com pin 4 is common with pin 6 and pin 8.

Com pin 13 is common with pin 11 and pin 9.

“trigger wire”, no, it is common between the associated N.C. and the N.O. contacts.

Your transistor will work.

Clicking is a good sign!

Wire relay pin 8 to +12v, relay pin 4 to LED anode wire (day/green?), LED cathode wire (black?) to GND (0v i.e. negative from the 12v supply).

LED schematic again:

larryd, it is working!!!! I only connected the "Day lights" leg and it works fine, if I switch the orange wire (pin 4 - DPDT) with the Green wire the "night lights" also work. I only want to turn one leg on at a time. i.e. day lights OR night lights so I guess I should find two SPST instead? I do have plenty of the DPDT and will just wire up another transistor and DPDT for the time being to control the "night lights". I understand the diode but the transistor I thought was an amplifier and with it being connected to the negative of the relay and that being the "Trigger" so to speak its confusing me. Either way, thanks again for all the help and putting up with me! Now to build the sketch and control the lights with SmartThings!

Thanks,
Brian

I always buy DPDT switches and relays, you can use them as SPST, and DPDT $ isn’t much more, can be cheaper and easier to find than SPST :slight_smile:

Working!

You are an expert now, congrats!

The transistor is a current amplifier.
A small amount of current from the Arduino into the transistor’s base controls the larger transistor collector current.

When the relay is de energized, there is a large kickback voltage seen across it’s coil.
This large voltage can cause a lot of problems, this is why you put a kickback diode across the relay’s coil.

Hi Larryd,

Thanks again for all the help! The circuit works great when I added both DPDT and thanks for the recommendations about just buying DPDT! Totally makes sense and someone else I know who is into electronics said the same thing once I brought this up. For like voltage regulators and diodes. I was always buying specifically what I needed which now I see why its pointless haha.

Now I want to power my ESP01 board with the same 12v power source and used a 3.3V 1A voltage regulator. I am getting a perfect 3.297 volts and the board powers up and connects to my wifi from my uploaded sketch but the GPIO's do not work (constantly 0 volts even when the pin should be high)....My sketch is fine and if I power it with an arduinio uno boards 3.3v my project works flawlessly. Once I use the voltage regulator I have the issue of the GPIOs not working but the board powers up and even connects to wifi because I can see it in my router.

To me it must be an issue of the ground reference? Since my lights are common cathode could something with this be causing my issue? I don't even know what to research since this is so strange haha.

We really need to see a schematic of the circuit wiring that does not work.

Not able to tell much from the image you posted here.

What voltage do you measure from GND to Vcc on the pcb when using the regulator circuit?

The 12V is regulated 12VDC?

Most regulators need decoupling on the input.

Add a .1µF ceramic capacitor on the regulator input to GND, close to the regulator.

Also, wouldn’t hurt to add another from the output to GND.

Hi LarryD,

It's been a crazy week but I finally got back to this project and I figured it out....I had the 3.3V power from the regulator going to the resistor and then to the VIN on the board. I switched this so that the power was going directly to VIN and then the resistor from VIN to CH_PD and it works perfectly. The regulator is getting pretty hot 103 F (39.44 C) so I am leaving the light on to see how hot it gets. I will be using a heat sink regardless but hope to not have to use a fan because I am out of I/O ports on the ESP-01 and don't want to have to use an ESP32.

I really appreciate all the help you provided and hope I can return the favor somehow! I will make a final post with my wiring diagram and the project details hoping it could help someone else. Thanks again and take care!