Merge pull request #572 from nuthub/development

Updated README.md and loraconf.h.sample to reflect OTAA/ABP modifications
This commit is contained in:
Verkehrsrot 2020-03-16 07:41:32 +01:00 committed by GitHub
commit b7ae01fe5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 31 deletions

View File

@ -82,25 +82,28 @@ By default bluetooth sniffing is disabled (#define *BLECOUNTER* 0 in paxcounter.
# Preparing # Preparing
Before compiling the code, Compile time configuration is spread across several files. Before compiling the code, edit or create the following files:
- **edit platformio.ini** and select desired hardware target in section boards. To add a new board, create an appropriate hardware abstraction layer file in hal subdirectory, and add a pointer to this file in sections boards. ## platformio.ini
Edit `platformio.ini` and select desired hardware target in section boards. To add a new board, create an appropriate hardware abstraction layer file in hal subdirectory, and add a pointer to this file in sections boards.
- **edit src/paxcounter.conf** and tailor settings in this file according to your needs and use case. Please take care of the duty cycle regulations of the LoRaWAN network you're going to use. ## src/paxcounter.conf
Edit `src/paxcounter.conf` and tailor settings in this file according to your needs and use case. Please take care of the duty cycle regulations of the LoRaWAN network you're going to use.
- **edit src/lmic_config.h** and tailor settings in this file according to your country and device hardware. Please take care of national regulations when selecting the frequency band for LoRaWAN. If your device has a **real time clock** it can be updated bei either LoRaWAN network or GPS time, according to settings *TIME_SYNC_INTERVAL* and *TIME_SYNC_LORAWAN* in `paxcounter.conf`.
- **create file loraconf.h in your local /src directory** using the template [loraconf.sample.h](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/src/loraconf.sample.h) and populate it with your personal APPEUI und APPKEY for the LoRaWAN network. If you're using popular <A HREF="https://thethingsnetwork.org">TheThingsNetwork</A> you can copy&paste the keys from TTN console or output of ttnctl. ## src/lmic_config.h
Edit `src/lmic_config.h` and tailor settings in this file according to your country and device hardware. Please take care of national regulations when selecting the frequency band for LoRaWAN.
- **create file ota.conf in your local /src directory** using the template [ota.sample.conf](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/src/ota.sample.conf) and enter your WIFI network&key. These settings are used for downloading updates. If you want to push own OTA updates you need a <A HREF="https://bintray.com/JFrog">Bintray account</A>. Enter your Bintray user account data in ota.conf. If you don't need wireless firmware updates just rename ota.sample.conf to ota.conf. ## src/loraconf.h
Create file `src/loraconf.h` using the template [src/loraconf.sample.h](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/src/loraconf.sample.h) and modify it, to use your personal values.
To join the network and activate your paxcounter, you have to configure either the preferred OTAA method or the ABP method. You should use OTAA, whenever possible. To understand the differences of the two methods, [this article](https://www.thethingsnetwork.org/docs/devices/registration.html) may be useful.
To join the network you have to configure either the preferred OTAA method or the ABP method. The DEVEUI for OTAA will be derived from the device's MAC adress during device startup and is shown on the device's display (if it has one). It is also printed on the serial console for copying it, if you set *verbose 1* in paxcounter.conf and *debug_level 3* in platformio.ini. To configure OTAA, leave `#define LORA_ABP` deactivated (commented). To use ABP, activate (uncomment) `#define LORA_ABP` in the file `src/loraconf.h`.
The file `src/loraconf.h.sample` contains more information about the values to provide.
If your device has a fixed DEVEUI enter this in your local loraconf.h file. During compile time this DEVEUI will be grabbed from loraconf.h and inserted in the code. ## src/ota.conf
Create file `src/ota.conf` using the template [src/ota.sample.conf](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/src/ota.sample.conf) and enter your WIFI network&key. These settings are used for downloading updates. If you want to push own OTA updates you need a <A HREF="https://bintray.com/JFrog">Bintray account</A>. Enter your Bintray user account data in ota.conf. If you don't need wireless firmware updates just rename ota.sample.conf to ota.conf.
If your device has silicon **Unique ID** which is stored in serial EEPROM Microchip 24AA02E64 you don't need to change anything. The Unique ID will be read during startup and DEVEUI will be generated from it, overriding settings in loraconf.h.
If your device has a **real time clock** it can be updated bei either LoRaWAN network or GPS time, according to settings *TIME_SYNC_INTERVAL* and *TIME_SYNC_LORAWAN* in paxcounter.conf.
# Building # Building

View File

@ -9,34 +9,32 @@
* Read the values from TTN console (or whatever applies), insert them here, * Read the values from TTN console (or whatever applies), insert them here,
* and rename this file to src/loraconf.h * and rename this file to src/loraconf.h
* *
* You can configure you PaxCounter to activate via OTAA (recommended) or ABP. * You can configure OTAA or ABP Activation. In order to use ABP, uncomment
* In order to use ABP, uncomment (enable) the following line, * (enable) the following line, but you should only do so, if you have good
* otherwise, leave the line commented (disabled). * reasons for not using OTAA.
* *
*************************************************************/ *************************************************************/
//#define LORA_ABP //#define LORA_ABP
#ifndef LORA_ABP
/************************************************************ /************************************************************
* OTAA configuration * OTAA configuration
* *
* Note that DEVEUI, APPEUI and APPKEY should all be specified in MSB format. * DEVEUI, APPEUI and APPKEY should all be specified in MSB format as
* (This is different from standard LMIC-Arduino which expects DEVEUI and APPEUI * displayed in TTN console, so you can cut & paste from there. This is different
* in LSB format.) * from standard LMIC-Arduino which expects DEVEUI and APPEUI in LSB format.
* For TTN, APPEUI in MSB format always starts with 0x70, 0xB3, 0xD5.
* Set your DEVEUI here, if you have one. You can leave this untouched, * Set your DEVEUI here, if your device has have a fixed one.
* then the DEVEUI will be generated during runtime from device's MAC adress * If you leave this untouched, then the DEVEUI will be derived from device's
* and will be displayed on device's screen as well as on serial console. * MAC adress during startup and will be displayed on device's screen as well as
* * on serial console, if you set 'verbose 1' in paxcounter.conf and
* NOTE: Use MSB format (as displayed in TTN console, so you can cut & paste * 'debug_level 3' in platformio.ini.
* from there) * If using a board with Microchip 24AA02E64 Uinique ID for deveui, the DEVEUI
* For TTN, APPEUI in MSB format always starts with 0x70, 0xB3, 0xD5 * will be overwritten by the one contained in the Microchip module.
*
* Note: If using a board with Microchip 24AA02E64 Uinique ID for deveui,
* the DEVEUI will be overwriten by the one contained in the Microchip module
* *
************************************************************/ ************************************************************/
#ifndef LORA_ABP
static const u1_t DEVEUI[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; static const u1_t DEVEUI[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
@ -48,6 +46,7 @@ static const u1_t APPKEY[16] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
#endif #endif
#ifdef LORA_ABP
/************************************************************ /************************************************************
* ABP configuration (for development) * ABP configuration (for development)
* *
@ -55,13 +54,16 @@ static const u1_t APPKEY[16] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
* - Network Session Key (NWKSKEY) * - Network Session Key (NWKSKEY)
* - App Session Key and your (APPSKEY) * - App Session Key and your (APPSKEY)
* - Device Address (DEVADDR) * - Device Address (DEVADDR)
* from TTN console and replace the example values below. * from e.g. TTN console and replace the example values below.
* *
* NOTE: Use MSB format (as displayed in TTN console, so you can cut & paste * NOTE: Use MSB format (as displayed in TTN console, so you can cut & paste
* from there) * from there)
* *
* NOTE: You may also need to adjust lorawan_abp.cpp in order to configure
* different channels and data rate channels to match your country's regulations
* and your network's settings.
*
************************************************************/ ************************************************************/
#ifdef LORA_ABP
// ID of LoRaAlliance assigned Network (for a list, see e.g. here https://www.thethingsnetwork.org/docs/lorawan/prefix-assignments.html) // ID of LoRaAlliance assigned Network (for a list, see e.g. here https://www.thethingsnetwork.org/docs/lorawan/prefix-assignments.html)
static const u1_t NETID = 0x13; // TTN static const u1_t NETID = 0x13; // TTN