Introduction: Static Electricity Measuring Based Emergancy Lighting System
Have you ever thought of making an emergency lighting system when your main power goes off. And as you have a even a little knowledge in electronics you should know that you can easily check the availability of the mains power by simply measuring the voltage.
But what i m going to say is quite different approach. I m suggesting that to measure the electrostatic field intensity near a main power wire and filter that reading and use it as per our usage.Advantage in this approach is we completely electrically isolated from the main power and i could say non invasive (even you use a opto-isolator you need to deal with mains power)This project consists with 3 main parts,
- static electricity sensor
- kalman filter based signal processor
- relay based light controller.
Step 1: Static Electricity Sensor
Guys, this is the simplest static electricity sensor there is. its just a darlington pair of transistors.
- I used 2 C828 NPN transistors but any 2 general purpose NPN transistors will do the work.
- Due to extreme gain of the darligton pair we can measure the change of static electricity at the input point.
- Just use a duct tape and paste the input pin with the insulation of the mains power.
there's a AC 230V wire goes to my room's light and i just selotaped a wire of the darligton pair to the condute case which carries that wire.
Step 2: Processing the Signal Using Arduino
I used a Arduino nano for this. But any Arduino variant can be used.
Basically in here the voltage reading from the static electric sensor will be processed i ll explain the code at the end of the document.
Then the digital pin 9 is changed accordingly so the emergency light can be controlled through the relay
Step 3: Full Circuit
The relay is driven by a power transistor and there's a reversed biased diode to avoid transistor getting damaged by the reverse induced voltage of the relay coil.
Feel free to change the wiring of the relay and have a bulb with any voltage.
Step 4: Explanation of the Code
In this code i have implemented 2 cascaded kalman filters. I made this algorithm by observing the output at each step and developed it to have the desired output.
Step 5: Kalman Object
here i have made an class for the kalman filter. including all the variable necessary. Here i m not going to explain the meanings of the variables in detail as you can find that in other sites. "double" data type is the suitable for handling the math required.
Value 'R' i put by trail and error by observing the output of the 1st filter, i increased it until i get a noise free single as shown in the second picture. Value 'Q' is a general for all 1D kalman filters. Finding appropriate value for this is kind of a tedious task, so better to go simple
Step 6: Kalman Object and Setup
- here the kalman filter is implemented
- 2 objects of it formed
- pinModes have been set to get the data and output the signal for the relay
Step 7: The Loop
First i have filtered the input signal, then observed what happens when the AC mains supply is present ans when absent.
I noticed the variance changes when i switch the mains.
so i subtracted 2 consecutive values of the filter output and take it as the variance.
then i observed what happens to it when i switched on and off the mains. i noticed there's a considerable change happens when i switched. but the issue was yet the values fluctuate considerably. This could be solved using a running mean. but since i used kalman earlier i just cascaded another filter block to the variance and compared the outputs.
Participated in the
Arduino Contest 2019