diff --git a/docs/additions.md b/docs/additions.md index 045df9c7..a711986d 100644 --- a/docs/additions.md +++ b/docs/additions.md @@ -1,4 +1,4 @@ -# Sensors and Peripherals +## Sensors and Peripherals You can add up to 3 user defined sensors. Insert your sensor's payload scheme in [*sensor.cpp*](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/src/sensor.cpp). Bosch BMP180 / BME280 / BME680 environment sensors are supported, to activate configure BME in board's hal file before build. Furthermore, SDS011, RTC DS3231, generic serial NMEA GPS, I2C LoPy GPS are supported, and to be configured in board's hal file. See [*generic.h*](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/src/hal/generic.h) for all options and for proper configuration of BME280/BME680. @@ -19,23 +19,23 @@ Output of sensor and peripheral data is internally switched by a bitmask registe \*) GPS data can also be combined with paxcounter payload on port 1, *#define GPSPORT 1* in paxcounter.conf to enable -# Power saving mode +## Power saving mode Paxcounter supports a battery friendly power saving mode. In this mode the device enters deep sleep, after all data is polled from all sensors and the dataset is completeley sent through all user configured channels (LORAWAN / SPI / MQTT / SD-Card). Set *#define SLEEPCYCLE* in paxcounter.conf to enable power saving mode and to specify the duration of a sleep cycle. Power consumption in deep sleep mode depends on your hardware, i.e. if on board peripherals can be switched off or set to a chip specific sleep mode either by MCU or by power management unit (PMU) as found on TTGO T-BEAM v1.0/V1.1. See [*power.cpp*](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/src/power.cpp) for power management, and [*reset.cpp*](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/src/reset.cpp) for sleep and wakeup logic. -# Time sync +## Time sync Paxcounter can keep a time-of-day synced with external or on board time sources. Set *#define TIME_SYNC_INTERVAL* in paxcounter.conf to enable time sync. Supported external time sources are GPS, LORAWAN network time and LORAWAN application timeserver time. Supported on board time sources are the RTC of ESP32 and a DS3231 RTC chip, both are kept sycned as fallback time sources. Time accuracy depends on board's time base which generates the pulse per second. Supported are GPS PPS, SQW output of RTC, and internal ESP32 hardware timer. Time base is selected by #defines in the board's hal file, see example in [*generic.h*](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/src/hal/generic.h). Bonus: If your LORAWAN network does not support network time, you can run a Node-Red timeserver application using the enclosed [**Timeserver code**](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/src/Node-RED/Timeserver.json). Configure the MQTT nodes in Node-Red for the LORAWAN application used by your paxocunter device. Time can also be set without precision liability, by simple remote command, see section remote control. -# Wall clock controller +## Wall clock controller Paxcounter can be used to sync a wall clock which has a DCF77 or IF482 time telegram input. Set `#define HAS_IF482` or `#define HAS_DCF77` in board's hal file to setup clock controller. Use case of this function is to integrate paxcounter and clock. Accurary of the synthetic DCF77 signal depends on accuracy of on board's time base, see above. -# Mobile PaxCounter using openSenseMap +## Mobile PaxCounter using openSenseMap This describes how to set up a mobile PaxCounter:
Follow all steps so far for preparing the device, selecting the packed payload format. In `paxcounter.conf` set `PAYLOAD_OPENSENSEBOX` to `1`. Register a new sensebox on [https://opensensemap.org/](https://opensensemap.org). In the sensor configuration select "TheThingsNetwork" and set decoding profile to "LoRa serialization". Enter your TTN Application and Device ID. Setup decoding option using `[{"decoder":"latLng"},{"decoder":"uint16",sensor_id":"yoursensorid"}]`. -# SD-card +## SD-card Data can be stored on SD-card if the board provides an SD card interface, either with SPI or MMC mode. To enable this feature, specify interface mode and hardware pins in board's hal file (src/hal/): diff --git a/docs/hardware.md b/docs/hardware.md index f61b614e..1e691864 100644 --- a/docs/hardware.md +++ b/docs/hardware.md @@ -1,6 +1,6 @@ # Hardware -**Supported ESP32 based boards**: +### Supported ESP32 based boards: *With LoRa radio data transfer*: diff --git a/docs/remotecontrol.md b/docs/remotecontrol.md index 4dc83863..cddb9719 100644 --- a/docs/remotecontrol.md +++ b/docs/remotecontrol.md @@ -9,28 +9,28 @@ Send for example `83` `86` as Downlink on Port 2 to get battery status and time/ ![Remote Control](img/paxcounter_downlink_example.png) -0x01 set scan RSSI limit +#### 0x01 set scan RSSI limit 1 ... 255 used for wifi and bluetooth scan radius (greater values increase scan radius, values 50...110 make sense) 0 = RSSI limiter disabled [default] -0x02 set counter mode +#### 0x02 set counter mode 0 = cyclic unconfirmed, mac counter reset after each wifi scan cycle, data is sent only once [default] 1 = cumulative counter, mac counter is never reset 2 = cyclic confirmed, like 0 but data is resent until confirmation by network received -0x03 set GPS data on/off +#### 0x03 set GPS data on/off 0 = GPS data off 1 = GPS data on, sends GPS data on port 4 (default, use port 1 for mobile pax counter), if GPS is present and has a fix -0x04 set display on/off +#### 0x04 set display on/off 0 = display off 1 = display on [default] -0x05 set LoRa datarate +#### 0x05 set LoRa datarate 0 ... 15 see LoRaWAN regional parameters for details [default: 5] @@ -50,22 +50,22 @@ Send for example `83` `86` as Downlink on Port 2 to get battery status and time/ *) not supported by TheThingsNetwork -0x06 set LoRa TXpower +#### 0x06 set LoRa TXpower 0 ... 255 desired TX power in dBm [default: 14] -0x07 set LoRa Adaptive Data Rate mode +#### 0x07 set LoRa Adaptive Data Rate mode 0 = ADR off 1 = ADR on [default] If ADR is set to off, SF value is shown inverted on display. -0x08 do nothing +#### 0x08 do nothing useful to clear pending commands from LoRaWAN server quere, or to check RSSI on device -0x09 reset functions (send this command UNconfirmed only to avoid boot loops!) +#### 0x09 reset functions (send this command UNconfirmed only to avoid boot loops!) 0 = restart device (coldstart) 1 = (reserved, currently does nothing) @@ -75,43 +75,43 @@ Send for example `83` `86` as Downlink on Port 2 to get battery status and time/ 8 = reboot device to maintenance mode (local web server) 9 = reboot device to OTA update via Wifi mode -0x0A set payload send cycle +#### 0x0A set payload send cycle 5 ... 255 payload send cycle in seconds/2 e.g. 120 -> payload is transmitted each 240 seconds [default] -0x0B set Wifi channel hopping interval timer +#### 0x0B set Wifi channel hopping interval timer 0 ... 255 duration for scanning a wifi channel in seconds/100 e.g. 50 -> each channel is scanned for 500 milliseconds [default] 0 means no hopping, scanning on fixed single channel WIFI_CHANNEL_1 -0x0C set Bluetooth channel switch interval timer +#### 0x0C set Bluetooth channel switch interval timer 0 ... 255 duration for scanning a bluetooth advertising channel in seconds/100 e.g. 8 -> each channel is scanned for 80 milliseconds [default] -0x0E set Bluetooth scanner +#### 0x0E set Bluetooth scanner 0 = disabled 1 = enabled [default] -0x0F set WIFI antenna switch (works on LoPy/LoPy4/FiPy only) +#### 0x0F set WIFI antenna switch (works on LoPy/LoPy4/FiPy only) 0 = internal antenna [default] 1 = external antenna -0x10 set RGB led luminosity (works on LoPy/LoPy4/FiPy and LoRaNode32 shield only) +#### 0x10 set RGB led luminosity (works on LoPy/LoPy4/FiPy and LoRaNode32 shield only) 0 ... 100 percentage of luminosity (100% = full light) e.g. 50 -> 50% of luminosity [default] -0x13 set user sensor mode +#### 0x13 set user sensor mode byte 1 = user sensor number (1..3) byte 2 = sensor mode (0 = disabled / 1 = enabled [default]) -0x14 set payload mask +#### 0x14 set payload mask byte 1 = sensor data payload mask (0..255, meaning of bits see below) 0x01 = COUNT_DATA @@ -124,59 +124,59 @@ Send for example `83` `86` as Downlink on Port 2 to get battery status and time/ 0x80 = BATT_DATA bytes can be combined eg COUNT_DATA + SENSOR_1_DATA + BATT_DATA: `0x01 | 0x10 | 0x80 = 0x91` -0x15 set BME data on/off +#### 0x15 set BME data on/off 0 = BME data off 1 = BME data on, sends BME data on port 7 [default] -0x16 set battery data on/off +#### 0x16 set battery data on/off 0 = battery data off [default] 1 = battery data on, sends voltage on port 8 -0x17 set Wifi scanner +#### 0x17 set Wifi scanner 0 = disabled 1 = enabled [default] -0x18 reserved +#### 0x18 reserved unused, does nothing -0x19 set sleep cycle +#### 0x19 set sleep cycle bytes 1..2 = device sleep cycle in seconds/10 (MSB), 1 ... 255 e.g. {0x04, 0xB0} -> device sleeps 200 minutes after each send cycle [default = 0] -0x20 load device configuration +#### 0x20 load device configuration Current device runtime configuration will be loaded from NVRAM, replacing current settings immediately (use with care!) -0x21 store device configuration +#### 0x21 store device configuration Current device runtime configuration is stored in NVRAM, will be reloaded after restart -0x80 get device configuration +#### 0x80 get device configuration Device answers with it's current configuration on Port 3. -0x81 get device status +#### 0x81 get device status Device answers with it's current status on Port 2. -0x83 get battery status +#### 0x83 get battery status Device answers with battery voltage on Port 8. -0x84 get device GPS status +#### 0x84 get device GPS status Device answers with it's current status on Port 4. -0x85 get BME280 / BME680 sensor data +#### 0x85 get BME280 / BME680 sensor data Device answers with BME sensor data set on Port 7. -0x86 get time/date +#### 0x86 get time/date Device answers with it's current time on Port 2: @@ -195,10 +195,10 @@ Send for example `83` `86` as Downlink on Port 2 to get battery status and time/ 0x01 = SNTP_SYNC_STATUS_COMPLETED 0x02 = SNTP_SYNC_STATUS_IN_PROGRESS -0x87 sync time/date +#### 0x87 sync time/date Device synchronizes it's time/date by calling the preconfigured time source. -0x88 set time/date +#### 0x88 set time/date - bytes 1..4 = time/date to set in UTC epoch seconds (MSB, e.g. https://www.epochconverter.com/hex) + bytes 1..4 = time/date to set in UTC epoch seconds (MSB, e.g. https://www.epochconverter.com/hex) \ No newline at end of file