recklessop Posted December 12, 2015 Share Posted December 12, 2015 Recently I bought the ReapidLED 90g dimmable kit. It's working great and a DIY build thread is coming soon. But in order to dim them, I needed a PWM controller. The Arduino platform has examples of how to do analog input to PWM output where you can control PWM via a PET... but I wanted something that would be hands off and automatically dim the lights based on the time of day. Eventually I will be building a more complex Arduino control from code that other saltwater geeks already have out there... but until I can get an LCD screen and the time to build it I needed something quick! This is just that. You should be able to build this for about $30 bucks, and without any soldering... Required Parts: 1 - Arduino board (doesnt really matter which one) the diagram uses a nano.. Amazon for $12.00 1 - I2C Realtime Clock ... Amazon for $3.00 shipped 2 - Pentonometers ... Amazon for $6 bucks each (these are optional and only required if you want to take manual control of the lights) 1 - Breadboard ... Amazon $2.25 total = about $30 Alternatively if you want to make it even more professional looking you could sub out the breadboard for a Nano IO Shield and a plug in RTC.. this will add about 12 bucks to the total cost. Here is the layout: So basically with my Rapid LED kit i can plug wires from the LDD drivers to the PWM out pins on the arduino and then when i fire up the arduino it will calculate what the white and the blue channels need to be and set the correct PWM frequency. To start out I created a spreadsheet with a roughed out schedule... this will probably change... but i needed to start somewhere. The values in this table were then plugged into the arduio sketch and it is what runs the dimming when in Automatic mode. Manual mode is simply controlled by the two PET sensors. Code is attached as im sure it wont copy in to the post well. Here is what the Serial output looks like right now: As you can see each minute a new PWM value is calculated for both the blue and white channels. It does this by taking the value you specified at hour 1 and the value you specified at hour 2 and figuring out what the gap is... then it spreads that gap evenly over the hour. So if at 8AM you want 10% brightness on blues and at 9AM you want 20% ... there is a 10 percent gap.. which is about 25 PWM levels so if we spread that change over 60 minutes we need to increase the PWM level by 1 point about ever 2 minutes ... This gives a pretty smooth ramp up and down... at least smooth enough that you probably wont notice unless you are stairing into the lights.... Overall its working well so far... Ill post any updates to the code here so that if you decide you need something quick and simple you will have the latest version. RTC_Lights.zip Version 1.0 - 12/11/2015 Jesse and Incolor 2 Quote Link to comment Share on other sites More sharing options...
Muttley000 Posted December 12, 2015 Share Posted December 12, 2015 Very nice, thanks for posting and look forward to the "Full Version" Quote Link to comment Share on other sites More sharing options...
Jesse Posted December 12, 2015 Share Posted December 12, 2015 Very nice post. Thanks for sharing. Quote Link to comment Share on other sites More sharing options...
trickedout900 Posted December 12, 2015 Share Posted December 12, 2015 Very cool, wish I had some electronic skills Quote Link to comment Share on other sites More sharing options...
Muttley000 Posted December 12, 2015 Share Posted December 12, 2015 Very cool, wish I had some electronic skills Just follow the diagram, this would be a perfect way to learn! Quote Link to comment Share on other sites More sharing options...
recklessop Posted December 12, 2015 Author Share Posted December 12, 2015 Just follow the diagram, this would be a perfect way to learn! yeah i wanted to make it so that there was no soldering and you could just plug in wires and components into a board... plug it into USB port on the computer and upload the code and your all done. Quote Link to comment Share on other sites More sharing options...
Joe Posted December 12, 2015 Share Posted December 12, 2015 Wish I had a cool diagram like that when I was trying to put my lights together. Thanks for sharing. Quote Link to comment Share on other sites More sharing options...
recklessop Posted December 12, 2015 Author Share Posted December 12, 2015 v1.1 - I fixed some little bugs as well as added an LCD output too the code. It shows current time as well as blue channel percentage followed by the actual PWM value (0-255) and then on the bottom line the same thing but for the white channel. (didnt wanted to leave it plugged into my computer to see where things were at as far as percentages) as for wiring the LCD, mine was an I2C module. so it plugs in to the same ports as the RTC Screenshot of the LCD output RTC_Lights_LCD_v1.1.zip Quote Link to comment Share on other sites More sharing options...
recklessop Posted December 12, 2015 Author Share Posted December 12, 2015 Another bug fix.... I wasnt calculating percentage of PWM ... instead i was just assigning a value based on the table ... fixed that... now percentages are actually percentages... RTC_Lights_LCD_v1.2.zip Quote Link to comment Share on other sites More sharing options...
MBS Posted December 20, 2015 Share Posted December 20, 2015 Nice work. You'll want to add a 10k resistor between your ldd (+) and (-) feed pins ... Vin on the ldd driver in your diagram. This is. "Pull down" resistor which is necesary to allow all your grounds to be connected, allow the driver to operate when connected and called for by the controller ... And shut off if the contoller loses power. In most setups, the arduino is powered seperately from the LDD drivers (arduino at 6-10v DC, LDDs 12+ V DC depending on your driver and LED load. Without the pulldown, the LEDs fail on if the controller loses power. Quote Link to comment Share on other sites More sharing options...
recklessop Posted December 20, 2015 Author Share Posted December 20, 2015 Agreed, however the LDD driver board that Im using in my actual setup has the pull down resistors onboard, which is why i forgot to show them on the fritz. Im using the LDD driver board that rapidLED.com sells. Quote Link to comment Share on other sites More sharing options...
recklessop Posted December 22, 2015 Author Share Posted December 22, 2015 Another Code update. Release notes: Fixed some LCD display weird-ness Adjusted rate at which the lights rev up and down to fit my schedule. Quote Link to comment Share on other sites More sharing options...
recklessop Posted December 22, 2015 Author Share Posted December 22, 2015 Another Code update. Release notes: Fixed some LCD display weird-ness Adjusted rate at which the lights rev up and down to fit my schedule. I should also note that the LCD displayed the time as well as the two channels. And there is two numbers for each channel. The first number on each chanel (before the '%' sign) is the percentage, the second number is the actual PWM level (so 0-255) I added that so that when it hits "0%" but is still on, i know that its only at level 1 or level 2 etc. RTC_Lights_LCD_v1.3.zip Quote Link to comment Share on other sites More sharing options...
Thrwnsprkz Posted January 30, 2016 Share Posted January 30, 2016 This is great. I was just starting to get into arduino controllers and wanted to start experimenting. Perfect first project to get my hands dirty! Thanks! Quote Link to comment Share on other sites More sharing options...
Muttley000 Posted January 30, 2016 Share Posted January 30, 2016 This is great. I was just starting to get into arduino controllers and wanted to start experimenting. Perfect first project to get my hands dirty! Thanks! Keep us updated, I like hearing people doing more of this and seeing the results Quote Link to comment Share on other sites More sharing options...
Thrwnsprkz Posted February 3, 2016 Share Posted February 3, 2016 absolutely, I started tweaking your code for my own schedule and learning how you wrote this. (excellent walk through btw)parts are ordered and I'm excited to try this and more in the future.ideally working out a personalized version of the code to run all kinds of equipment this makes me wish I had just built my own light setup (maybe a future project!) Quote Link to comment Share on other sites More sharing options...
Ondrej Posted October 8, 2018 Share Posted October 8, 2018 Hello, I would like downloading and try your code, but is deleted from server. Can you reupload please? Thank you. Quote Link to comment Share on other sites More sharing options...
OZREEFER Posted November 19, 2019 Share Posted November 19, 2019 HI Just started playing with Arduino and have used your program to add some supplementary lights to tank, works a treat. Thanks for sharing, will post some photos when project is finished crimsonvice and Muttley000 2 Quote Link to comment Share on other sites More sharing options...
Muttley000 Posted November 19, 2019 Share Posted November 19, 2019 4 hours ago, OZREEFER said: HI Just started playing with Arduino and have used your program to add some supplementary lights to tank, works a treat. Thanks for sharing, will post some photos when project is finished I look forward to seeing what you came up with! Quote Link to comment Share on other sites More sharing options...
Filipkulis Posted April 25, 2020 Share Posted April 25, 2020 Hi can you help me. I connect LDD see image. And I have problem with switch off led. When Is on controller PWM 0, led faintly light. When I disconnect pwm wire from arduino, there is same fault. On image not drawings Button on pin A0,A1,A2 with pull rezistor 10k, and Relay on pin 8 for fan. Sorry for my English. It is not my mother language. Thank you, Filip. Quote Link to comment Share on other sites More sharing options...
Muttley000 Posted April 27, 2020 Share Posted April 27, 2020 First welcome to the forum and your English is better than my (insert any language on the planet here!). The original poster has not been around here for quite some time unfortunately. Do the colors on your drawing signify the actual colors coming off the driver? If so the black is supposed to be for the negative voltage in not the blue. If they don’t mean anything can you tell us what you have hooked where so we can possibly help troubleshoot further? Red should connect to positive on power supply, black should go to minus. White is the pwm signal. Yellow is LED plus and blue is led minus. Quote Link to comment Share on other sites More sharing options...
Filipkulis Posted April 27, 2020 Share Posted April 27, 2020 No, it is not reality color. It is only oriantion scheme. Problem is solvet. I have cable in bunch. I think there is induction current about 2mV. I send image for inspiration. Quote Link to comment Share on other sites More sharing options...
Muttley000 Posted April 27, 2020 Share Posted April 27, 2020 2 minutes ago, Filipkulis said: No, it is not reality color. It is only oriantion scheme. Problem is solvet. I have cable in bunch. I think there is induction current about 2mV. I send image for inspiration. Nice! Thanks for sharing Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.