5 Channel Led Strip Control

Hello there. I want to share my project with you. I designed a 5 channel led strip control circuit. You can control LEDs with external sensors that you connect to this circuit. If you are installing a motion sensor, I recommend that you do not use the ones developed for arduino. Use the ones developed for the alarm system. They work a lot more smoothly and stable. In addition, these sensors work with 12v such as Led Strip, you do not experience voltage problems. You can control the 5-meter Led Strip with each channel. If you want it to look as clean as I do, I’ll share the files below to make the PCB.


You can use a 7805 or 7833 voltage regulator. Whichever you use, you must select the appropriate jumper on the side according to the voltage regulator.



Parts:
1x NodeMcu V2 (Breadbord Friendly Model) : Link
4x IRLB8721 : Link
5x 2pin connector : Link
1x Femail Header(1x15p) : Link
1x Male Header : Link

Optional Part(s):
2x PIR Sensor : Link
1x LDR Sensor

PCB File : Link

Library : Link

Code


#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <FadeLed.h>

char auth[] = "xxx";
char ssid[] = "NtgAdmin";
char pass[] = "xxx";
//char server[] = "192.168.1.2";  // IP for Local Cloud Server
char server[] = "localServerAddress";  // URL for Blynk Cloud Server
int port = 8080;
bool isFirstConnect = true;

unsigned long previousMillis = 0; // last time update
unsigned long currentMillis = 0;
long interval = 7000; // interval at which to do something (milliseconds)
bool sensor1Actived = false;
bool sensor2Actived = false;

FadeLed ledD2(D2);
FadeLed ledD5(D5);
FadeLed ledD6(D6);
FadeLed ledD7(D7);
FadeLed ledD8(D8);
int button1 = D3; //pir sensor1
int buttonState1 = 0;
int button2 = D4; //pir sensor2
int buttonState2 = 0;

int  ledD2Time = 300;
int  ledD5Time = 300;
int  ledD6Time = 300;
int  ledD7Time = 300;
int  ledD8Time = 300;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  WiFi.begin(ssid, pass);  // Non-blocking if no WiFi available
  Blynk.config(auth, server, port);
  Blynk.connect();
  pinMode(button1, INPUT);
  pinMode(button2, INPUT);

  FadeLed::setInterval(15);
  ledD2.setTime(ledD2Time, true);
  ledD5.setTime(ledD5Time, true);
  ledD6.setTime(ledD6Time, true);
  ledD7.setTime(ledD7Time, true);
  ledD8.setTime(ledD8Time, true);
}


BLYNK_CONNECTED() {
  Serial.println("Connected");
  if (isFirstConnect) {
    Blynk.syncAll();
    isFirstConnect = false;
  }
}

void loop() {
  FadeLed::update();
  Blynk.run();
  currentMillis = millis();
  // put your main code here, to run repeatedly:
  buttonState1 = digitalRead(button1);
  buttonState2 = digitalRead(button2);
  //Serial.print(buttonState1);
  //Serial.print("          ");
  //Serial.println(buttonState2);

  if (buttonState1 == LOW) {
    previousMillis = currentMillis;
    sensor1Actived = true;
  }


  if (buttonState2 == LOW) {
    previousMillis = currentMillis;
    sensor2Actived = true;
  }

  if (sensor1Actived == true) {
    ledD2.on();
    if (ledD2.done()) {
      ledD5.on();
      if (ledD5.done()) {
        ledD6.on();
        if (ledD6.done()) {
          ledD7.on();
          if (ledD7.done()) {
            ledD8.on();
          }
        }
      }
    }
  }

  if (sensor2Actived == true) {
    ledD8.on();
    if (ledD8.done()) {
      ledD7.on();
      if (ledD7.done()) {
        ledD6.on();
        if (ledD6.done()) {
          ledD5.on();
          if (ledD5.done()) {
            ledD2.on();
          }
        }
      }
    }
  }


  if (currentMillis - previousMillis >= interval)   {
    previousMillis = currentMillis;
    //ledD2.falling();
    ledD2.off();
    ledD5.off();
    ledD6.off();
    ledD7.off();
    ledD8.off();
    sensor1Actived = false;
    sensor2Actived = false;
  }
}

I have designed the code with the PIR sensor activated and flashing with the fade effect. What you do with Blynk is up to your imagination. You can also control manually via Blynk

It’s not an unusual project, but I hope it helps someone who needs it.

8 Likes

looks very nice!

why are some of the MOSFETS labeled IRLB8722, IRLB8723 ?

Do you find that these MOSFETS provide the full 12V on the drain when switched with only 3.3V ?
When I tried that with FQP30N06LE they did not switch sufficient voltage to drive 5m of LEDs, so I had to add a gate driver chip TC4427.
You can see my circuit at https://cabin-layout.mixmox.com/2019/01/room-lighting-with-remotesign.html

Having such a nice board made makes the project so nice. It it cost effective to produce small numbers of such boards? Do you use an online service to make the board?

Hello. When you copy and paste objects, the drawing program automatically adds numbers to each of them. That’s why you can ignore the trailing numbers.

I tested this PCB before I did it. I haven’t had any problems. You can use it easily. The only thing I didn’t test was to connect 5 meters of LEDs to all channels and turn them all on at the same time. But I’il test this soon.

Good job. That’s what I did first.

Yes… Link

They make 10 of them for $ 2. But let me share a trick. $ 20 if you want to be sent by fast shipping. If you need a few more PCBs and add them to the basket, the cargo drops to $ 4. Delivery in 8 days.

2 Likes

wow very cheap!
Thanks for your answers!

1 Like

I have a look on your BCB traces, it seems you are using the LOW trigger to your LED strips? Is it better way against to the HIGH trigger? Thanks. By the way the PCB is nice.

At home I have a 5M LED trip long erected along the stairs with one simple PIR that it works well. Of couse the position of the PIR is the key to make sure the LED trip to be ON when moving close to it. Think much whether putting the Blynk in the between to monitor anyone to go up and down :slight_smile:

1 Like

Type N MOSFETs have to switch the negative side of the circuit.

1 Like

Do you think the smd one should be better looking as well as more compact but current limited. Anyway it is just an option just in case. Thanks bro !

Hello. Of course the SMD looks good. But I don’t have the necessary equipment for SMD assembly. And board needs a little test. As I said before, it would be no trouble to install 2-3 meters ledstrip on each channel, but if you put 5 meters on each one, you should try whether the roads will withstand.