AMS AS3935 Lightning Emulator

Discussion in 'The Projects Forum' started by jpanhalt, Aug 22, 2016.

  1. jpanhalt

    Thread Starter AAC Fanatic!

    Jan 18, 2008
    5,672
    899
    In another thread, the AS3935 lightning detector is described. AMS also provides an evaluation kit for that device that includes a lightning emulator. Getting an emulator/simulator seems like a good starting point.

    Here is a link to the product announcement for the evaluation board. Click on the hot link to get the operation manual. The schematic, board, BOM are provided for the emulator, but not surprisingly, no code.

    A PIC24 MCU is used, which seems like overkill. My understanding of that schematic is that the MCU generates a PWM signal that is converted to a voltage waveform by the AS1504, which in turn modulates the 500 kHz oscillator (LC+4 MOSFETS).

    If that is wrong, please comment to that effect.

    Simply put, has anyone looked at that modulation? I have spent only an hour or so looking at lightning research , for example this: http://www.dtic.mil/dtic/tr/fulltext/u2/a234306.pdf From those studies, it is apparent that a simple spark won't work. One needs a more prolonged signature. Alternatively, has anyone been involved in lightning detection who can comment on what the modulation should look like?

    The critical problem will be to figure out what element(s) in the waveform give distance information, if it is not intensity.

    Regards, John
     
  2. jpanhalt

    Thread Starter AAC Fanatic!

    Jan 18, 2008
    5,672
    899
    UPDATE:
    On the possibility that my understanding of the emulator schematic was wrong (no news is good news), I tested this with LTSpice:
    upload_2016-8-24_17-18-5.png

    Replaced AS1101 with a 1 kHz sine wave, and it does simulate with the expected modulation. I was not particularly careful in selection of the components, and the simulated frequency is a little off. Here is a crude snip of the simulation:
    upload_2016-8-24_17-23-36.png

    John
     
  3. Bernard

    AAC Fanatic!

    Aug 7, 2008
    4,170
    395
    Back in 1970's I had one school alarm system prone to false alarms from lightning. I spent many hours watching a o'scpe for lightning strikes. Settled on a broad tuned 100 k HZ front end, Z match, & V detector. A strike would cause the offending alarm lines to be clamped to ground for 3 sec. I worked as my feeble mind remembers.

    Wonders of all wonders, found one , even on a PC board, " TUSD 779 STORM BYPASS ". No schematic- no 100 uH coil, 2 ft. ant. C coupled into a 4558 IC & a bunch of parts & old faithful 555. Prob. built July 1979 ?
     
    Last edited: Aug 25, 2016
  4. jpanhalt

    Thread Starter AAC Fanatic!

    Jan 18, 2008
    5,672
    899
    Here are links to the lecture schedule from last year at the University of Arizona and my two favorites:

    Table of Contents:
    http://www.atmo.arizona.edu/students/courselinks/spring15/atmo589/lecture_notes/CONTENTS.html

    Principle lectures:
    http://www.atmo.arizona.edu/students/courselinks/spring15/atmo589/lecture_notes/apr06_2015.html (best for slow E field)
    http://www.atmo.arizona.edu/students/courselinks/spring15/atmo589/lecture_notes/apr08_2015.html

    Unfortunately, the links given in the lecture cost money to read. The two I would really like to get, and may even shell out for, are the ones by Cummins and Murphy (IEEE transactions), which is mentioned in second paragraph, and Hayenga and Warwick, also on the first page of the notes.

    Based on my LTSpice simulations, I think I can duplicate the patterns on page 2 of the notes and later.

    My detector breakout board is in the mail, for some reason it is stalled in the Cleveland P.O.

    John
     
  5. jpanhalt

    Thread Starter AAC Fanatic!

    Jan 18, 2008
    5,672
    899
    UPDATE:

    I used a PIC16F1829 to generate a variable voltage with the DAC peripheral and connected that directly to the AS1101 LED driver/current sink. Oscillator was as shown above, except I had to increase R1 a little to get it to start reliably. Anything ≥220 Ω worked. For the attached plot, I was using 470 Ω.

    The magenta trace is the output from the PIC, yellow is the oscillator. Frequency is right on 500 kHz according to the 'scope (measured with an inductive probe). I may need an op-amp buffer as the output impedance from the DAC is quite high and is presumably much higher from the 8-bit DAC.

    Next step is the get the AS3935 running.

    John
    DS1Z_QuickPrint4.png
     
  6. jpanhalt

    Thread Starter AAC Fanatic!

    Jan 18, 2008
    5,672
    899
    UPDATE:

    I got some very crude programming done for the MikroElektronika Thunder Click AS3935 breakout board. Right now, it just monitors the distance register and displays that value on a 2X16 LCD.

    With no storms, it reads 0x3F, so I had to wait for a storm to be sure it worked. That happened this morning about 3:30 AM local time. Even without calibration, I got decent distance information. The storm is now overhead and distance reads 1 km. However, I watched as it moved in from 20 km. Here are the lightning strikes from an Internet service for my area. The red ring is at 10 miles. The first image read 5 km with the AS3935, and the second read 1 km (i.e, overhead).

    5 km away_Capture.PNG
    1 km away_Capture.PNG

    One brief comment about the Thunder Click: The documentation for SPI ports on the Thunder Click is confusing. The data direction arrows do not agree with usual port names or MISO/MOSI labels. Since I find SDO/SDI can be confusing, I followed the arrows and wasted a few hours. Just follow the MISO/MOSI labels, and you will be OK.

    John
     
  7. jpanhalt

    Thread Starter AAC Fanatic!

    Jan 18, 2008
    5,672
    899
    LAST UPDATE

    Tried a bunch of empirical patterns, none worked. So, as we used to say, 2 hours in the library can save 2 months of lab work. After a good deal more reading, a few calculations, and a couple of tries, I got a pattern from my emulator that was called "lightning" by the AS3935:

    DS1Z_QuickPrint7.png

    Most important, I can make it strike on demand right on top my desktop. Next part is to define some of the variables, like those affecting distance, and then on to the detector. Here's the emulator:
    Emulator alone.jpg

    Now, since I haven't mowed in well over a week, I can spend the next two days doing that without a guilty conscience.

    BTW, since the 16F1829 only had a 5-bit DAC, I switched to the 12F1840 shown in the picture -- uses less breadboard space.

    John
     
  8. Sisto Zanier

    New Member

    Sep 19, 2016
    3
    1
    Hi there ,
    I have developed a sensor lightning for home environment, using AS3935.
    I purchased the AMS demo kit and I have all related documentation: manual, gerber, bom, but I lost the Lightning Emulator schematic diagram.
    Is there some kind soul who can make me get the Emulator schematic, by mail at sisto.zanier@mac.com?
    Thanks a lot
    Sisto
     
  9. jpanhalt

    Thread Starter AAC Fanatic!

    Jan 18, 2008
    5,672
    899
    I have uploaded it for your. It is on page 13 of the user manual for the development kit. That user manual is on the AMS site too.

    BTW, Have you looked at the AMS emulator's output for near and far strikes?

    John
     
  10. Sisto Zanier

    New Member

    Sep 19, 2016
    3
    1
    Hi John, thanks a lot for Your support.
    For the moment I have not analyzed the waveforms generated by the emulator for the three strikes modes indicated. I have developed a receiver and for the testing and verification, I used the AMS emulator, version 1.2, in direct comparison with ASM AS3935-DB module "Lightning Sensor" with identical parameters as the AMS sensor. But now I plan to also make the emulator, to be supplied in kit form and for this I have to decide whether to use a micro STM8L15x or simply clone the current AMS emulator. and use the firmware "LightningEmulator.hex" supplied USB-Stick.
    If I will decide for micro STM8L, will be necessary to analyze the waveforms generated in order to replicate with the new micro.
     
  11. jpanhalt

    Thread Starter AAC Fanatic!

    Jan 18, 2008
    5,672
    899
    From my limited experience, almost any micro will work for the emulator. I am using a 12F1840 at 32 MHz. That gives 5 pins for user input (one of the pins is used as an output to control the emissions).

    Do you have the .hex file? Presumably that is written for the 24F chip that AMS puts on the emulator board. Can you upload it? Getting something to register as lightning is relatively easy, but I have not unraveled the trick to setting the distance as I want it yet. Presumably, that is related to intensity ratios.

    John
     
  12. Sisto Zanier

    New Member

    Sep 19, 2016
    3
    1
    Yes the .hex is for a PIC24FJ16GA002 (FLASH 16K 28-QFN); PCB version 1.2; 02-20-2013.
    I attach it.

    As regards the method of determining the distance it is certainly is linked to intensity ratios determined dall'hardaware and in particular by the inductance EPCOS - B82111EC23 of 40uH and the mode of excitation with "H" bridge.
    With emulator V1.2, but I think for older versions is no different, in the three FAR, MIDDLE and CLOSE modes, is sent to the same frame but repeated consecutively every about 0.9mSec, only once in FAR mode, 3 times MIDDLE mode and 5 times in CLOSE mode.
    The waveform of the frame has a frequency of 500KHz, but we know this, but by means of the AS1504 DAC is determined also a form in amplitude and then power, which I believe is important.
    In particular, the time sequence of the amplitude change is as follows:
    - 10uSec with 0,5Vpp amplitude
    - 10uSec with 1,2Vpp amplitude
    - 10uSec with 1,6Vpp amplitude
    - 30uSec with 2,2Vpp amplitude (maximum intensity)
    - 20uSec with 2,0Vpp amplitude
    - 20uSec with 1,8Vpp amplitude
    - 30uSec with 1,5Vpp amplitude
    - 900uSec with amplitude in natural damping with high impedance bridge.
    I attach three frame images also.
     
    jpanhalt likes this.
  13. jpanhalt

    Thread Starter AAC Fanatic!

    Jan 18, 2008
    5,672
    899
    That is an interesting sequence of peak heights. I have been using the sequence from Kohl's Figure 1, which is normalized to 1 for the strongest (http://journals.ametsoc.org/doi/pdf/10.1175/1520-0450(1969)008<0610:AKSRD>2.0.CO;2 ). Kohl's data are the average for the top 10 largest peaks based on detailed analysis of 82 bursts. (He studied well over 1000 lightning strikes.) Interestingly, he found the order of the peaks seemed random. Below is a comparison of the two normalized sequences:

    Code (Text):
    1.  
    2. AMS sequence     Kohl sequence
    3. 1.0                      1.0
    4. 0.91                     0.84
    5. 0.82                     0.75
    6. 0.73                     0.68
    7. 0.68                     0.61
    8. 0.54                     0.57
    9. 0.23                     0.50
    10. ----                     0.47
    11. ----                     0.43
    12. ----                     0.38
    13.  
    I assumed (apparently incorrectly) that any monotonically decreasing sequence over a short period would be rejected by the secret algorithm as noise. I also extended my sequence to a few 100 milliseconds. I will now try the "simple life" and test your sequence.

    The effect of repetition on the distance estimate is interesting and unexpected to me. I had based my assumption on papers that reported late peaks were attenuated by distance.

    Lastly, I had my best success with narrow spikes and have been using "on times" for the oscillator of 4 to 6 usecs. Obviously, turn on and off won't be instantaneous. Here is a portion of a calibration test I ran to correlate voltage with DACCON1 setting. There are two DACCON1 values shown, 29 and 27 (my DAC is only 5 bit). The first "peak group" for each setting is 4 usec on, and the second of each pair is 8 usec on.

    upload_2016-9-19_9-57-19.png

    Thanks for the help.

    Regards, John
     
Loading...