The system consists of two components: an Arduino board that detects LED pulses and transmits the data via an XBee module, and a PC that receives the data through a USB/XBee module and processes it using LabVIEW, allowing for real-time analysis of energy consumption. To detect the LED blinking, a photoresistor should be placed above the LED and covered with black tape. The Arduino reads the analog voltage through a resistive divider. The LED blinking causes a voltage drop, which is read by the Arduino and compared with the voltage from a potentiometer connected to channel A0. The potentiometer adjusts the sensitivity threshold. The code includes delays and conditions to manage the acquisition of voltage readings, flag settings, and time measurement for LED cycles. Data is sent to the PC via the serial port, including a marker for LabVIEW to recognize the readings. The system also counts cycles and averages energy consumption over five minutes, with specific tasks for timing and LED blinking.
The electronic system integrates an Arduino board with an XBee module for wireless communication and a photoresistor for LED pulse detection. The circuit operates by detecting voltage changes caused by LED blinking, which is crucial for measuring energy consumption. The photoresistor is strategically placed above the LED and shielded from ambient light to minimize interference. A resistive voltage divider is employed to scale the voltage levels for accurate analog readings by the Arduino.
The Arduino is programmed to read the voltage from the photoresistor and the potentiometer, which sets the sensitivity threshold. The comparison between these two readings determines whether the LED is blinking. When the photoresistor voltage exceeds the potentiometer voltage, a flag is set, indicating active detection. This flag enables the Arduino to track the time elapsed since the last detected blink using the `millis()` function, which returns the number of milliseconds since the board began running the current program.
Data transmission to the PC is initiated by sending a marker followed by the elapsed time in milliseconds. This data flow is crucial for real-time monitoring in LabVIEW, allowing users to visualize energy consumption patterns. The system includes mechanisms to reset the detection flag when the LED is off, ensuring accurate cycle counting. A counter increments with each detected pulse, facilitating the calculation of average energy consumption over a specified duration, such as five minutes.
Additionally, the system incorporates a timing function that blinks an LED at regular intervals, providing visual feedback of system activity. The use of defined constants for pin assignments and timing intervals enhances code readability and maintainability. Overall, this setup exemplifies an effective integration of hardware and software for real-time energy monitoring applications.The system consists of two parts: the Arduino board that detects the led pulses and sends the data via the XBee module, and a PC that recive the data through a USB/Xbee module and processes the data with LabVIEW so you can prepare and study the consumption in a very instant. To detect the LED blinking you have to apply a simple photoresistor above the led and covered it with black tape. To read the analog voltage using the Arduino you have to use a resistive divider as shown in diagram: The LED blinking causes the voltage drop down and this value is read by Arduino and compared with the voltage acquired by the potentiometer connected in the channel A0. This potentiometer has the task to adjust the sensitivity threshold. delay(10); //10ms val_pot = analogRead(POT); delay(10); //10ms val_sensore = analogRead(SENSORE); if(val_sensore > val_pot)&(flag_acquire = 0){ flag_acquire = 1; digitalWrite(LED, LOW); With this code Arduino acquires the two voltages, the photoresistor voltage compared with the voltage of the potentiometer, if the value is greater than the sketch actives the flag flag_acquire = 1 ³, then read how much time has passed to another flash.
To do this use arduino to read a statement in an internal counter that returns the milliseconds since power on. The instruction is millis () code here: There are 2 variables pre_tmS and cur_tmS, cur_tmS needs to read the current value of the internal counter: cur_tmS = millis (); Then if the condition (cur_tmS> pre_tmS) is true, I note the elapsed time between cycles, ie between the LED ON and the next cycle of the LED ON and write it on the variable pre_tmS .
Now we have to send to the PC via the serial port using XBee with these instructions: First Arduino sends a marker S used to labview to recognize that this value is part of the reading that real-time instant, then send the value in milliseconds elapsed. Now you have to reset the flag when the LED goes OFF using this statement: if(val_sensore < val_pot)&(flag_acquire = 1){ flag_acquire = 0; digitalWrite(LED, HIGH); impulsi+; delay(10); //10ms } You have to check the voltage acquired by the sensor, if it falls below the potentiometer value and the flag is active flag_acquire = 1 ³ then you have to reset the flag.
Note that the statement impulsi+; is simply a counter that counts the cycles of the LED power meter, this is to make an average energy consumed every 5 minutes. The third task is similar to the first task, wait 1 second, and increments the counter time_flag+, which is the fourth task of counting 300secondi (5 minutes).
In addition, this task blinks the LED connected to pin 12 at a rate of 1 second. The fourth task as mentioned above waiting 5 minutes and then sent via serial marker L is used to program labview to recognize that the data sent is the data on the average found in 5 minutes. #define POT 0 #define SENSORE 1 #define LED 13 #define LED1sec 12 // definire il tempo casuale che varia tra 40ms e 250ms #define TimeAcquire 1000 //1sec #define Time5Minuts 300 //5 minuti = 300sec unsigned long cur_tm = millis(); unsigned long pre_tm = cur_tm; unsigned int tm_diff = 0; unsigned long cur_tmS = millis(); unsigned long pre_tmS = cur_tmS; unsigned int tm_diffS = 0; unsigned int time_flag=0; unsigned int impulsi=0; unsigned int val_pot=0; unsigned int val_sensore=0; char flag_acquire=0; char flag_time=0; void setup() { pinMode(LED, OUTPUT); pinMode(LED1sec, OUTPUT); Serial.
It's very simple actually. The idea is that we use what we have learned from the capacitor tests to create a circuit that uses the capacitors to run the load and then by discharging the 1/2 full capacitor into...
It is advisable to modify inexpensive USB speakers to obtain a pre-assembled analog front-end for this project. If this is not feasible, then soldering will be necessary, requiring a minimum of two resistors and one capacitor, assuming the display...
The capacitor instrument is not intended for measuring the capacitance of capacitors; rather, it is designed to identify whether a capacitor is functional or defective, as well as to detect short circuits or open circuits. This functionality provides reliable...
This sensitive circuit functions primarily as a comparator, capable of detecting minimal temperature changes relative to ambient temperature. It was originally designed to identify drafts around doors and windows that lead to energy loss, but it can be utilized...
The monitor functions as a basic voltage comparator, utilizing a car battery as its power source. The input voltage to the comparator is adjusted using potentiometer PI. This adjustment ensures that the green LED L2 illuminates when the alternator...
The LED signifies the status of a remote telephone. The light remains off when the phone is hung up. It emits a steady glow when the phone is off the hook, and it flashes intermittently while the phone is...
We use cookies to enhance your experience, analyze traffic, and serve personalized ads.
By clicking "Accept", you agree to our use of cookies.
Learn more