en:monitoring_and_warning:software
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
en:monitoring_and_warning:software [2023/01/23 15:17] – m-gamperl | en:monitoring_and_warning:software [2023/01/24 11:15] – m-gamperl | ||
---|---|---|---|
Line 23: | Line 23: | ||
* [[https:// | * [[https:// | ||
* Libraries to be downloaded from the Inform@Risk GitHub page: | * Libraries to be downloaded from the Inform@Risk GitHub page: | ||
- | * agr_ads1220.h | + | * [[https:// |
- | * [[https:// | + | * [[https:// |
+ | |||
+ | The SPI.h is a standard library that can be accessed by just including < | ||
+ | |||
+ | ===== Setup and Installation ===== | ||
==== Hardware Setup to Upload and Test the Nodes ==== | ==== Hardware Setup to Upload and Test the Nodes ==== | ||
- | In order for the nodes to work, the PCB has to be prepared as shown in the last instruction manual (1 - Measurement | + | In order for the nodes to work, the PCB has to be prepared as shown in the [[mnodes|LoRa |
{{hardware.jpg|Example of hardware setup for uploading code to the arduino. In this example, additional sensors are attached at the bottom.}} | {{hardware.jpg|Example of hardware setup for uploading code to the arduino. In this example, additional sensors are attached at the bottom.}} | ||
Line 42: | Line 46: | ||
{{tabs.png|Inform@Risk Measurement Node software when opened for the first time. Note the seven tabs on the top which correspond to the ' | {{tabs.png|Inform@Risk Measurement Node software when opened for the first time. Note the seven tabs on the top which correspond to the ' | ||
- | The tabs correspond to the ‘.h’ files in the folder in which the Arduino file is located. The .h files have different functions, which are explained below. If the Inform@Risk board is used, usually only the Uni\textunderscore Config.h file needs to be changed by the user. | + | The tabs correspond to the ‘.h’ files in the folder in which the Arduino file is located. The .h files have different functions, which are explained below. If the Inform@Risk board is used, usually only the Uni_Config.h file needs to be changed by the user. |
The tabs' functions are as follows: | The tabs' functions are as follows: | ||
Line 48: | Line 52: | ||
^ Name ^ Functionality | ^ Name ^ Functionality | ||
| LoRaBasis_InformRisk | Main Code, which houses the main setup and loop functionality | | | LoRaBasis_InformRisk | Main Code, which houses the main setup and loop functionality | | ||
- | | ADC_Config.h | Configuration file for the ADC (Analog‐Digital Converter) ADS1220 | | + | | setup.h | Configuration file for the Inform@Risk PCB | |
- | | SCL_Config.h | + | | general_config.h |
- | | SMN_Config.h | + | | BATV_config.h |
- | | Uni_Config.h | + | | BARO_config.h |
+ | | IMU_config.h | Configuration file for the IMU | | ||
+ | | AD24_config.h | Configuration file for the 24-bit | ||
+ | | AD12_config.h | Configuration file for the 12-bit ADC (Analog-Digital Converter) on the Arduino Board | | ||
+ | | INCL_config.h | Configuration file for the SCL3300 inclination board | | ||
+ | | SMN_config.h | Configuration file for the Subsurface Sensors on the Subsurface Measurement Node | | ||
| arduino_secrets.h | | arduino_secrets.h | ||
- | | extra_functions.h | + | | extra_functions.h |
- | {{tabs-2.png|Detail view of the seven files/tabs shown in figure above.}} | ||
When the libraries are installed correctly, the code should compile without problems. There are | When the libraries are installed correctly, the code should compile without problems. There are | ||
several issues that could occur, we will add possible problems in a future version of this guide. If you have problems, you can contact us under moritz.gamperl@tum.de. | several issues that could occur, we will add possible problems in a future version of this guide. If you have problems, you can contact us under moritz.gamperl@tum.de. | ||
- | ===== Settings | + | ===== Parameter |
- | In this tab, the general settings are performed. The Uni_Config file is structured as follows: | + | ==== setup.h ==== |
- | * Include libraries and necessary files | + | |
- | * Universal Configurations: | + | |
- | * Hardware Configuration | + | |
- | * Include extra configuration files for SCL, SMN and ADC, as well as functions | + | |
- | Of these parts, only the timing definitions and the sensor states | + | This file contains |
- | {{config.png|Timing and sensor configuration in the Uni_Config file}} | + | ==== general_config.h ==== |
- | Each of these parameters is described shortly on the right side as comments. | + | In this file, the basic settings can be changed by the user during installation. The general_config.h file is structured as follows: |
+ | * Timing setup | ||
+ | * Definitions of sleep mode | ||
+ | * Definitions of Data Packet Designator | ||
- | ==== Serial | + | === Definition of Serial |
- | The first command | + | The first line of code (**# define SP Serial**) defines which serial port is used. This is important for debugging, as the Serial monitor of the Arduino via USB shuts down once the processor goes into deepsleep-mode (described in detail in the deepsleep |
- | ==== Loopintv ==== | + | === Definition of Sensor States |
- | Loopintv controls the interval | + | In this section |
- | The sleeptime is calculated | + | These settings can be seen as general toggles for the different sensors. If they are not turned on, all subsequent settings (for the ADC e.g. in the “**ADC_Config.h**” file) are disregarded. If, for example, the SMN is attached, but with settings different from the default (explained in the SMN section), the SMN must be turned on here and the specific settings have to be changed in the **SMN\textunderscore Config.h** file. |
- | sleeptime | + | === Definition of Active Power Ports === |
- | ==== Sensor State ==== | + | These parameters define which power ports should be active during measurements (does not apply to the SMN measurements). While the SET_V12 and SET_SW3V3 ports are the regular ports that can be accessed from the connectors on the PCB, the alternative SW3V3_A and SW3V3_B ports are actually the Analog in ports on the Arduino, which can be set to be used as outputs. They are different from the regular SW3V3 and V12 though, as they can supply less current than the latter. |
- | The Sensor State section is used to turn on/off the different sensors which are connected on the board or can be attached to it. To turn a sensor on, simply write “**= true**” after the corresponding variable. This is the main section which needs to be changed when setting up a sensor either in the field or when preparing it beforehand. Please note that for the current PCB version (V 0.2), no IMU is attached on the board, so this is always false. **Desig** | + | {{serial.png|Serial Settings, Sensor Activation Settings |
- | These settings can be seen as general toggles for the different sensors. If they are not turned on, all subsequent | + | === Setup of LoRa Connection === |
+ | |||
+ | Under this subsection of the general_config.h file, the parameters define the LoRa connection | ||
+ | |||
+ | {{lora.png|LoRa Connection Settings | ||
+ | |||
+ | * The (**# define LORA_BAND**) defines the LoRa Band Connection. This is different | ||
+ | * The (**# define LORA_ADR**) defines the Automatic Data transfer Rate, where true allows | ||
+ | * **# define LORA_DR** also defines the data transfer rate according to the LoRa Band that is choosen. It varies according to different | ||
+ | * **# define LORA_CH_DEF** defines the Channel Plan. True uses the default | ||
+ | * **# define LORA_TIMEOUT** defines the LoRa Connection timeout in seconds. | ||
+ | * The appEui and appKey are secret keys specified in the arduino_secrets_config.h file (described in detail | ||
+ | |||
+ | === Timing setup === | ||
+ | |||
+ | This subsection of the general_config.h file defines the timing parameters for loop intervals during measurement cycles. The parameters can be seen in the next figure. | ||
+ | |||
+ | **loopintv** controls the interval of one cycle, including initialization, | ||
+ | |||
+ | sleeptime = loopintv - (measlength + sensorstarttime) | ||
+ | |||
+ | === Sleep Mode === | ||
+ | |||
+ | This setting helps the sensors | ||
+ | |||
+ | === Data Packet Designator === | ||
+ | |||
+ | This defines the payload type, it is automatically updated depending on the sensors that are active. | ||
+ | |||
+ | {{timing.png|Timing, | ||
==== ADC Settings and Measurement ==== | ==== ADC Settings and Measurement ==== | ||
+ | |||
+ | The Analog to Digital Converter(ADC) sensor configuration is split into two major files: | ||
+ | |||
+ | === AD12_config.h === | ||
+ | |||
+ | The 12-bit Analog to Digital Converter is embedded in the Ardunio MRKWAN 1310 board. The **AD12_config.h** file contains the settings for this sensor. The section under " | ||
+ | |||
+ | * The **# define AD12_AIN0** and **int AD12_AIN1** define which AD12 channels are active, and in which mode they operate. The **AIN0** and **AIN1** are the two channels available. Setting either of the channels to 0 means the channel is off and setting it to 1 means the channel is set to a single ended voltage measurement with 3.3V reference. | ||
+ | * The **int AD12_MINT** defines the time interval (in ms) at which the AD24 measurement is read. It is advised to keep this setting above 50 ms per active channel. | ||
+ | * The **#define AD12_TRANS_AIN0** and **int AD12_TRANS_AIN1** defines whether the ADC data is transmitted via the LoRa network. O stands for no and 1 stands for yes. | ||
+ | |||
+ | The rest of the file contains Global variables and functions that must not be modified/ | ||
+ | |||
+ | {{ad12.png|Measurement Settings from the AD12_config.h file}} | ||
+ | |||
+ | === AD24_config.h === | ||
+ | |||
+ | The 24-bit analog to digital converter is the ADS1220 (Texas Instruments). Hence the ADS1220 library must be added to the file. The **AD24_config.h** is quite similar to the **AD12_config.h**. The 24-bit ADC has 4 channels that can be set up. Each channel can also be set up in 5 different modes. Each mode has a detail explanation in the configuration file. It also has extra functionalities like calibration settings and debug message settings. | ||
+ | |||
+ | * The **#define AD24_AIN0, AD24_AIN1, AD24_AIN2, AD24_AIN3** define which AD24 channels are active, and in which mode they operate. Setting any of the channels to 0 means the channel is off. Setting the channels to 1 means the channel is set to a single ended voltage measurement with 3.3V reference. Setting the channels to 2 means the channel has a single ended current measurement. Setting the channels to 3 means Differential Voltage Measurement between this channel and +1 channel (e.g. if set on channel 0, then diff. measurement is performed between channels 0 and 1. It is advised to set +1 Channel to 0 (OFF) to avoid Errors). Setting the channels to 4 means the channel is in Custom Mode (Not implemented yet) | ||
+ | * The **int AD24_MINT** defines the time interval (in ms) at which the AD24 measurement is read. It is advised to keep this setting above 150 ms per active channel. | ||
+ | * The **#define AD24_DEBUG** is used to activate debug messages. Setting it to 0 turns off the debug messages and setting it to 1 turns on the debug messages. | ||
+ | * The **#define AD24_CALIB** is used to activate auto calibration during initialization. Setting it to 0 turns off the calibration and setting it to 1 turns on the calibration. | ||
+ | * The **#define AD24_TRANS_AIN0, | ||
+ | |||
+ | {{ad24.png|Measurement Settings from the AD24\textunderscore config.h file}} | ||
==== SMN Settings and Measurement ==== | ==== SMN Settings and Measurement ==== | ||
- | ==== LCI Settings and Measurement ==== | + | The Subsurface measurement probe/Low cost Inclinometer settings are defined in the SMN_config.h file. To fully activate the Subsurface Measurement Probe/Low Cost Inclinometer, |
+ | |||
+ | * The AD24 must be activated and one of the channels must be set to "mode 1" (single channel voltage). The wire for signal out of water pressure sensor (orsnge wire) to the appropriate port. | ||
+ | * Connect the power source (red wire) to the SW3V3 port, and ground it by connecting the black wire to the the GND port. Also change the SW3V3 parameter in the **general_config.h** to " | ||
+ | * If the I2A or I2B sensor is used, set it to either the AIN0_12 OR AIN1_12 port in general_config.h (which is the correct port?). Set SW3V3A to false in the **general_config.h**, | ||
+ | * Connect the green and yellow wire to the SDA and SCL of the I2C port respectively. | ||
+ | |||
+ | After follwing this procedure, the Subsurface Measurement Probe or Low Cost Inclinometer is set up. The following are the various parameters listed in the **SMN_config.h** that can be adjusted accordingly. | ||
+ | |||
+ | {{smn1.png|SMN Variables and Definition of Inclination sensors from the SMN_config.h file}} | ||
+ | |||
+ | {{smn2.png|Data retrieval Rate and Transmission Settings from the SMN_config.h file}} | ||
+ | |||
+ | ==== LCI Settings and Measurement ==== | ||
+ | |||
+ | These are the settings that need to be changed by the user when installing a sensor. The subsequent tabs with configurations for the individual sensors on the other hand contain more detailed sensors that should only be changed when detail settings need to change. Each of these parameters is described in the code shortly on the right side as comments. | ||
+ | |||
+ | ==== BATV_config.h ==== | ||
+ | |||
+ | This file stores the configuration for the battery voltage measurement. The hardware is designed in such a way that it is possible to measure the battery voltage using the analog input of the Arduino. The settings do normally not have to be changed by the user. | ||
+ | |||
+ | ==== BARO_config.h ==== | ||
+ | |||
+ | In this section, the settings for the barometer **BMP388** are defined. Usually, the settings don't need to be changed. The settings that could be changed by the user are, for example, **BARO_MODE** or **BARO_TIMING**. For more information on this, please check the [[https:// | ||
+ | |||
+ | ==== IMU_config.h ==== | ||
+ | |||
+ | ==== INCL_config.h ==== | ||
+ | |||
+ | ==== SMP_config.h ==== | ||
+ | |||
+ | ==== arduino_secrets ==== | ||
+ | |||
+ | ==== extra_functions ==== | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
- | ==== Active and DeepSleep Mode ==== |
en/monitoring_and_warning/software.txt · Last modified: 2023/01/24 12:05 by m-gamperl