Controle Automático e Manual das Luzes do Estádio

Automatic and Manual Control of Stadium Lights

Stadium lights consume a lot of electricity. These are high beam headlights with high power. A lot of electricity can be saved by controlling the intensity of these lights manually or automatically. To control the intensity of the light, the voltage supply to the lights needs to be controlled. This project is a demonstration of the same application. In this demonstration project, instead of real stadium lights, LED lights are used.

Stadium lights consume a lot of electricity. These are high beam headlights with high power. A lot of electricity can be saved by controlling the intensity of these lights manually or automatically. To control the intensity of the light, the voltage supply to the lights needs to be controlled. This project is a demonstration of the same application. In this demonstration project, instead of real stadium lights, LED lights are used. A series of 8 LEDs are used to demonstrate dimming functionality. For manual control of light intensity, a variable resistor is used and for automatic control of light intensity, an LDR sensor is used. The LEDs are connected in two series through the 2N2222 transistor. The transistor acts as an amplifier whose output is driven by the voltage at its base pin. A set of two switches is used to set the project's automatic or manual mode of operation.
The project is built on Arduino Pro Mini. The Arduino sketch can detect mode selection, detect the input voltage of the variable resistor and LDR sensor, and generate a suitable voltage at the base of the light control transistor. The Arduino sketch is written using Arduino IDE and burned onto the board using the same.
Required components –
Circuit Connections –
The circuit is built around the Arduino Pro Mini. The LED series, SPDT switches, LDR sensor and potentiometer are connected to the Arduino board. The circuit connections are as follows –
Power supply – The circuit requires a regulated DC of 5V for its operation. An 18V battery can be used as the primary power source. The battery supply can be regulated to 5V using the 7805 voltage regulator IC. Pin 1 of the voltage regulator IC must be connected to the battery anode and pin 2 must be connected to ground. The voltage output must be taken from pin 3 of the 7805 IC.
LED Series – A group of 8 LEDs interface with the Arduino board as a demonstration of stadium lights. The LEDs are connected in such a way that their cathode pins are connected to ground while the anode pins are connected to the emitter of the 2N2222 transistor. The base of the transistor is connected to pin 6 of the Arduino board and the collector is connected to VCC.
SPDT switches – The switches are connected to pins 9 and 8 of the Arduino board. By default, the pins are connected to ground via 10K resistors. When switching the switches, the respective pins are short-circuited to VCC. If the switch connected to pin 9 is HIGH while the switch connected to pin 8 is LOW, automatic mode will be selected and the LED lights will be operated according to the LDR sensor. If the switch connected to pin 9 is LOW while the switch connected to pin 8 is HIGH, manual mode will be selected and the LED lights will be operated according to the potentiometer. If both switches are LOW, the LEDs will be turned off.
LDR sensor – The LDR sensor has a resistance dependent on the intensity of the ambient light. The more light falls on the sensor, the lower its resistance. The LDR sensor is connected to a potential divider circuit on pin A0 of the controller. It outputs analog voltage at the controller pin that is scaled from 0 to 5 V.
Potentiometer – A 10K potentiometer is connected to the A1 pin of the Arduino. The potentiometer allows a variable voltage below 5V to be passed to the controller pin.
How the circuit works –
As soon as the Arduino board is powered on, the board initializes the circuit and sets the digital output or input pins. It checks the status of the pins connected to the SPDT switches. If the switch connected to pin 9 is HIGH while the switch connected to pin 8 is LOW, automatic mode will be selected and the LED lights will be operated according to the LDR sensor. If the switch connected to pin 9 is LOW while the switch connected to pin 8 is HIGH, manual mode will be selected and the LED lights will be operated according to the potentiometer. If both switches are at LOW level, the LEDs are turned off by sending a logic LOW on pin 6 of the board.
If automatic mode is selected, the Arduino reads the analog voltage at pin A0 where the LDR sensor is connected in a voltage divider circuit. The larger the surrounding light, the smaller the LDR resistance and the smaller the voltage output at the controller pin. Voltage is read and digitized using the integrated ADC channel. The value is factored by four and the resulting voltage value is passed to the pin that connects the amplifier transistor. Therefore, the greater the surrounding light, the lower the voltage supplied to the transistor and the lower the intensity of the LED lights.
if manual mode is selected, Arduino reads the analog voltage on pin A1 where the potentiometer is connected. When moving the potentiometer knob, the voltage output at the pin varies. The same voltage is converted into a digitized reading using the onboard ADC channel and factored by four. The resulting voltage value is supplied at pin 6 of the Arduino where the base of the transistor is connected. Therefore, the higher the output voltage of the potentiometer, the higher the supply voltage for activating the base of the transistor and the higher the intensity of the LED lights.
Factor four was determined after calibrating the LED intensity during design testing. When designing and using another set of LEDs, another factor suitable for the respective set of LEDs can be found. Since the Arduino board's built-in ADC channel is 10 bits long, the factor must have a denominator of 1024 and a suitable numerator as determined during design testing.
Check out the project code to see how Arduino reads the status of the SPDT switches, reads the analog voltage from the LDR sensor and potentiometer, and produces a factored voltage at the base of the transistors.
Programming guide –
The Arduino sketch declares variables denoting potentiometer, LDR sensor, LED connection and SPDT switches and assigns respective controller pins according to their interface.
int potPin = A1;
internal LDR = A0;
Internal LED = 6;
int sw1 = 9;
int sw2 = 8;
The setup function is called and executed once after the controller is powered on. The function defines the pins connected to the base of the 2N2222 transistor as digital output and the pins connected to the potentiometer, LDR sensor and SPDT switches as digital input using the pinMode function.
empty configuration {
pinMode(potPin, INPUT);
pinMode(LDR,INPUT);
pinMode(LED, OUTPUT);
pinMode(sw1, INPUT);
pinMode(sw2, INPUT);
}
The loop function is called and iterates infinitely. The status of SPDT switches is read using the digitalRead function and stored in variables. if the switch connected to pin 9 has HIGH while the switch connected to pin 8 has LOW, automatic mode is selected and the ldr function is called. If the switch connected to pin 9 has LOW while the switch connected to pin 8 has HIGH, manual mode will be selected and the pot function will be called. If both switches are LOW, the LEDs are turned off by passing LOW on pin 6 of the Arduino, which triggers the transistor circuit to turn OFF.
empty loop {
int SWITCH1 = digital reading(sw1);
int SWITCH2 = digital reading(sw2);
if (SWITCH1 == HIGH && SWITCH2 == LOW)
{
ldr;
}
otherwise if (SWITCH2 == HIGH && SWITCH1 == LOW)
{
Pan ;
}
otherwise if (SWITCH2 == LOW && SWITCH1 == LOW)
{
digitalWrite(LED,DOWN);
}
}
In the pot function, the potentiometer voltage is read using the analogRead function and stored in a variable. The value is scaled by a factor and written on pin 6 of the Arduino where the base of the LED driver transistor is connected.
empty vase
{
int readValue = analogRead(potPin);
int writeValue = (255./1023.) * readValue;
analogWrite(LED, writeValue);
}
In the ldr function, the LDR sensor voltage is read using the analogRead function and stored in a variable. The value is scaled by a factor and written on pin 6 of the Arduino where the base of the LED driver transistor is connected.
empty ldr
{
int sv = analogRead(LDR);
int wv = (255./1023.) * sv;
analogWrite(LED, wv);
}
This completes the Arduino code for the stadium lights dimming project.

Project source code

###

 //Program to

###

Related Content

Back to blog

Leave a comment

Please note, comments need to be approved before they are published.