Aquarium light setup help

Hi all,

I am new to electronics. looking to setup a project for a aquarium controller. can you guys please share some professional advise / assistance to guide me start my first Arduino project? thanks.

my idea is to use the Arduino board to control light dimming, water quality (such as PH level, ammonia…etc), pump control…etc.
the first task for me is the lighting part.

i bought lots of 3W leds in different colours. am going to chain up 7 X 3W per series connection. and i will have 8 of them. i want to use pwm to control the dimming so i can do the sunrise and sunset effect.

the led spec: 3W, 3.4V, 660ma

my understanding is 7 X 3.4v = 23.8v per chain, so i bought a 24V 15A power supply.

After some help / discussion with Core electronics support team via chat earlier, they suggested i can use Adafruit TLC5947 as the pwm controller and P-Channel MOSFET 60V 27A to provide large current (TLC5947 spec said only 30ma per channel).

i have done a quick connection drawing as attached, can you please let me know if i am connecting everything in the right way?

also if i have missed anything in my drawing? e.g. my power supply is 24V and i only need 23.8v, do i need a resistor for that?

many thanks.

andy

Hi Andy,

The MOSFET configuration looks good. You will definitely need a resistor in there to limit the current to within safe levels. You could probably use a 1-2 Ohm(1 watt) resistor in series with the 7 LEDs and it should be fine. You should always have some way to limit the current with LEDs as without it they will burn out.
.

hi Clinton,
thanks for your help today. do i place the resistor between the power supply and the LEDs, or between the LEDs and the mosfet? or doesn’t matter?

also am i connecting the mosfet to the right pin on the TLC5947 board?

thanks
Andy

Between the LED and Mosfet. You have connected it to channel 11 you will need to connect a resistor (1k) From the mosfet pin back to the ground on the TLC5947.

hi Clinton,
i am still confuse on the resistor that you mentioned to use a 1-2 ohm (1watt) resistor.

i read the page on resistor calculation, i got this result. (0.3 ohm 0.132w)

(24v - 23.8v) / 0.66a = 0.3 ohm

0.66a x 0.2 v = 0.132w

have i missed something?

thanks
Andy

Your maths is good! I think i got the same values I rounded up then doubled to give a value that should work but would definitely be safe as a place to start. It is usually a good idea to go high with resistance and reduce it if you are not getting enough current.
As to why I recommend playing it safe with the LEDs. The forward voltage tends to be a typical value and will be higher and lower depending on the colour, temperature and operating current.

thanks Clinton, now i understand.

found 1 similar looking modfet from an old board. checked the spec, it’s a N channel and not the P channel you suggested which i am not sure what it means… :frowning_face:

did a bit or research online, found someone had similar setup. copied their test code.

but the light didn’t come up. am i done something wrong? updated pic attached.

if i put the pin 11 on TLC5947 to v+, the lights are up for few seconds then off.

thanks

1 Like

here’s the code

#include “Adafruit_TLC5947.h”

#define NUM_TLC5974 1 //one board
#define data 4 //pin 4
#define clock 5 //pin 5
#define latch 6 //pin 6
#define oe -1 // set to -1 to not use the enable pin (its optional)

Adafruit_TLC5947 tlc = Adafruit_TLC5947(NUM_TLC5974, clock, data, latch);

void setup() {
Serial.begin(9600);

tlc.begin();
if (oe >= 0) {
pinMode(oe, OUTPUT);
digitalWrite(oe, LOW);
}
}

void loop() {

for(int i=0;i<25;i++)
{
setLEDPWM(i,4095); //sets all 24 outputs to maximum brightness PWM.
//tlc.write();
}
}

void setLEDPWM (uint8_t lednum, uint16_t pwm)
{
Serial.println(“inside pwm test”);
tlc.setPWM(lednum, pwm);
tlc.write();
}

1 Like

The inside pin on the TLC5947 seems to be gnd so you could change the wiring to this. You may also want to swap the Source and Drain pins around. Give that a try and let me know how it goes.

hi Clinton,

thank you very much for your big help. i am able to use the pwm signal to control the led lights.

just don’t understand why we have to put both v+ and v- to the Gate.

thanks again.

There are a couple reasons the biggest being that the switch is on the negative side for this own controller. Also the gate on the MOSFET is isolated from ground so you need the return path.

i was too quick to conclude the answer. I thought i can control the light via pwm coz i saw the light dim a bit.
my test code is to set pwm output to 1024, 2048, 3072, 4095 with delay in between.
last night i tested again, i found that it doesn’t really dimming the light to low or not able to turn off the led by setting pwm to 0. electronics are much harder than i thought…

Hey Andy,

It might be worth separating the two circuits for a moment. Try wiring the Mosfet directly to the Arduino to test that it is switching correctly, And also try connecting a single LED to the PWM board to see if it the problem is in how the board is setup. Electronics is mostly debugging but the harder the problem the better the results!

hi Clinton, just searched forums, found one guy talking about Adafruit tlc5947 with mosfet.
https://forums.adafruit.com/viewtopic.php?f=31&t=89546
he’s saying tlc5947 cannot control mosfet via pwm. is this my issue now?

or is there any change we change the tlc5947 board to drive 660ma current per channel? (sorry i may be crazy thinking)
thanks

Yeah, I should have picked up on that, if you swap to a PNP and follow the steps they have in that post you should be back on track.

i think they used 2 components, a PNP transistor and mosfet. is that correct?

Yep, I did some test wiring and this seems to work in simulation. the switch is where you would attach the pin of the TLC. You don’t attach the +ive side of the TLC though you will need to connect the grounds together.

thanks Clinton,
i finally able to use pwm to control the LEDs. i can see the different between values (1024, 2048, 3072, 4095).

2 Likes