Introduction:-


This is Dj Light with its Controller. it can be operated by two modes i.e manual and recording
 mode. In manual mode, we have to manually control on/off the LED strip by the help of switch present in the controller. In the recording mode, first of all, we have to set the sequence in which the LED strips get on/off. In its Arduino coding, i have implemented Queue data structure.So FIFO(First in First Out) Sequence will be implemented in the Dj Light.That means when the record Mode of the Dj Light is On at that time, which led strip will push in the queue that led strip will glow first, then followed by Other Led strip will Glow.


Parts Required:-

  1. Arduino Uno
  2. Slider Switch * 5
  3. On/Off Switch * 4
  4. 5v Relay
  5. Red, Green, Pink, Blue Led * 5
  6. 800Ohm Resister * 20
  7. Female Header pin
  8. Dc Female, Male Socket
  9. Wire, Tools, Etc.

Procedure:-

  • First of all insert one led into the Vero board, Now connect an 800 Ohm resistor to the Vcc pin of the Led.
  • Now Connect Similarly Connect the rest 4 led of the Same Color.And make a common Vcc, GND by Connecting all led+Resistor in parallel.As connected Below.
  • Now Repeat the Same Procedure for rest 3 Color of led.
  • Now Let's have Looked on the pin configuration of the Relay(N.B. the relay You are using may be different from the Relay I am using here Note it)
  • Now Connect all Normally opened Pin of the 4 relays to the 12 Vcc.
  • Now Connect one the Coil Pin of each relay to the 12V GND.
  •  
  • Now connect the Leftover coil pin of all the 4 relay the female header of 4 pin
  • It time to connect the common pin of each relay to different Vcc pin Led Strips, Common GND of the Led Strips to 12v GND.
  • Now supply 12v power to the Arduino Uno.
  • Now connect the Pin 13,12,11,10 Of the Arduino to the Female Header pin's as connected in the Diagram below.
  • Now Its time to make the Controller, Connect all the Switch according to the diagram below
  • Now connect the middle pin of the slider switch to the A0, A1, A2, A3 and A5 pin of the Arduino, Remember that the Switch wich will be connected to the A5 pin of the Arduino that will act as the shifter between Manual Mode and Record Mode.Now Connect the Rest part |According to the Image Given Below.
  • Now Upload the arduino code:-
  • /////////////www.beginnertopro.in ////////////////////////////

    int q[3];

    int top=0;

    ////////////////////////////////////////

    double x1,x2,x3,x4;

    ////////////led strip 1 intialization////////////////

    int spin1=0;

    double svalue1=0;

    unsigned long stime1=0;

    unsigned long etime1=0;

    unsigned long dtime1=0;

    ////////////led strip 2 intialization////////////////

    int spin2=A1;

    double svalue2=0;

    unsigned long stime2=0;

    unsigned long etime2=0;

    unsigned long dtime2=0;

    ////////////led strip 3 intialization////////////////

    int spin3=A2;

    double svalue3=0;

    unsigned long stime3=0;

    unsigned long etime3=0;

    unsigned long dtime3=0;

    ////////////led strip 4 intialization////////////////

    int spin4=A3;

    double svalue4=0;

    unsigned long stime4=0;

    unsigned long etime4=0;

    unsigned long dtime4=0;

    /////////////Rcord Mode Itialization////////////////////

    int rpin=A5;

    double rvalue=0;

    /////////////////End Of Variable intialization/////////

    void setup() {

    pinMode(13, OUTPUT);

    pinMode(12, OUTPUT);

    pinMode(11, OUTPUT);

    pinMode(10, OUTPUT);

    Serial.begin(9600);

    for(int i=0;i<4;i++){

    q[i]=0;

    }

    }





    void loop() {

    dis();

    rvalue=analogRead(rpin);

    double rx=return_value(rpin,rvalue);

    if(rx > 4){

    ///////////For Led Strip1///////////////////////

    svalue1=analogRead(spin1);

    x1=return_value(spin1,svalue1);

    if(x1 > 4){

    insert(0);

    stime1= millis();

    led1();

    }

    ///////////For Led Strip2///////////////////////

    svalue2=analogRead(spin2);

    x2=return_value(spin2,svalue2);

    if(x2 > 4){

    insert(1);

    stime2= millis();

    led2();

    }

    ///////////For Led Strip3///////////////////////

    svalue3=analogRead(spin3);

    x3=return_value(spin3,svalue3);

    if(x3 > 4){

    insert(2);

    stime3= millis();

    led3();

    }

    ///////////For Led Strip4///////////////////////

    svalue4=analogRead(spin4);

    x4=return_value(spin4,svalue4);

    if(x4 > 4){

    insert(3);

    stime4= millis();

    led4();

    }



    /////////////////////////////////Sequence to On/Off Led Light//////////////////////////////////////

    for(int i=0;i<4;i++){

    if(q[i]==0){

    if(dtime1 >0)

    led1_active();

    }else if(q[i]==1){

    if(dtime2 >0)

    led2_active();

    }else if(q[i]==2){

    if(dtime3 >0)

    led3_active();

    }else if(q[i]==3){

    if(dtime4 >0)

    led4_active();

    }

    }

    ///////////////////////////////End Of Sequence to On/Off Led Light/////////////////////////////////////

    }else{

    Serial.println("Record Mode Off");

    delay(500);

    }

    delay(2);

    }



    void led1(){

    svalue1=analogRead(spin1);

    x1 = svalue1 / 204.6;

    if(x1 > 4){

    Serial.println("LedOn1 if");

    led1();

    }else{

    Serial.println("LedOn1 else");

    etime1= millis();

    Serial.print("Start Time:");

    Serial.print( stime1 );

    Serial.print(", EndTime:");

    Serial.print(etime1);

    Serial.println("");

    dtime1=etime1-stime1;

    Serial.print("Difference in time:");

    Serial.print(dtime1);

    Serial.println("");

    }

    }

    void led2(){

    svalue2=analogRead(spin2);

    x2 = svalue2 / 204.6;

    if(x2 > 4){

    Serial.println("LedOn2 if");

    led2();

    }else{

    Serial.println("LedOn2 else");

    etime2= millis();

    Serial.print("Start Time:");

    Serial.print( stime2 );

    Serial.print(", EndTime:");

    Serial.print(etime2);

    Serial.println("");

    dtime2=etime2-stime2;

    Serial.print("Difference in time:");

    Serial.print(dtime2);

    Serial.println("");

    }

    }

    void led3(){

    svalue3=analogRead(spin3);

    x3 = svalue3 / 204.6;

    if(x3 > 4){

    Serial.println("LedOn3 if");

    led3();

    }else{

    Serial.println("LedOn3 else");

    etime3= millis();

    Serial.print("Start Time:");

    Serial.print( stime3 );

    Serial.print(", EndTime:");

    Serial.print(etime3);

    Serial.println("");

    dtime3=etime3-stime3;

    Serial.print("Difference in time:");

    Serial.print(dtime3);

    Serial.println("");

    }

    }

    void led4(){

    svalue4=analogRead(spin4);

    x4 = svalue4 / 204.6;

    if(x4 > 4){

    Serial.println("LedOn4 if");

    led4();

    }else{

    Serial.println("LedOn4 else");

    etime4= millis();

    Serial.print("Start Time:");

    Serial.print( stime4 );

    Serial.print(", EndTime:");

    Serial.print(etime4);

    Serial.println("");

    dtime4=etime4-stime4;

    Serial.print("Difference in time:");

    Serial.print(dtime4);

    Serial.println("");

    }

    }

    void led1_active(){



    digitalWrite(13,HIGH);

    Serial.print("Led1 On For:");

    Serial.print(dtime1);

    Serial.println("");

    delay(dtime1);

    digitalWrite(13,LOW);

    Serial.print("Led1 Off");

    Serial.println("");



    }

    void led2_active(){



    digitalWrite(12,HIGH);

    Serial.print("Led2 On For:");

    Serial.print(dtime2);

    Serial.println("");

    delay(dtime2);

    digitalWrite(12,LOW);

    Serial.print("Led2 Off");

    Serial.println("");



    }

    void led3_active(){



    digitalWrite(11,HIGH);

    Serial.print("Led3 On For:");

    Serial.print(dtime3);

    Serial.println("");

    delay(dtime3);

    digitalWrite(11,LOW);

    Serial.print("Led3 Off");

    Serial.println("");



    }

    void led4_active(){



    digitalWrite(10,HIGH);

    Serial.print("Led4 On For:");

    Serial.print(dtime4);

    Serial.println("");

    delay(dtime4);

    digitalWrite(10,LOW);

    Serial.print("Led4 Off");

    Serial.println("");



    }

    double return_value(int pin,int value){

    double y = value / 204.6;

    Serial.print(pin);

    Serial.print(" Value : ");

    Serial.print(y);

    Serial.print(" V");

    Serial.println("");

    return y;

    }



    void dis(){

    for(int i=0;i<4;i++){

    Serial.print(i);

    Serial.print(" ");

    Serial.print(q[i]);

    Serial.println("");

    if(q[i] > 3 || q[i]<0){

    q[i]=0;

    }

    }

    }



    void insert(int led){

    if(top < 3){

    q[top]=led;

    top++;

    }else if(top==3){

    q[top]=led;

    top=0;

    }else{

    top=0;

    q[top]=led;

    top++;

    }

    }

For making Watch this Video:-
Thanks For Watching Please Like, Share & subscribe.
>