BLE Lightning sensor for Nordic NRF51822 based module

Dependencies:   AS3935 AS3935_ext BLE_API mbed nRF51822 nrf51_rtc

Description

Table of Contents

    (English)

    1. Lightning sensor module with AS3935 based lightning sensor by Akiduki elec. http://akizukidenshi.com/catalog/g/gK-08685/ and mbed HRM1017 module by Switch Science https://www.switch-science.com/catalog/1755/ .
    • It may work with other nordic NRF51822 based mbed module like BLE nano.
    1. It communicate with BLE master via BLE UART connection.
    • The protocol is not user friendly because of limit of 20 bytes packet size of BLE UART and I'm planning to use scripts to communicate with the module.
    • You can manually communicate with the module with the android/iphone application "nRF Toolbox" UART function.
    1. The module keeps local time by RTC and timer interrupt function.
    • Send "st YYYYMMDDhhmmss" to set local time to module. (It means hh:mm:ss on MM/DD/YYYY).
    • The local time in the module will have a few seconds error.
    • Send "get time" to receive current time from the module. It will returns it by "YYYYMMDDhhmmss" character.
    1. This module keeps last 10 events in the buffer records.
    • Send "get record N" to read record N (N is 0 to 9)
    • It returns like "rN:TTTTTTTT:E:DD". r is alphabetic "r", N is record number, TTTTTTTT is time_t of event in hex, E is event number. 0: null record, 1:noise, 2:Lightning 4:other disturbances. DD is the distance from edge of lightning cloud in km. (no meaning with except lightning event.)
    1. Afeter power on, the module executes auto calibration to set antenna freq. peak as 500khz. It will takes about 20 sec.
    1. You can change parameter AFE_GB, NF_LEV, WDTH and SREJ.
    • example :"AFE_GB 0x0d", "NF_LEV 0x02", "WDTH 0x02", "SREJ 0x02"
    • It returns those 4 parameters.

    (Japanese)

    1. 秋月の雷センサーモジュール(AS3935)http://akizukidenshi.com/catalog/g/gK-08685/とスイッチサイエンス社のmbed HRM1017https://www.switch-science.com/catalog/1755/を使った雷センサーモジュールです。
    • HRM1017と同じnrf51822を使ったBLE nano等でも動作すると思います。
    1. BLE接続により、マスターモジュールとBLE UART経由のハンドシェークを行います。
    • ハンドシェークのプロトコルは、BLEの1回あたりのパケットサイズ20バイトの制限と、スクリプトによる操作を前提としているため、ユーザビリティは考慮されていません。
    • Andorid/iPhone のアプリケーション nRF Toolbox のUART機能を使ってマニュアルでのハンドシェークが可能です。
    1. RTCとタイマ割り込みを利用して絶対時間を内部に保持しています。
    • 時間の設定は、UART経由で"st YYYYMMDDhhmmss" と送信してください。(YYYY年MM月DD日 hh時mm分ss秒を示す。) 数秒の時間誤差が発生すると思われます。
    • 現在時刻は"get time"と送信して下さい。"YYYYMMDDhhmmss"形式で応答が返ります。
    1. このモジュールは検出した雷と他の電波、ノイズ多等のAS3935割り込み発生の発生時刻と距離を最新10件記憶しています。
    • レコードの読み出しは、"get record N" と送信して下さい。(N部分に0~9のレコード番号を指定して下さい。)
    • 応答例は "rN:TTTTTTTT:E:DD" rはアルファベットの"r", Nはレコード番号, TTTTTTTTは16進表記のtime_t形式のイベント発生時間、Eはイベントの種類0:空レコード 1:ノイズ大 2:雷検出 4;他の電波 となります。DDは16進表記の雷までの距離です。(雷意外のイベントでは意味はありません。)
    1. 起動直後、受信周波数を500kHzに近づけるために、自動キャリブレーションを行います。20秒ほどかかります。
    1. AFE_GB, NF_LEV, WDTH, SREJの各パラメータを変更することが出来ます。
    • 例:"AFE_GB 0x0d", "NF_LEV 0x02", "WDTH 0x02", "SREJ 0x02"
    • 上記4つのパラメータをカンマ区切りでエコーします。

    All wikipages