PDA

View Full Version : Make your own Arduino based 12ch (or more) LED controller


knabbuziak
08/09/2015, 02:28 AM
Hi everyone! This is my first post here so I shall try to make it a good one! :D

I've made an Arduino-based LED light controller that first was meant to be a product for our company. However, I'm not a great salesman, so we never sold any, but I still think that it is a useful piece of equipment and I've always loved the open community, so I'm now releasing it to the public.

I've tried as far as possible to only use easy-to-get and easy-to-solder components such as:

- Atmega328P-PU with crystals
- TexasInstruments TLC5940
- 74HC04
- RTC1307
- 16x2 LCD with 44780 interface

The controller is capable of dimming 12 channels of high power LED's via MeanWell LDD-drivers in 4096 steps of intensity (12 bits).

I've also added temperature controll to controll fans and shut of the LED's if the heatsink is too hot.

A separate channel to dim the Moonlight


Since I'm from Sweden, I wrote all comments in the code in Swedish, so I'm currently working on the translation and optimization of the circuit.

I've put one computer in my co-owners own DT at his house, and it has been working perfectly for the last two years.


In the future I hope to expand it with pump control, lunar phace and tide simulation etc.


The picture is of my lab-computer that I've only used for testing, but my colleagues computer is very similar.

I also have a code for a much more simple comuter without the TLC if anyone is interested. I managed to build it on a very small board integrated into a Juwel 54L lid.


If anyone has suggestions on how to make it better, please let me know! I will try to update and translate the codes and get back soon with wiring diagrams etc.

I hope this will be useful for someone!


I've attached the code (messy), some of the libraries (the ones that I don't think is included in the arduino IDE) and a picture of my testing computer.

If I manage to get the scetch right, I will try to order a few machined PCB's

boban070
08/09/2015, 05:41 AM
Thanks for your generosity in sharing this!

knabbuziak
08/09/2015, 09:11 AM
I have translated the few lines of text that appears in the display of the arduino if someone wants to test it...

I also remembered that I forgot to add the EEPROM preparation sketch. Both are included in the attatched zip-archive

For the future, I will share the files directly from my Google-Drive, so that everyone can se the updates i realtime.

Forgot to mention a few things in my last post. All temperatures are in Celsius. I don't know if there are components more suitable for Farenheit which I guess that most of the people here prefers... It should not be too much of a hassle to edit the code though.

The other thing that I forgot to mention is that I've programmed this computer to dim all channels logarithmically (smaller steps in the beginning and larger steps at the end of the curve. The dimming now looks linear to the eye, I've compressed the scale to 100 steps, so the first stepchanges the intensity from 0% to 0.024% and the last step is between 95% and 100%. I hope that this makes sense to at least some of you. Please let me know if you try it out and if you have any questions.

marco.sv
08/09/2015, 09:17 AM
nice job!!

perkint
08/09/2015, 04:26 PM
Not looked at your code yet, but sounds good :)

Tim

knabbuziak
08/12/2015, 05:56 AM
I've spent the last days trying to make a PCB-layout for the motherboard and I think I'm ready. I might do some small changes to it, but I believe that It will work. I will try to order three of these as "Pro MiniBoards" sometime in the future. However, you may use it to get the schematics out until I get around to finish that as well...

https://drive.google.com/file/d/0By_ex8Ia4SLfYWtwb1RsRkVJcFk/view?usp=sharing
The file opens with ExpressPCB software (I hope it is okay to post a link like this)


I'm also updating the program and translate as soon as I feel that I have the energy for it:
https://drive.google.com/folderview?id=0By_ex8Ia4SLfblU1cmU4cHhaSEU&usp=sharing

knabbuziak
08/12/2015, 06:45 AM
Forgot to add something to my last post regarding the PCB, please note that you also need a control-unit with display, RTC, rotary encoder and battery backup. If you want temperature protection, you will also need the sensors for that!

The computer presents a 976MHz 12bit 5V-signal that works excellent with the MeanWell LDD-drivers.

marspeed
08/13/2015, 05:37 AM
A new project for winter right on time

knabbuziak
08/13/2015, 10:02 AM
I would be so happy if just one person wanted to use this! I will order the PCB's hopefully in the nearest future. I will post results here as soon as possible!

Is it ok to post a link to an online company that sells items that will work with this controller?

knabbuziak
08/13/2015, 12:28 PM
The computer presents a 976MHz 12bit 5V-signal

Sorry, 976Hz is the correct frequency

marspeed
08/15/2015, 06:47 AM
I think it should be ok

knabbuziak
08/15/2015, 07:08 AM
I've used items from this webshop before, with great results... However, the computer he offers doesn't match my demands, so the pins on my PCB-layout (liked earlier to my Google Drive) should be matching the pins of his computer.

http://www.aquastyleonline.com/products/14-Cree-LEDs-Controller-DIY-kit.html

325826

marspeed
08/15/2015, 08:39 AM
is there an .sch to go with that pcb file

knabbuziak
08/15/2015, 09:11 AM
Sorry, no... I know that is the "correct" way to do it, but I never got the hang of that part of the program, so for me it was easier to just get going with the pcb right away...

marspeed
08/15/2015, 09:29 AM
Ok I see

knabbuziak
08/15/2015, 09:31 AM
Do you need the wiring diagram? If so, most of it is in the code... I will try to create a proper wiring diagram as soon as I find time to...

marspeed
08/15/2015, 09:40 AM
Well I was thinking of playing with the layout of your board

knabbuziak
08/15/2015, 09:49 AM
Please do!!! :-)

I think I have some mad tetris-skills fitting everything to that limited space, but I guess there is always room for improvement... Physically, it is not possible to fit much more on that board

325845325846325847

marspeed
08/15/2015, 10:23 AM
Now that is cool thats what I do to check the component sizes

knabbuziak
08/15/2015, 10:28 AM
I always do that a few times during the creation of the pcb and before etching... but this two-sided will be ordered...

knabbuziak
08/20/2015, 01:07 AM
Does anybody knows how to calculate the correct intesity and position of the moon? I thought I should make this my future project - making this computer creating natural-like tides (?), and moonlight. But I need some kind of formula and some help with the code to make that happen...

dartier
08/20/2015, 04:41 AM
Does anybody knows how to calculate the correct intesity and position of the moon? I thought I should make this my future project - making this computer creating natural-like tides (?), and moonlight. But I need some kind of formula and some help with the code to make that happen...

I have some python code that does this. I found it online somewhere and use it on my RPI. You will need to translate it for the Arduino though. It is not particularly complicated though. This will at least give you the intensity of the moon. The position (for tides) is beyond this code.

#!/usr/bin/env python

# Determine the moon phase of a date given
# Python code by HAB

from datetime import date

class Moon(object):

# def __init__(self, date):
# self.date = date

def phase(self, date):
day = date.day
month = date.month
year = date.year
ages = [18, 0, 11, 22, 3, 14, 25, 6, 17, 28, 9, 20, 1, 12, 23, 4, 15, 26, 7]
offsets = [-1, 1, 0, 1, 2, 3, 4, 5, 7, 7, 9, 9]
description = ["new (totally dark)",
"waxing crescent (increasing to full)",
"in its first quarter (increasing to full)",
"waxing gibbous (increasing to full)",
"full (full light)",
"waning gibbous (decreasing from full)",
"in its last quarter (decreasing from full)",
"waning crescent (decreasing from full)"]
if day == 31:
day = 1
days_into_phase = ((ages[(year + 1) % 19] + ((day + offsets[month-1]) % 30) + (year < 1900)) % 30)
index = int((days_into_phase + 2) * 16/59.0)
if index > 7:
index = 7
status = description[index]

# light should be 100% 15 days into phase
light = int(2 * days_into_phase * 100/29)
if light > 100:
light = abs(light - 200);
return date.strftime("%A %d, %B %Y"), status, light

if __name__ == '__main__':

today = date.today()
moon = Moon()
date, status, light = moon.phase(today)
print "moon phase on %s is %s, light = %d%s, %f" % (date, status, light, '%', float(light)/100.0)


Dennis

knabbuziak
08/20/2015, 05:00 AM
Thanks! I've never used Python, but I might be able to work something out of it...

knabbuziak
08/20/2015, 01:45 PM
I couldn't find a sketch program that I could understand so this is the best I could do:
https://drive.google.com/file/d/0By_ex8Ia4SLfZ1NZRXlKVGstS0E/view?usp=sharing

The brown board is supposed to be an I2C-adapter for the LCD, like this one:
http://img.dxcdn.com/productimages/sku_216865_1.jpg

I've gone through the drawings a few times, and I think I've found most of the errors and corrected them... Please let me know if you find something that looks fishy!

The outputs does not match the code (yet), but it matches the PCB-sketch.

Outputs from bottom left to right are:

1, Yellow, Fan GND PWM (connect fan + directly to VCC of powersupply with correct voltage) (doesn't really leave a PWM-signal with the "filter", you can remove the filter by removing C5 100uF capacitor)
2, Blue, Moonlight GND PWM (connect + from moonlight strip directly to VCC of powersupply with correct voltage)
3-14, Signals for MeanWell LDD LED drivers
15, Yellow, Background dimming for LCD

Output 0 on top left of TLC5940 goes directly to cathode of an LED of your choise, but it has to be able to handle 20mA current and fV must be less than 3.8V (if I remember correctly). Anode of LED connects directly to 5V (no resistor should be added).

CR2032-battery is not neccessary but makes it easier not having to set the time every time the circuit looses power.

The rotary encoder I use looks a lot like this one: http://img.diytrade.com/cdimg/1372564/18247406/0/1295601326/Rotary_encoder_with_metal_shaft.jpg

knabbuziak
08/21/2015, 02:31 AM
If you want to test the code, the easiest way is to hook up an UNO to an LCD with I2C-interface (or change the code so that you can use a parallell connected LCD). You will also need a rotary encoder and an RTC with crystal (or complete module). The temperature sensors can be replaced by two potentiometers. That way, you can see what happens with the light and fan outputs if the temperature goes up or down.

You do not need the TLC5940 to get the display running, and try out the program, but you do need one to see what happens with all channels. You can then hook it up to 16 LED's (one for each channel) with the cathode connected to the output of the TLC and all anodes should connect to 5V. Please note the limitations of the UNO, you might have to use an external power supply. Be sure to get the connections right!

Here is a picture of how to connect the LED's to the TLC5940:
http://www.sensorwiki.org/lib/exe/fetch.php/tutorials/tlc5940_bb.png?w=596&h=&cache=cache

knabbuziak
10/14/2015, 04:55 AM
Just ordered a test of three boards looking something like the attatchment:

https://goo.gl/photos/8ZVU8LHRRUHPrMSr5
(Original photo)

I've been tweaking the layout for a while now, and I believe I have a working prototype. The manufacturing and shipping will take a while, but I hope I will have it in the beginning of November. I'll be back with more pics then! :-)

knabbuziak
11/03/2015, 03:27 PM
Second version almost done!

332573

I didn't have time to finish it today. I will try my best to finish it tomorrow. Just a few components missing but family and work has to come first...

The board size is 3.8 x 2.5 inches 2-sided and holds most of the components. The controller is almost as big but soldered onto a 2-sided prototype-board and holds the display, rotary encoder and battery backup.

332574332576332577

In the future I hope to make the controller-board printed as well.

I will post all files as soon as they are tested!

Please let me know if you plan to build it!

After I find out if the computer is working properly, I will try to finish the expansion-board for the pumps. I have a design for an 8 channel version on the way... :-)

lmorejon
11/04/2015, 12:32 PM
Thank you for sharing, very interested in 8 channel version to control led build I have in progress...
Luis

knabbuziak
11/04/2015, 03:48 PM
This computer has 12 channels for LEDs (connected to MeanWell LDDs), one channel for fans and one for Moonlight. The additional 8 channels are for pumps. All outputs are PWM.

... so with this computer you can add an additional 4 channels of LEDs to your build if you like to.

I've been looking for a way to simulate the phases of the moon an generate tide flows etcetera, but I haven't got that far yet.

knabbuziak
11/04/2015, 03:55 PM
I finished the soldering today and the computer seems to be working but the control unit was short circuited somewhere and I wasn't able to fix it. I will try to connect it to a breadboard instead just to make sure that it is working correctly. Hopefully before the end of this week.

knabbuziak
11/06/2015, 04:10 AM
Finished!

332705

All the hardware is now working properly. The computer consumes approximately 140mA with the backlight oft the LCD turned on (approximately 120mA without). I guess the LDD's will consume some as well, but that should not be any problem.

I encounterd some troubles regarding the controller (short circuits) and with the programming. I realised that some of the libraries were out of date, and the new libraries were not compatible with the code. I never got all of the new libraries to work with the code that I wrote, but I had all old libraries saved on another computer, so I will upload them here as well.

I still have some work to do with the code, but as I said - the hardware is done! :-) I will upload the PCB-file soon.

marspeed
11/06/2015, 05:02 AM
Looks good you made a lot of progress

lmorejon
06/03/2016, 08:58 AM
Been away for a while, any updates on this project?
Luis