Advance DIY

Using HP LED dimmer with Arduino

Advance DIY,DIY Blog No Comments

It really easy to use our high power LED dimmer with Arduino First Take the Dimmer PCB out of the Case than remove the ribbon cable on the top right After you remove the ribbon cable you will see 6 pins with the connectors facing down starting from the left it

GND, +5V, D1, D2, D3, D4. To Control with dimmer with arduino you need to sent signals to the four pins d1,d2,d3, d4

This Following Chart is how you would sent signals to the dimmer in binaries where 0 is low and 1 is high

To Connect the dimmer to the Arduino just connect GND the first pin to arduino GND and D1,D2,D3,D4 to any of the arduino digital output pin in this example I’m going to connect it to arduino pin 8, 9, 10, 11. now the +5V connect it to arduino +5V the Dimmer is able to power the Arduino with that pin if you connect it, it creates a relation of the Dimmer Giving power to Arduino and Arduino is able to give signal to the dimmer.

The Following Code is an example where i crank the led on the first channel up than follow by channel two than down.

//XpressDIY dimmer example

int d1=8;
int d2=9;
int d3=10;
int d4=11;

void setup()
{
//define the pin as output
pinMode(d1, OUTPUT);
pinMode(d2, OUTPUT);
pinMode(d3, OUTPUT);
pinMode(d4, OUTPUT);

lcd.begin(20, 4);
pinMode(A5, INPUT);

}

void loop()
{
    for(int a=0; a<225; a++){
      // need to sent signal 225 times to acheive maxinum brightness
      //sending a plus to channel 1 like the chart it 0010 so we need to sent
      //the following signal.
      //d1 to pin 8
      digitalWrite(d1,LOW);
      //d2 to pin 9
      digitalWrite(d2,LOW);
      //d3 to pin 10
      digitalWrite(d3,HIGH);
      //d4 to pin 11
      digitalWrite(d4,LOW);
      //need at least 200ms delay in between.
      delay(200);
}
//give it a pause after 1 channel is dimm optional
delay(1000);
    //now for the second channel to plus it from the charts it 0100
    //so it the following signal
    for(int s=0; s<225; s++){
      digitalWrite(d1,LOW);
      digitalWrite(d2,HIGH);
      digitalWrite(d3,LOW);
      digitalWrite(d4,LOW);
      delay(200);
}

  delay(200);
  //now to dim the first channel it 0001
  for(int s=0; s<225; s++){
      digitalWrite(d1,LOW);
      digitalWrite(d2,LOW);
      digitalWrite(d3,LOW);
      digitalWrite(d4,HIGH);
      delay(200);

}
}

 

 

Share this

Leave a Comment

You must be logged in to post a comment.

Highslide for Wordpress Plugin