Go Down

Topic: Aquarium Led control (Read 1 time) previous topic - next topic


Hey all,

This is my first arduino project as I have just found out about this whole world.  Anyways, I have build a controller for my led pendants I made and control them with the PWM.  I am having issue though as the arduino outputs a 5v pwm signal and I need closer to 10v ideally.

To accomplish this I connected the output from a pwm pin to a 1k ohm resistor, then to the base of an NPN 2N222a transistor.  I have the negative line of a 9volt wall wart connected to the collector and the emitter goes to the dimming negative dimming circuit in the leds drivers along with the positive line from the wall wart.  I have three of these arduino pin/1k ohm resistor/NPN transistors all in parallel.

My issue is that one of the three sets of leds is running straight off of the 9v wall wart and the dimming of the arduino has no affect of the brightness what so ever, whereas the other two sets of leds dim correctly.  It does not occur with the same set of leds, only to the set that I have plugged into a specific one of the three plugs.

If I unplug the arduino completely, the ones plugged into the bad outlet will stay on while the other go out as they should.

Any advice would be greatly appreciated and I can draw up a schematic if you'd like.

Nick D.


give us details of what arduino pinouts you're using



I actually figured it out, one of the NPN 2n222a transistors somehow broke in the one position it seems.  This is why any two strings of leds connected to that transistor wasn't able to be dimmed or turned off using the arduino.  I will draw up the schematic tomorrow to see what you think and if it is the best way to accomplish my goal.  I am hoping to program in a storm/lighting mode tonight that will randomly initiate a storm with lighting a few times a month.  My goal is to have the storms more frequent during spring and summer months, although I do not have a real time clock and am just using the millisecond counter.  I also am planning to have regular every day clouds, some days will be cloudy compared to others, etc, etc.

If anyone is really good at designing circuits it would be greatly appreciated if someone came up with a way to control/dim four 3.3volt/350mA cree leds without using four arduino pins.  These would be used to simulate lunar cycles (bright for full, dimmed for waning/waxing modes) that will move across the tank throughout the night as well.

Whenever I find out how to do the lunar cycles I am planning to get an arduino mega.  So then I would be able to easily control all 5 strings of leds individually, have a nice RGB lcd or touch depending on how code heavy using the latter is.  Would also like to add pH, and conductivity monitoring, at least 8 relays/2 triac switchs, water level sensors, and maybe even internet capable to update a website and/or send emails in an emergency.

I had a feeling these arduino projects would be addicting, haha.


Jul 01, 2012, 06:42 am Last Edit: Jul 01, 2012, 06:18 pm by abrookfield Reason: 1
here's the color touchscreen I'm using as my input http://www.ebay.com/itm/270972145966?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649

Straightforward and not overly heavy code wise but you'll need a mega 1280/2560 realistically

Lunar cycle is easy AND much easier if you get a RTC for your project... they're cheap enough just search ebay for "arduino rtc" they're $5 all day long delivered

couple of questions...
you say pendents...?  how many (what size tank)
what power supply?
As you're running strings of led's are you using PLED devices around your leds?
Are you using a buck driver, or just letting the voltage drive the led string?

obviously, schematic would help everyone help you

Once you get your web interface, you'll probably want to do some reading up on METAR data... might open your eyes as to what is actually happening out on the reef  8)

Sunrise: 06:41 Sunset: 17:46
Moonrise: 14:31 Moonset: 02:31 (from previous day) - Waxing Gibbous, 81% of the Moon is Illuminated

here is jun 30 metar information for Nadi, Fiji... lots of junk in there, but also some very useful information!
Code: [Select]

TimeFJT,TemperatureF,Dew PointF,Humidity,Sea Level PressureIn,VisibilityMPH,Wind Direction,Wind SpeedMPH,Gust SpeedMPH,PrecipitationIn,Events,Conditions,FullMetar,WindDirDegrees,DateUTC
12:00 AM,67,64,88,29.96,31,Calm,Calm,,,,Partly Cloudy,AAXX 29124 91680 11699 30000 10192 20179 40145 58002 60001 70300 81130 333 10288 5699/ 81830 83362,,2012-06-29 12:00:00
12:00 AM,66.2,64.4,94,29.95,31.1,Calm,Calm,-,N/A,,Scattered Clouds,METAR NFFN 291200Z 00000KT 50KM FEW030 SCT120 19/18 Q1014 NOSIG RMK RR NIL DEW,0,2012-06-29 12:00:00
1:00 AM,66.2,64.4,94,29.95,31.1,Calm,Calm,-,N/A,,Scattered Clouds,METAR NFFN 291300Z 00000KT 50KM FEW030 SCT120 19/18 Q1014 NOSIG RMK RR NIL DEW,0,2012-06-29 13:00:00
2:00 AM,64.4,64.4,100,29.92,31.1,Calm,Calm,-,N/A,,Partly Cloudy,METAR NFFN 291400Z 00000KT 50KM FEW030 18/18 Q1013 NOSIG RMK RR NIL DEW,0,2012-06-29 14:00:00
3:00 AM,64,63,95,29.93,31,Calm,Calm,,,,Partly Cloudy,AAXX 29154 91680 41699 10000 10180 20172 40134 58011 70100 81100 333 569// 81830,,2012-06-29 15:00:00
3:00 AM,64.4,62.6,94,29.92,31.1,Calm,Calm,-,N/A,,Partly Cloudy,METAR NFFN 291500Z 00000KT 50KM FEW030 18/17 Q1013 NOSIG RMK RR NIL DEW,0,2012-06-29 15:00:00
4:00 AM,64.4,62.6,94,29.89,31.1,Calm,Calm,-,N/A,,Partly Cloudy,METAR NFFN 291600Z 00000KT 50KM FEW030 18/17 Q1012 NOSIG RMK RR NIL DEW,0,2012-06-29 16:00:00
5:00 AM,64.4,62.6,94,29.89,31.1,Calm,Calm,-,N/A,,Partly Cloudy,METAR NFFN 291700Z 00000KT 50KM FEW030 18/17 Q1012 NOSIG RMK RR NIL DEW,0,2012-06-29 17:00:00
6:00 AM,64,62,93,29.93,31,ESE,5.8,,,,Partly Cloudy,AAXX 29184 91680 11699 41105 10176 20169 40135 53001 60001 70300 84800 333 569// 81830 84650,110,2012-06-29 18:00:00
6:00 AM,64.4,62.6,94,29.92,31.1,ESE,5.8,-,N/A,,Scattered Clouds,METAR NFFN 291800Z 11005KT 50KM FEW030 SCT050 18/17 Q1013 NOSIG RMK RR NIL DEW,110,2012-06-29 18:00:00
7:00 AM,64.4,62.6,94,29.95,31.1,ESE,5.8,-,N/A,,Scattered Clouds,METAR NFFN 291900Z 11005KT 50KM FEW030 SCT050 18/17 Q1014 NOSIG RMK RR NIL,110,2012-06-29 19:00:00
8:00 AM,68.0,64.4,88,29.95,31.1,SSE,5.8,-,N/A,,Mostly Cloudy,METAR NFFN 292000Z 15005KT 50KM FEW030 BKN130 20/18 Q1014 NOSIG RMK RR NIL,150,2012-06-29 20:00:00
9:00 AM,72,66,75,29.97,31,Calm,Calm,,,,Partly Cloudy,AAXX 29214 91680 41699 50000 10220 20187 40149 52015 70101 81830 333 5699/ 81830 85363,,2012-06-29 21:00:00
9:00 AM,71.6,66.2,83,29.95,31.1,Calm,Calm,-,N/A,,Mostly Cloudy,METAR NFFN 292100Z 00000KT 50KM FEW030 BKN130 22/19 Q1014 NOSIG RMK RR NIL,0,2012-06-29 21:00:00
10:00 AM,77.0,66.2,69,29.98,31.1,Calm,Calm,-,N/A,,Scattered Clouds,METAR NFFN 292200Z 00000KT 50KM FEW030 SCT130 25/19 Q1015 NOSIG RMK RR NIL,0,2012-06-29 22:00:00
11:00 AM,80.6,64.4,58,29.95,31.1,West,5.8,-,N/A,,Partly Cloudy,METAR NFFN 292300Z 28005KT 50KM FEW030 27/18 Q1014 NOSIG RMK RR NIL DRY AIR 57/,280,2012-06-29 23:00:00
12:00 PM,81,64,46,29.95,31,WNW,8.1,,,,Partly Cloudy,AAXX 30004 91680 11699 22907 10270 20176 40140 58009 60001 70201 81830 333 20174 5699/ 70000 81830,290,2012-06-30 00:00:00
12:00 PM,80.6,64.4,58,29.95,31.1,WNW,8.1,-,N/A,,Partly Cloudy,METAR NFFN 300000Z 29007KT 50KM FEW030 27/18 Q1014 NOSIG RMK RR NIL DRY AIR 56/,290,2012-06-30 00:00:00
1:00 PM,80.6,66.2,61,29.92,31.1,West,8.1,-,N/A,,Mostly Cloudy,METAR NFFN 300100Z 27007KT 50KM FEW030 BKN130 27/19 Q1013 NOSIG RMK RR NIL,270,2012-06-30 01:00:00
2:00 PM,80.6,66.2,61,29.89,31.1,West,11.5,-,N/A,,Mostly Cloudy,METAR NFFN 300200Z 27010KT 50KM FEW030 BKN120 27/19 Q1012 NOSIG RMK RR NIL,270,2012-06-30 02:00:00
3:00 PM,81,68,55,29.89,31,West,9.2,,,,Partly Cloudy,AAXX 30034 91680 41699 42708 10271 20198 40121 56020 70121 82831 333 57999 81830 83362,270,2012-06-30 03:00:00
3:00 PM,80.6,68.0,65,29.89,31.1,West,9.2,-,N/A,,Scattered Clouds,METAR NFFN 300300Z 27008KT 50KM FEW030 SCT120 27/20 Q1012 NOSIG RMK RR NIL,270,2012-06-30 03:00:00
4:00 PM,80.6,68.0,65,29.86,31.1,West,6.9,-,N/A,,Scattered Clouds,METAR NFFN 300400Z 26006KT 50KM FEW030 SCT120 27/20 Q1011 NOSIG RMK RR NIL,260,2012-06-30 04:00:00
5:00 PM,78.8,68.0,69,29.89,31.1,SW,4.6,-,N/A,,Mostly Cloudy,METAR NFFN 300500Z 23004KT 50KM FEW030 SCT050 BKN120 26/20 Q1012 NOSIG RMK RR NIL,230,2012-06-30 05:00:00
6:00 PM,77,67,65,29.91,31,Calm,Calm,,,,Partly Cloudy,AAXX 30064 91680 11699 70000 10250 20196 40126 53004 60001 70312 8487/ 333 5699/ 82830 83650 86362,,2012-06-30 06:00:00
6:00 PM,77.0,68.0,74,29.89,31.1,Calm,Calm,-,N/A,,Mostly Cloudy,METAR NFFN 300600Z 00000KT 50KM FEW030 SCT050 BKN120 25/20 Q1012 NOSIG RMK RR NIL,0,2012-06-30 06:00:00
7:00 PM,75.2,69.8,83,29.92,31.1,Calm,Calm,-,N/A,,Mostly Cloudy,METAR NFFN 300700Z 00000KT 50KM FEW030 SCT050 BKN120 24/21 Q1013 NOSIG RMK RR NIL,0,2012-06-30 07:00:00
8:00 PM,75.2,68.0,78,29.95,31.1,Calm,Calm,-,N/A,,Mostly Cloudy,METAR NFFN 300800Z 00000KT 50KM FEW030 SCT050 BKN120 24/20 Q1014 NOSIG RMK RR NIL,0,2012-06-30 08:00:00
9:00 PM,73,70,86,29.95,31,East,5.8,,,,Partly Cloudy,AAXX 30094 91680 41699 70805 10230 20209 40140 51015 70222 8487/ 333 5699/ 82830 83650 85362,80,2012-06-30 09:00:00
9:00 PM,73.4,69.8,88,29.95,31.1,East,5.8,-,N/A,,Mostly Cloudy,METAR NFFN 300900Z 08005KT 50KM FEW030 SCT050 BKN120 23/21 Q1014 NOSIG RMK RR NIL,80,2012-06-30 09:00:00
10:00 PM,71.6,69.8,94,29.95,31.1,Calm,Calm,-,N/A,,Mostly Cloudy,METAR NFFN 301000Z 00000KT 50KM FEW030 SCT050 BKN120 22/21 Q1014 NOSIG RMK RR NIL,0,2012-06-30 10:00:00
11:00 PM,71.6,69.8,94,29.95,31.1,Calm,Calm,-,N/A,,Mostly Cloudy,METAR NFFN 301100Z 00000KT 50KM FEW030 SCT050 BKN120 22/21 Q1014 NOSIG RMK RR NIL,0,2012-06-30 11:00:00


Abrookfield, I am astounded, I didn't know that METAR data was that in depth as to have lunar brightness etc.  THanks a lot for that, I will definitely look into using that once I get everything up and going.  This project will probably take some time as I currently have very little electronic knowledge but am reading a lot, and all my programming knowledge came from 2 years of programming classes back in 10/11th grade, haha.

I am definitely planning on getting the mega to do this, there is no way I could see using anything less powerful.  Will definitely add a RTC, I just forgot out them and don't really have the pins currently as my sainsmart lcd shield takes most of them.

I currently have two pendants over a 75 gallon tank.  Each pendant contains 2 strings, one with 8 Cree XP-G R5 Cool White leds, and the other with 12 XT-E Royal Blue leds.  There is also a 5th string of leds which contains 4 Cree XP-E Red and 4 XP-E Green led.  The 5th string is split between both pendants so that there is 2 of each colored led on each.

The leds are driven by 5x Meanwell ELN 60-48P's.  So the voltage is driving the leds.

I had actually never heard of PLED devices before, I understand what they do, but is the cost of adding 48 of them worth it?  When one led blows the other just go out because the circuit is incomplete, the others are not actually harmed correct?

I will draw up the schematic, after work and post it tonight.

As for the lunar cycle dimming, how would that be wired to give full control over the 4 moonlight leds individually?  Is there an easy way other than using 4 individual pins, and how would you dim them without a dimmable driver?

this is the moonlight kit that I bought, two leds per fixture.


btw, that touch screen is very nice, a not too expensive either.  I will definitely go this way with the display, although did you add it directly on top of the arduino?  Or did you wire it up to the pins separately, how so?

I appreciate all your help, I need to do a bunch more research before actually starting but I am quite excited.
Nick D.


METAR doesn't have lunar brightness, that was "gleaned" from a different feed, it's easy enough to calculate as well

PLED's - you don;t need them, but if you don;t have them, the whole string goes out of you lose a led

Touchscreen added directly to top of Arduino

If you have your moonlights wired in paralled, it's going to be difficult to individual drive without adding extra hardware (tlc5940 and additional drive circuitry) - but then you could use this method to extend your dimability to the meanwells

Go Up