Meanwell LDD driver: for those who want to dim to 0 using Arduino

I just built and programmed my new 10V Analog/ 5V PWM convertor. It's off to "Frog21"for testing. If it works well, you guys running an APEX wil have a cheaper alternative to the Steve'sleds Aquarium Controller Interface.

Here's a picture- isn't it cute?LOL

IMG_2189_zps0cc0ebdb.jpg

Oh yeah. Thanks, O2Surplus! ...and yes it's cute.
 
I just built and programmed my new 10V Analog/ 5V PWM convertor. It's off to "Frog21"for testing. If it works well, you guys running an APEX wil have a cheaper alternative to the Steve'sleds Aquarium Controller Interface.

Nice,looks like accurately made board.What is is board doing?
It says analog to PWM? From where Analog is coming?
 
Now that I have some coral in my tank I'm beginning to play with light settings. For you guys keeping SPS with Cree XTEs @ 1000mA, how long are you running them at full intensity? (If at all!)
 
Nice,looks like accurately made board.What is is board doing?
It says analog to PWM? From where Analog is coming?

The convertor accepts a 0 - 10V analog input from an APEX or other Controller, and converts it into a 5V PWM signal for control of LED drivers that can only accept 5V PWM dimming.

The chip on the PcB is an Atmega 328-AU clocked at 16Mhz. It's the same chip found on many versions of the Arduino micro-controller, so it's programmed using the Arduino IDE.
I buy the blank chips for around $2 each and burn in the boot loader myself, so the total cost to build one of these is under $10.:dance:
 
O2Surplus is very generous. He and some others on this thread set the standard for people to use their technical skills to try to help everyone make cool reefs. I hope others follow him and contribute/collaborate to make the technical items that make our reefs better. The hobby is expensive enough as it is and there's a lot of people on RC with various technical abilitites.

Pluses of the converter:
1. One can now program off their controller's software environment rather than learning Arduino. (BTW, Apex and RKE are pretty crude programs compared to learning Arduino, but for a lot/most people the time needed to do Arduino is too much)
2. One can take advantage of the seasonal shifts the Apex uses for Sun rise/set, moon rise/set times.
3. One of the big pluses of pwm is it does low level dimming, where the 1-10v dimming seems to go from fairly bright to off. Converter should make gradual low light dimming possible for 1-10v controller people. (This one's big, moon lights and the low light time on the reef is pretty cool).

Downside of the convertor: (only one I've found so far, minor)
1. One goes from the 255 pwm resolution/dimming steps to the 1-100% scale used by the Apex software (wonder what kind of resolution other controllers have)
 
Last edited:
I want to use that 0-10v to PWM converter for a DIY build controllable by Apex. I have a couple of questions for O2Surplus. Does this follow the same concept as the LDD boards (i.e., there is a file one can send to ITead to have them created) Or are you making a few to trade/sell? I would be interested in either, but would have more fun duplicating your work. Would the file that has the PCB design contain the component list to be soldered to it? I have an EE friend that I will be creating the DIY build with, I am sure she knows what all that stuff is called and could pick it out from the picture, but a list would make it almost fail proof for us.

I read where you said you burn the boot loader yourself. Does that mean if I buy the same chip listed I have to do something else to it before programming with the Arduino IDE? This would be my first time to use Arduino. I used to be a software developer a little more than a decade ago, I understand languages enough (At least I think I still have that stored in my brain somewhere) to not be scared off from the programming side.
 
I want to use that 0-10v to PWM converter for a DIY build controllable by Apex. I have a couple of questions for O2Surplus. Does this follow the same concept as the LDD boards (i.e., there is a file one can send to ITead to have them created) Or are you making a few to trade/sell? I would be interested in either, but would have more fun duplicating your work. Would the file that has the PCB design contain the component list to be soldered to it? I have an EE friend that I will be creating the DIY build with, I am sure she knows what all that stuff is called and could pick it out from the picture, but a list would make it almost fail proof for us.

I read where you said you burn the boot loader yourself. Does that mean if I buy the same chip listed I have to do something else to it before programming with the Arduino IDE? This would be my first time to use Arduino. I used to be a software developer a little more than a decade ago, I understand languages enough (At least I think I still have that stored in my brain somewhere) to not be scared off from the programming side.

This little PcB is made just like every other design that I've posted so far. I'm working with "Frogg21" on this project (frogg21 wrote the software) and he'll be testing them out w/ his APEX to assure that they work correctly. Hopefully we'll have a definitive answer by this weekend. If this batch works OK I'll post the build files along with a list of the components needed to build one yourself. I personally have no need for one of these myself, so there will be leftovers from this first batch will be up for grabs after "Frogg21" gets whatever # of units that he needs.
If anyone's interested in saving a few bucks on Atmega chips and wants to "Burn your Own", Check out this thread- Save $$ and "Burn your own" (Arduino Boot Loaders ) - Reef Central Online Community

I have to thank you guys for the kind words, as I'm happy to contribute to this forum whatever I can. The funny thing is- most of what I'm able to contribute now is the result of learning from other people on this very same forum!
 
converter

converter

We definitely need to do some polishing on the software side, the dimming is working, but it looks like the Apex 1-10v signal fluctuates enough to cause the light levels to 'wander' a little (plus or minus 3 pwms).. so some smoothing is needed. If anyone is a computer programmer please speak up as I only know what I've taught myself on Arduino and could use some experienced eyes to look over this code, it will be very simple for anyone with a programming background. I'm confident I can make it work right, there just may be a more elegant and efficient code to do what we need done..
 
Last edited:
We definitely need to do some polishing on the software side, the dimming is working, but it looks like the Apex 1-10v signal fluctuates enough to cause the light levels to 'wander' a little (plus or minus 3 pwms).. so some smoothing is needed. If anyone is a computer programmer please speak up as I only know what I've taught myself on Arduino and could use some experienced eyes to look over this code, it will be very simple for anyone with a programming background. I'm confident I can make it work right, there just may be a more elegant and efficient code to do what we need done..

Post up the code, if you please. There is a lot you can do for that. How much is the voltage wandering? how direct are you mapping the voltage to the PWM? What resolution PWM are you using?
 
Here's "Frogg21"'s code, thanks for taking a look-



Code:
/*

   Analog input, analog output, serial output

  Reads an analog input pin, maps the result to a range from 0 to 255

  and uses the result to set the pulsewidth modulation (PWM) of an output pin.

  Also prints the results to the serial monitor

  by Tom Igoe

  This example code is in the public domain.

 

  */

 

// These constants won't change.  They're used to give names

// to the pins used:

const int analogInPin0 = A0;    // Analog input pin that the potentiometer is attached to

const int analogInPin1 = A1;

const int analogInPin2 = A2;

const int analogInPin3 = A3;

 

 

const int analogOutPin5 = 5;      // Analog output pin that the LED is attached to

const int analogOutPin6 = 6;

const int analogOutPin9 = 9;

const int analogOutPin10 = 10;

 

int sensorValue0 = 0;        // value read from the 1-10v controller

int sensorValue1 = 0;

int sensorValue2 = 0;

int sensorValue3 = 0;

 

 

int outputValue5 = 0;        // value output to the PWM (analog out)

int outputValue6 = 0;

int outputValue9 = 0;

int outputValue10 = 0;

 

 

void setup() {

   // initialize serial communications at 9600 bps:

   Serial.begin(9600);

}

 

void loop() {

   // read the analog in value:

   sensorValue0 = analogRead(analogInPin0);           

   // map it to the range of the analog out:

   outputValue5 = map(sensorValue0, 0, 1023, 0, 255); 

   // change the analog out value:

   analogWrite(analogOutPin5, outputValue5);          

 

   // print the results to the serial monitor:

   Serial.print("sensor 0 = " );                      

   Serial.print(sensorValue0);     

   Serial.print("\t output = ");     

   Serial.println(outputValue5);  

   // wait 1000 milliseconds before the next loop

   // for the analog-to-digital converter to settle

   // after the last reading:

   delay(1000);                    

   

   

sensorValue1 = analogRead(analogInPin1);           

   outputValue6 = map(sensorValue1, 0, 1023, 0, 255); 

   analogWrite(analogOutPin6, outputValue6);          

   Serial.print("sensor 1= " );                      

   Serial.print(sensorValue1);     

   Serial.print("\t output 6= ");     

   Serial.println(outputValue6);  

   delay(1000);              

 

sensorValue2 = analogRead(analogInPin2);           

   outputValue9 = map(sensorValue2, 0, 1023, 0, 255); 

   analogWrite(analogOutPin9, outputValue9);          

   Serial.print("sensor 2= " );                      

   Serial.print(sensorValue2);     

   Serial.print("\t output 9= ");     

   Serial.println(outputValue9);  

   delay(1000);    

   

sensorValue3 = analogRead(analogInPin3);           

   outputValue10 = map(sensorValue3, 0, 1023, 0, 255); 

   analogWrite(analogOutPin10, outputValue10);          

   Serial.print("sensor 3= " );                      

   Serial.print(sensorValue1);     

   Serial.print("\t output 10= ");     

   Serial.println(outputValue10);  

   delay(1000);    

 

}
 
Good job holding down the fort O2!

I've been working on some other things for the Jebao DC pumps so I've had trouble keeping up with all the cookie jars my fingers are in. Along with that other thing we have to do called work.
 
Good job holding down the fort O2!

I've been working on some other things for the Jebao DC pumps so I've had trouble keeping up with all the cookie jars my fingers are in. Along with that other thing we have to do called work.


did I mention i was ordering two of the Jebao 40's?

:D
 
Hi iced98lx,
How much is the voltage wandering? it's backstepping as much as 4 analog or 2 pwm

how direct are you mapping the voltage to the PWM? analog read is 0-1024, being mapped to 0-255 pwm (we can easily read the analog in pin in 1024 divide it by 4 and be on a 1:1 ratio with pwm and no need for mapping if it helps anything)

What resolution PWM are you using? 255 (I think this is non negotiable as the LDD's want to see 0-255)

Hope you can give some input here.. Here's a sample of the 1-10v analog reading that my arduino is seeing from the Apex during a ramp/dim up period this morning (see "sensor 0"). The corresponding pwm value that the sensor value is mapping to is the "output". These readings were taken every 1 second. You can see that while the general direction is up as it should be it back steps because of the fluctuations seen in the analog apex signal and even the 1 pwm backsteps are visible in the LEDs and bothersome.

sensor 0 = 698 output = 173
sensor 0 = 700 output = 174
sensor 0 = 701 output = 174
sensor 0 = 699 output = 174
sensor 0 = 698 output = 173
sensor 0 = 703 output = 175
sensor 0 = 703 output = 175
sensor 0 = 700 output = 174
sensor 0 = 702 output = 174
sensor 0 = 704 output = 175
sensor 0 = 705 output = 175
sensor 0 = 701 output = 174

We can resolve this by putting the analog write in a if statement something like
void loop() {
sensorValue0 = analogRead(analogInPin0); // read the analog in value:
outputValue5 = map(sensorValue0, 0, 1023, 0, 255); // map it to the range of the analog out:
if (analogOutPin5 > previousAnalogOutPin5) // only change value if its moving up
{
analogWrite(analogOutPin5, outputValue5); // change the value
previousAnalogOutPin5 = analogOutPin5; // increment the previous reading to check against future readings

Serial.print("sensor 0 = " ); // print the results to the serial monitor:
Serial.print(sensorValue0);
Serial.print("\t output = ");
Serial.println(outputValue5);
}

This works good for ramping up, but we need to reverse the logic for ramping down and how to do that isn't so clear to me.. So when it's ramping up, it only writes if the value of the sensor pin is bigger than the last, but when ramping down we need the opposite, only write if the sensor value is smaller than the last reading.
Course maybe there's a totally different approach (maybe some way to average the last x number of pin readings?). I'm no programmer. Appreciate any help and look forward to some cute code to match that cute pcb!
 
Last edited:
got some wiring done today, still have to purchase led's and the power supply as well as the controller.
I was going to go DIY, but i don't like the current setups with the stacking of boards and the use of bread boards for some, i just want a simple led controller, i have found one new build that i like, but so far no word from the creator if he is going to make it open source, which would be perfect because it is a 16 channel led controller. so for now i am going with 4 channels and controlling it with a typhon led controller.


DSC_3299-M.jpg


Since i was using 22 awg wires and the drivers are 1amp i went with a diy twisted pair to put me over 1 amp with head room so i don't run into any issues. 1x 22awg is ruffly 0.96 amps IIRC. the LDD's that i have are 1000ma( 1amp) do i have this correct?

DSC_3300-M.jpg


dc to dc step down to power the fans and the controller ( this will take 36v and step it down to what ever i like) so i will run them at around 9v, maybe 12v)

DSC_3301-M.jpg


DSC_3302-M.jpg


tek light t-5 empty shell i gutted, i will be using c-channels for this builds.

DSC_3260-M.jpg
 
I just built and programmed my new 10V Analog/ 5V PWM convertor. It's off to "Frog21"for testing. If it works well, you guys running an APEX wil have a cheaper alternative to the Steve'sleds Aquarium Controller Interface.

Here's a picture- isn't it cute?LOL

IMG_2189_zps0cc0ebdb.jpg

Great job O2Surplus, as always.
Could you use this converter to control with Profilux an LDD driven LEDs fixture?
 
You could always add up a few readings from each analog input and then average them to get more consistent readings. You may need to switch to long variables depending on how many readings you want to average.
 
Hi iced98lx,
How much is the voltage wandering? it's backstepping as much as 4 analog or 2 pwm

how direct are you mapping the voltage to the PWM? analog read is 0-1024, being mapped to 0-255 pwm (we can easily read the analog in pin in 1024 divide it by 4 and be on a 1:1 ratio with pwm and no need for mapping if it helps anything)

What resolution PWM are you using? 255 (I think this is non negotiable as the LDD's want to see 0-255)

Hope you can give some input here.. Here's a sample of the 1-10v analog reading that my arduino is seeing from the Apex during a ramp/dim up period this morning (see "sensor 0"). The corresponding pwm value that the sensor value is mapping to is the "output". These readings were taken every 1 second. You can see that while the general direction is up as it should be it back steps because of the fluctuations seen in the analog apex signal and even the 1 pwm backsteps are visible in the LEDs and bothersome.

sensor 0 = 698 output = 173
sensor 0 = 700 output = 174
sensor 0 = 701 output = 174
sensor 0 = 699 output = 174
sensor 0 = 698 output = 173
sensor 0 = 703 output = 175
sensor 0 = 703 output = 175
sensor 0 = 700 output = 174
sensor 0 = 702 output = 174
sensor 0 = 704 output = 175
sensor 0 = 705 output = 175
sensor 0 = 701 output = 174

We can resolve this by putting the analog write in a if statement something like
void loop() {
sensorValue0 = analogRead(analogInPin0); // read the analog in value:
outputValue5 = map(sensorValue0, 0, 1023, 0, 255); // map it to the range of the analog out:
if (analogOutPin5 > previousAnalogOutPin5) // only change value if its moving up
{
analogWrite(analogOutPin5, outputValue5); // change the value
previousAnalogOutPin5 = analogOutPin5; // increment the previous reading to check against future readings

Serial.print("sensor 0 = " ); // print the results to the serial monitor:
Serial.print(sensorValue0);
Serial.print("\t output = ");
Serial.println(outputValue5);
}

This works good for ramping up, but we need to reverse the logic for ramping down and how to do that isn't so clear to me.. So when it's ramping up, it only writes if the value of the sensor pin is bigger than the last, but when ramping down we need the opposite, only write if the sensor value is smaller than the last reading.
Course maybe there's a totally different approach (maybe some way to average the last x number of pin readings?). I'm no programmer. Appreciate any help and look forward to some cute code to match that cute pcb!

Will take a stab at some suggestions soon, finishing up work stuff this weekend.

You could always add up a few readings from each analog input and then average them to get more consistent readings. You may need to switch to long variables depending on how many readings you want to average.

Yea, we're going to want to introduce a smoothing algorithm, it'll had a small delay (depending on how bad the jitter is) to the response but we can base movement on trends, then set up a fade function that stacks it up so once the trend is established (oh you really are turning it down!) the light fades evenly.
 
Does anyone have any spare 4 LDD boards with the drop down resistor? I need 4 all together but hopefully I can get one or two from several people... or if someone can help me to order directly from Itead, I can't seem to make heads or tails about ordering custom boards from them.
 
Last edited:
Back
Top