Skip to content

Commit

Permalink
Generate 409-fix-doc-for-as3935-lightning-detector-407-463 docs
Browse files Browse the repository at this point in the history
  • Loading branch information
runner committed Oct 6, 2024
1 parent 42869a9 commit de0a9ef
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 11 deletions.
71 changes: 70 additions & 1 deletion docs/409-fix-doc-for-as3935-lightning-detector-407-463/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,76 @@ Output:
- y (in m*s²)
- z (in m*s²) (`adxl345`)
- AHT20 temperature and humidity sensor (`aht20`)
- AS3935 Ligntning Sensor (`as3935`)
- AS3935 Ligntning Sensor

Example configuration:

sensor_modules:
- name: AS3935_Sensor
module: as3935
pin: 17
auto_filter: True
indoor: True

sensor_inputs:
- name: distance
module: AS3935_Sensor
digits: 4
interval: 5
type: distance

Module Options
--------------
See also:
https://www.embeddedadventures.com/datasheets/AS3935_Datasheet_EN_v2.pdf
https://github.com/fourstix/Sparkfun_CircuitPython_QwiicAS3935/blob/master/sparkfun_qwiicas3935.py
https://github.com/fourstix/Sparkfun_CircuitPython_QwiicAS3935/blob/master/examples

pin: Interrupt GPIO Pin
auto_filter: Set noise_level, mask_disturber and watchdog_threshold automatically.
Default: True
indoor: Set whether or not the sensor should use an indoor configuration.
Default: True
lightning_threshold: number of lightning detections required before an
interrupt is raised.
Default: 1
watchdog_threshold: This function returns the threshold for events that trigger the IRQ
Pin. Only sensitivity threshold values 1 to 10 allowed.
Default: 2
spike_rejection: This setting, like the watchdog threshold, can help determine
between false events and actual lightning. The shape of the spike is
analyzed during the chip's signal validation routine. Increasing this
value increases robustness at the cost of sensitivity to distant
events.
Default: 2
noise_level: The noise floor level is compared to a known reference voltage. If
this level is exceeded the chip will issue an interrupt to the IRQ pin,
broadcasting that it can not operate properly due to noise (INT_NH).
Check datasheet for specific noise level tolerances when setting this
register.
Default: 2
mask_disturber Setting this True or False will change whether or not disturbers
trigger the IRQ pin.
Default: False
division_ratio: The antenna is designed to resonate at 500kHz and so can be tuned
with the following setting. The accuracy of the antenna must be within
3.5 percent of that value for proper signal validation and distance
estimation. The division ratio can only be set to 16, 32, 64 or 128.
Default: 16
tune_cap: This setting will add capacitance to the series RLC antenna on the
product. It's possible to add 0-120pF in steps of 8pF to the antenna.
The Tuning Cap value will be set between 0 and 120pF, in steps of 8pF.
If necessary, the input value is rounded down to the nearest 8pF.
Default: 0

Sensor Options
--------------

type: The following types are supported:
last: last lightning in unix timestamp format
distance: distance of last lightning in km
energy: energy of last lightning (no unit, no physical meaning)
number: number of lightning events since start (`as3935`)
- BH1750 light level sensor (`bh1750`)
- BME280 temperature, humidity and pressure sensor (`bme280`)
- BME680 temperature, humidity and pressure sensor (`bme680`)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ In order to support as much hardware as possible without changing the project's

In order for a module to specify its requirements, a module-level constant is used which lists them in the same format as the `pip install` command.

[mqtt_io.modules.gpio.raspberrypi:REQUIREMENTS](https://github.com/flyte/mqtt-io/blob/08defebb4bdc2003d2d32fe315549b227b72d64f/mqtt_io/modules/gpio/raspberrypi.py#L13):
[mqtt_io.modules.gpio.raspberrypi:REQUIREMENTS](https://github.com/flyte/mqtt-io/blob/b35d049d3c9e08aec42194b904498135e6bf2889/mqtt_io/modules/gpio/raspberrypi.py#L13):

```python
REQUIREMENTS = ("RPi.GPIO",)
Expand All @@ -22,7 +22,7 @@ To specify extra schema for the pin-level config sections (`digital_inputs`, `di

If the pin-level schema only applies to an input or an output (in the case of a GPIO module), then instead of setting it on the `PIN_SCHEMA` class-level constant, use `INPUT_SCHEMA` or `OUTPUT_SCHEMA` respectively.

[mqtt_io.modules.gpio.gpiod:CONFIG_SCHEMA](https://github.com/flyte/mqtt-io/blob/08defebb4bdc2003d2d32fe315549b227b72d64f/mqtt_io/modules/gpio/gpiod.py#L18):
[mqtt_io.modules.gpio.gpiod:CONFIG_SCHEMA](https://github.com/flyte/mqtt-io/blob/b35d049d3c9e08aec42194b904498135e6bf2889/mqtt_io/modules/gpio/gpiod.py#L18):

```python
CONFIG_SCHEMA = {
Expand All @@ -40,7 +40,7 @@ CONFIG_SCHEMA = {

During software startup, each GPIO module's `setup_module()` method will be called once per instance of the module in the `gpio_modules` section of the config file.

[mqtt_io.modules.gpio:GenericGPIO.setup_module](https://github.com/flyte/mqtt-io/blob/08defebb4bdc2003d2d32fe315549b227b72d64f/mqtt_io/modules/gpio/__init__.py#L109):
[mqtt_io.modules.gpio:GenericGPIO.setup_module](https://github.com/flyte/mqtt-io/blob/b35d049d3c9e08aec42194b904498135e6bf2889/mqtt_io/modules/gpio/__init__.py#L109):

```python
def setup_module(self) -> None:
Expand Down Expand Up @@ -73,7 +73,7 @@ The GPIO library is then initialised and an object may be stored (usually at `se

It may be appropriate to build mappings of pin directions (input, output), pullups (up, down, off) and interrupt edges (rising, falling, both) if appropriate for this hardware. The base GenericGPIO class uses its own constants to refer to these, so the mappings translate the base GenericGPIO's constants to ones used by the hardware's Python library.

[mqtt_io.modules.gpio:PinDirection](https://github.com/flyte/mqtt-io/blob/08defebb4bdc2003d2d32fe315549b227b72d64f/mqtt_io/modules/gpio/__init__.py#L22):
[mqtt_io.modules.gpio:PinDirection](https://github.com/flyte/mqtt-io/blob/b35d049d3c9e08aec42194b904498135e6bf2889/mqtt_io/modules/gpio/__init__.py#L22):

```python
class PinDirection(Enum):
Expand All @@ -85,7 +85,7 @@ class PinDirection(Enum):
OUTPUT = auto()
```

[mqtt_io.modules.gpio:PinPUD](https://github.com/flyte/mqtt-io/blob/08defebb4bdc2003d2d32fe315549b227b72d64f/mqtt_io/modules/gpio/__init__.py#L31):
[mqtt_io.modules.gpio:PinPUD](https://github.com/flyte/mqtt-io/blob/b35d049d3c9e08aec42194b904498135e6bf2889/mqtt_io/modules/gpio/__init__.py#L31):

```python
class PinPUD(Enum):
Expand All @@ -98,7 +98,7 @@ class PinPUD(Enum):
DOWN = auto()
```

[mqtt_io.modules.gpio:InterruptEdge](https://github.com/flyte/mqtt-io/blob/08defebb4bdc2003d2d32fe315549b227b72d64f/mqtt_io/modules/gpio/__init__.py#L41):
[mqtt_io.modules.gpio:InterruptEdge](https://github.com/flyte/mqtt-io/blob/b35d049d3c9e08aec42194b904498135e6bf2889/mqtt_io/modules/gpio/__init__.py#L41):

```python
class InterruptEdge(Enum):
Expand All @@ -113,7 +113,7 @@ class InterruptEdge(Enum):

The `raspberrypi` GPIO module is a good example of the above:

[mqtt_io.modules.gpio.raspberrypi:GPIO.setup_module](https://github.com/flyte/mqtt-io/blob/08defebb4bdc2003d2d32fe315549b227b72d64f/mqtt_io/modules/gpio/raspberrypi.py#L23):
[mqtt_io.modules.gpio.raspberrypi:GPIO.setup_module](https://github.com/flyte/mqtt-io/blob/b35d049d3c9e08aec42194b904498135e6bf2889/mqtt_io/modules/gpio/raspberrypi.py#L23):

```python
def setup_module(self) -> None:
Expand Down Expand Up @@ -142,7 +142,7 @@ def setup_module(self) -> None:

If a digital input is not configured as an [interrupt](config/interrupts.md) (or even [sometimes if it is](config/reference/digital_inputs/?id=digital_inputs-star-interrupt_for)), then a loop will be created which polls the pin's current value and publishes a `DigitalInputChangedEvent` event when it does. As part of the initialisation of each pin, a callback function to publish the new value on MQTT will be subscribed to this event.

[mqtt_io.server.MqttIo._init_digital_inputs](https://github.com/flyte/mqtt-io/blob/08defebb4bdc2003d2d32fe315549b227b72d64f/mqtt_io/server.py#L377):
[mqtt_io.server.MqttIo._init_digital_inputs](https://github.com/flyte/mqtt-io/blob/b35d049d3c9e08aec42194b904498135e6bf2889/mqtt_io/server.py#L377):

```python
def _init_digital_inputs(self) -> None:
Expand Down Expand Up @@ -175,7 +175,7 @@ def _init_digital_inputs(self) -> None:

For each of the entries in `digital_inputs` and `digital_outputs`, `setup_pin()` will be called. This step is for configuring the hardware's pins to be input or outputs, or anything else that must be set at pin level.

[mqtt_io.modules.gpio:GenericGPIO.setup_pin](https://github.com/flyte/mqtt-io/blob/08defebb4bdc2003d2d32fe315549b227b72d64f/mqtt_io/modules/gpio/__init__.py#L118):
[mqtt_io.modules.gpio:GenericGPIO.setup_pin](https://github.com/flyte/mqtt-io/blob/b35d049d3c9e08aec42194b904498135e6bf2889/mqtt_io/modules/gpio/__init__.py#L118):

```python
def setup_pin(
Expand Down Expand Up @@ -214,7 +214,7 @@ digital_outputs:
Here's the `raspberrypi` GPIO module's `setup_pin()` implementation:
[mqtt_io.modules.gpio.raspberrypi:GPIO.setup_pin](https://github.com/flyte/mqtt-io/blob/08defebb4bdc2003d2d32fe315549b227b72d64f/mqtt_io/modules/gpio/raspberrypi.py#L44):
[mqtt_io.modules.gpio.raspberrypi:GPIO.setup_pin](https://github.com/flyte/mqtt-io/blob/b35d049d3c9e08aec42194b904498135e6bf2889/mqtt_io/modules/gpio/raspberrypi.py#L44):
```python
def setup_pin(
Expand Down

0 comments on commit de0a9ef

Please sign in to comment.