Create a Mini Project for Testing Switching Cycles of Public Street Lamp Based on LEDs

by yahiamoh in Circuits > Arduino

112 Views, 1 Favorites, 0 Comments

Create a Mini Project for Testing Switching Cycles of Public Street Lamp Based on LEDs

WhatsApp Image 2024-04-05 à 02.24.36_d0ed134c.jpg
Hello, This project is dedicated to electronics students or those who wish to learn about electronics, Embedded System, project implementation based on Arduino, IOT or those who just want to understand what the field of electronics, programming of electronic cards or programming of microcontrollers.


This tutorial presents the design of a small electronic prototype using the Arduino card to test the switching cycles of public street lamp based on LEDs (independent LED module).


" I made this prototype following the customer's request. This request consists of submitting two LED-based public street lamps to a switching cycle test of 12,500 cycles,"


This tutorial contains two parts:

  1. Creation of the mini prototype
  2. The final test of the prototype.

Supplies

produits.png

1- Creation of the mini prototype :

1-1 The electronic components used in this project :

The components that were selected are:

  • One Arduino UNO
  • Two 5V relay modules
  • Two 5A ACS712 current sensors ref(ACS712_05B)
  • One I2C LCD screen (lcd 4x20)
  • One test plate
  • Connection wires

1-2 Customer request (technical specification):

The specification proposed by the customer is to create a small circuit whose function is to flash the two LED-based street lamps (30s off and 30s on) for a period of 1 minute, all for 12,500 cycles, or one cycle per minute. , with cycle count display on the LCD screen.


  • Customer requirement:
If the street lamp stops flashing well before the end of the 12,500 cycles, in this case the street lamp is non-compliant.
and if the street light still flashes after the end of 12,500 cycles or if it stops after the end of 12,500 cycles, then in this case the street light is compliant.


1-3 Calculate:

If I divide 12,500 cycles by 60 seconds it will give me 208 hours and if I divide 208 hours by 24 hours the result will be 8.6 days.

SO! The switching cycle test will last almost 9 days


1-4 detecting the status of street lamp:

SO ! I added two 5V ACS712 current sensors to calculate the current of each street lamp, And to know if the SSL product was damaged before 12500 cycles or not, So the microcontroller receives the information from these current sensors then depending on From this information it will display on the LCD screen which street lamp is compliant or not.


Note:
Compliant means the floor lamp is not damaged
and non-compliant means that the lamp post is damaged

Conceptual Diagram and Explanation of the Working Principle

Schema conceptuel.png

The image above shows the conceptual diagram and operating principle

1-5 Explanation of the working principle:

The operating principle of this prototype is as follows: the processing unit (microcontroller of Arduino Uno) executes tasks by operating actuators such as 5V relays according to the timer (Timer1), and it will process the information. coming from the current sensors of each street lamp tested.

Among the operations it performs:

  • Depending on the timer (Timer1) it activates the opening or closing of the relay (30s open/30s closed), after 1 min, it increments the cycle count to say that the cycle has been carried out then it displays the result in the LCD display
  • To know if the current passing through the street light has become (0.09 A or less) before or after 12,500 cycles, so if the current becomes (0.09 A or less) before 12,500 cycles, it will display the status of the street lamp in the form of text “hub1: non-compliant” or “hub2: non-compliant” then it will deactivate the switching of the relay provided for this street lamp, And if the 12,500 cycles are carried out and the current remains greater than 0.09 A or the current becomes (0.09A or less) after 12,500 cycles, the processing unit will display text on the LCD "hub1: compliant" or "hub2: compliant".
  • If the current of the two street lamps remains greater than 0.09 A after 12500 cycles, Here the street lamps will be considered “compliant”, Then the processing unit will display these texts “hub1: compliant” and “hub2: compliant”.


Now I move on to creating the diagram


1-6 schematic design :

The Circuit Diagram of the Prototype to Be Made

cycle de cummu.png

The diagram above shows the circuit diagram of the prototype to be made

(Schematic is presented by the Arduino online simulator (Wokwi))


1-7 Programming the Arduino or microcontroller:

The image below shows a simplified flowchart of the program, that is, it explains only the principle of operation of the program.

  • Program flowchart :

Program Flowchart

Organigrame.png
now since I have made my diagram in the simulation software I move on to the next step in which I translate my flowchart into a program on c language of arduino.


if you want to download the Arduino IDE go to the official Arduino website and download the IDE, here is the direct link to the download : IDE ARDUINO

So I need to open my Arduino IDE so I can write my program.

Writing My Program in C Language

1659348717-software-arduino-pro-ide.png

The image above shows the interface of the Arduino IDE, What you see in there it is not our program it is just an example of an arduino program, But I am going to I'm going to write my own program


Here is my program that I have to write :


First of all you must download the libraries (TimerOne, the current sensor module (ACS712_05B library) and the I2C LCD screen library (LCD 4x20)) then install them in your IDE. To find out how to download these libraries and them install they watch a video on YouTube.


#include <ACS712.h>               //Import current sensor module library
#include "Wire.h"
#include "TimerOne.h" //Import Timerone library
#include "LiquidCrystal_I2C.h" //Import LCD screen library
ACS712 mySensor(ACS712_05B,A1); /*Initialize and configure Analog Port A1 read current transmitted from current
*/sensor ACS712_05B
ACS712 mySensor2(ACS712_05B,A0); /*Initialize and configure Analog Port A0 read current transmitted from current
*/sensor ACS712_05B


LiquidCrystal_I2C LCD(0x27,16,4); // définit le type d'ecran lcd 16 x 2
int pin1 = 2,pin2 = 3;
int lim = 12500;
unsigned short compt = 0;
bool Flag = true;
unsigned short seconde = 0;
bool Activate = true;
bool hub1 = false,hub2 = false;
int ii = 0;


void setup() {


  Serial.begin(9600);
  LCD.init(); // initialisation de l'afficheur
  LCD.backlight();
   
  LCD.setCursor(1, 0);
  LCD.print("Nombre de cycle :");
  LCD.setCursor(1, 1);
  LCD.println(compt);
  LCD.setCursor(1,2);
  LCD.print("HUB1 : ");
  LCD.setCursor(1,3);
  LCD.print("HUB2 : ");
  pinMode(pin1,OUTPUT);
  pinMode(pin2,OUTPUT);


  Timer1.initialize(1000000);
  Timer1.attachInterrupt(time);
}


void loop() {
  if((Activate != false)&&(Flag == true)){
    mySensor.calibrate();
    mySensor2.calibrate();


    float current = mySensor.getCurrentAC();
    float current2 = mySensor2.getCurrentAC();
  
    Serial.println(current);
    Serial.println("dddd");


    if (ii > 14){
      if ((current <= 0.09)){
        hub1 = true;
      }
      if((current2 <= 0.09)){
        hub2 = true;
      }
    }else{ii += 1;}
  }


  LCD.setCursor(1,1);
  //Serial.println(compt);
  if ((Flag == true) && (Activate == true)) {
    if (hub2 == false){
      digitalWrite(pin1,HIGH);
      }
    if (hub1 == false){
      digitalWrite(pin2,HIGH);
      }
  }else{
    ii = 0;
    digitalWrite(pin1,LOW);
    digitalWrite(pin2,LOW);
  }
  
  if (compt >= lim){
    LCD.setCursor(1, 2);  
    Activate = false;
    digitalWrite(pin1,LOW);
    digitalWrite(pin2,LOW);
    //compt = 0;


  }else{
    LCD.print(compt);
    LCD.print("  ");
  }


  if (compt < lim){
    if ((hub1 == true)&&(compt < lim)){
      LCD.setCursor(8,2);
      LCD.print("Non conforme");
    }
    if ((hub2 == true)&&(compt < lim)){
      LCD.setCursor(8,3);
      LCD.print("Non conforme");
    }
  }else{
      if(hub1 == false){
        LCD.setCursor(8,2);
        LCD.print("conforme");
      }
      if(hub2 == false){
        LCD.setCursor(8,3);
        LCD.print("conforme");
      }
  }
  //Serial.println(compt);
  LCD.display();
  
}


void time(void){
  if ((seconde == 30)||(seconde == 0)){
    Flag=!Flag;
  }
  if(Activate != false){
  seconde += 1;
  //Serial.println(seconde);
  if (seconde >= 60){ 
    compt += 1;
    seconde=0;
    }
  }


}

Practical Realization (final Realization)

Now since I have finished writing my program in the IDE I just need to compile it and upload it to my Arduino Uno, I was not able to simulate it in the online simulator (Wokwi) because I do not I didn't find the current sensor module in this simulator so I just need to make a diagram with it without the simulator. So that's why I'm going to start directly with the practical implementation before uploading my program to Arduino UNO.


2- Practical realization (final realization):

Here are the images of the practical implementation and the final result after uploading my program directly to Arduino UNO.


Achievement and Final Result

WhatsApp Image 2024-04-05 &agrave; 02.24.36_d0ed134c.jpg
WhatsApp Image 2024-04-05 &agrave; 02.25.25_3e13e1a2.jpg
WhatsApp Image 2024-04-05 &agrave; 02.25.28_69d20eea.jpg
WhatsApp Image 2024-04-05 &agrave; 02.25.28_3987f054.jpg
WhatsApp Image 2024-04-05 &agrave; 02.25.28_69332ab5.jpg
WhatsApp Image 2024-04-05 &agrave; 02.25.28_98025d9c.jpg
WhatsApp Image 2024-04-05 &agrave; 02.25.29_be3d7a31.jpg
WhatsApp Image 2024-04-05 &agrave; 02.25.29_d58eae55.jpg
It's good, it works very well,



Note:
The display on the LCD screen is in French because I wanted to share this project in French but since most of the projects that are shared on this site are in English so I shared it in English


So if you find any problems in this project do not hesitate to tell me in the comments and thank you in advance for reading my tutorial of this project!!!!!!.