Sunday, July 17, 2016

Filled Under: , , ,

A Lightning Detector for Arduino

Arduino Arduino UNO R3 easy project



In this tutorial, we will build a lightning detector using an Arduino Uno, a few resistors and some jumper wires. Most lightning detectors often cost too much for the normal hobbyist, however this does not mean one cannot enjoy lightning detection and the physics behind it. In this tutorial, using a surprisingly simple circuit we will be able to detect lightnings from around 10-20 km away, which is to say the least impressive.

The aim is to construct a simple circuit to detect lightnings with an Arduino and produce meaningful results.


Background

When a lightning strikes, a huge amount of energy is released in different forms. The most obvious are light and sound, the latter being a by-product of the rate of temperature increase of the immediate particles surrounding the lightning bolt, which then causes the sound. But, that is not all. Lightnings emit large amount of electromagnetic radiation in the VLF (Very Low Frequency) and LF (Low Frequency) range, typically ranging from 3kHz to 300kHz. VLF and LF are similar to light waves, your WiFi waves and also your microwave oven waves, but with the difference of operating at lower frequencies. eg. WiFi normally operates at around 2.4GHz, that’s 2.4 billion oscillations per second. VLF and LF operates at lower frequencies, and with an Arduino we can capture frequencies around 7kHz. 


The advantages in using this kind of radiation for lightning detection is that normally nothing gives out large bursts as seen in lightnings, around this frequency; and being an electromagnetic wave it travels at the speed of light, which means the sensor will detect lightnings as they happen (a few micro seconds after).

Our little Arduino will have an antenna (sort of), a piece of wire that will pick fluctuations in electromagnetic spectrum specifically around the 7-9kHz. These fluctuations will induce a small voltage +ve or -ve in the wire. We can pick these fluctuations using Arduino’s analog pins.


Step 1: What You Need?

1 x Arduino Board (I'm using Arduino UNO R3 but any other will work as long as it can operate at 16MHz.)
2 x 10k Ohm Resistors
1 x 3.3M Ohm Resistor
1 x Breadboard  or Mini Breadboard
1 x USB B-type Cable 
Male-to-Male Jumper Wires (4)
1 x Computer with Arduino IDE installed 






You can buy Arduino Compatible UNO Ultimate Starter Kit / Learning Kit at here.

Don't have components? Don't worry. Just click the component's name. 


Step 2: Build Your Circuit.

Lightning Detector Circuit Diagram
Lightning Detector
The circuit is pretty straight forward, we have 2x 10k Ohm resistors in series from 5v (red wire) to GND (black wire), this is basically the voltage divider. Then a 3.3M Ohm (MegaOhm) resistor is connected between the 2x 10k Ohm resistor. In series with the 3.3M Ohm resistor attach a wire to pin A4 (blue wire), this will give us exactly 2.5v on pin A4. Then attach a wire which will act as an antenna (green wire) of around 6-8 inch in length. This should be connected from one end only as shown above.

Step 3: Upload Code To Board.

Here comes the hardest part to explain. As mentioned above, the frequency we need to pick up from the lightnings, is around 7kHz and to read a semi-decent wave the sample rate has to be 4x as much, giving us 4 readings per wavelength. That is, 28,000 samples per second.

The Arduino analog pins can only give us 9,600 samples per seconds. With that sample rate we will only be able to capture waves at 2kHz or a bit more, which is far from good. Thanks to the ATMEGA chip, it can be configured to speed up the ADC process by a certain factor, while retaining a good resolution. This is called the prescaler, and can be configured through code. There are a number of prescaler dividing factors but we will use factor 16 which in theory will give us a sampling rate of 77kHz. In practice any form of calculation will lower this sampling rate thus I was only able to get around 46kHz which is still very good for this project.

So moving forward, the sketch uses a 512 byte array to store voltage valves from pin A4. It constantly reads the pin value and writing it to the next location in the array. As soon as a lightning is detected the whole array is sent over the serial port. This can be plotted on the graph plotter in Arduino IDE or maybe sent over to another Arduino or ESP8266 to publish the data online. It’s probably best to monitor it via the Arduino IDE at first, so if there are some glitches, they can be tackled there and then.


To use the Arduino IDE serial plotter please replace this function
void sendData()
{
 // Serial.print(">>>");
 // Serial.println(batchStarted);
  
  for (int i=0;i<data;i++){
    Serial.println(storage[i]);
  }
 // Serial.print("<<<");
 // Serial.println(batchEnded);
 // Serial.println("END");
  
  toSend=false;
}
Note that the device is very sensitive to EMF fluctuations. This includes AC power supplies. Place the device away from any AC supply and any socket outlets. We have also noticed that it behaves abnormal when connected to a laptop while charging. We recommend to use a laptop running on batteries only for optimum performance.


Unknown

Author & Editor

My Robot Education Sdn. Bhd. (Robotedu.my) was founded in 2015 as the first robotics education centre in Malaysia to provide Arduino-based robotics courses for youths. Our vision is to be able to provide robotics education to every youth in Malaysia.

0 comments:

Post a Comment

 

  • Copyright © Arduino Tutorial ™ is a registered trademark.
    Designed by Templateism. Hosted on Blogger Templates.