Skip to content

User Configuration File

Previously, on Project Configuration, we have seen how to configure rhomb.IoT to work with each microcontroller, but we have many other parameters to configure how our application will work. The list may be a little long but don't worry, you'll also find ready-made settings that you can simply copy and paste.

The configuration file is located on lib/rhomb.iot/conf/conf-user.h and is composed of a list of C++ MACROS that we can edit.

A small example

We want to configure the network to transmit data with GPRS. Open conf-user.h, search and edit:

#define USE_NET true
#define NET_MODEM NET_SIM868

With these two options we are enabling the network module (USE_NET true) and configure the communication module NET_SIM868. Other modems will be listed below.

In this article you will learn about the different sections of the configuration file and how to change the values.

All the options

#define CFG_VERSION 1 // change to invalidate previous stored config
#define DEVICE_NAME "" // device name
#define DEVICE_ID "" // device id
#define USE_SERIAL_SOFTWARE 0 // Use software serial
#define SERIAL_DEBUG Serial // Serial object for debug monitor
#define SERIAL_DEBUG_BAUDS 115200 // speed
#define SERIAL_DEBUG_TX 0 // if software serial enabled, tx pin
#define SERIAL_DEBUG_RX 0 // if software serial enabled, rx pin
#define SERIAL_DEBUG_WAIT 1 // wait after begin() for leonardo and zero
#define SERIAL_AT Serial2 // Serial object for modem communication (At commands)
#define SERIAL_AT_BAUDS 115200 // speed
#define SERIAL_AT_RX 0 // if software serial enabled, tx pin
#define SERIAL_AT_TX 0 // if software serial enabled, rx pin
#define SERIAL_AT_WAIT 1 // wait after begin() for leonardo and zero
#define SERIAL_EXT -1 // Serial object for external UART controller
#define SERIAL_EXT_BAUDS 0 // speed
#define SERIAL_EXT_RX 0 // if software serial enabled, tx pin
#define SERIAL_EXT_TX 0 // if software serial enabled, rx pin
#define SERIAL_EXT_WAIT 0 // wait after begin() for leonardo and zero
#define USE_NET true // enable communication module
#define KEEP_TCP_OPEN false // keep TCP open for fast transmissions
#define BATCH_TRANSMIT 5 // transmit multiple messages at once
#define REMOTE_SERVER1 "192.168.1.37" // remote server ip/domain
#define REMOTE_SERVER2 "" // backup server
#define REMOTE_PORT1 3000 // remote server port
#define REMOTE_PORT2 3000 // backup remote server port
#define NET_MODEM MODEM_ESP32 // select communication module
#define NET_SERIAL -1 // assign a serial object (SERIAL_AT or SERIAL_EXT)
#define WIFI_USER "" // wifi ssid if assign MODEM_ESP32
#define WIFI_PASS "" // wifi pass if assign MODEM_ESP32
#define WIFI_AP_SSID "rhomb.iot" // wifi hot spot user if assign MODEM_ESP32
#define WIFI_AP_PASS "12345678" // wifi hot spot pass if using MODEM_ESP32
#define SIM_APN "m2m.orange.es" // SIM APN
#define SIM_USER "" // SIM APN User
#define SIM_PASS "" // SIM APN Pass
#define USE_GPS false // Enable GPS module
#define GPS_MODEM -1 // Select GPS module, GPS_L86 or GPS_868
#define GPS_SERIAL -1 // assign a serial object, SERIAL_AT or SERIAL_EXT
#define INTERRUPT_PIN NMI // main interrupt pin
#define USE_SENSORS false // enable reading data sensors
#define USE_SENS_TEMP -1 // enable temperature sensor BME280, DHT11, SHT20...
#define USE_SENS_HUMI -1 // enable humidity BME280, DHT11, SHT20...
#define USE_SENS_PRESS -1 // enable atmospheric pressure BME280
#define USE_TIME true // add time marks to server messages
#define TICK_TIMER1 10 // main time interval for message creation
#define TICK_TIMER2 0 // secondary time interval
#define USE_LOG -1 // Data logger module to backup failed message transmissions
#define USE_STORAGE -1 // memory method for persistent configuration
#define USE_BATT BATT_HALLEY // read battery status
#define USE_VBAT true // read VBAT (lithium battery)
#define USE_VSYS true // read VSYS (usb connector)
#define USE_VIN true // read VIN (pin VIN)
#define REQUIRED_VBAT 0 // minimum vbat before enter sleep mode
#define REQUIRED_VSYS 0 // minimum vsys before enter sleep mode
#define REQUIRED_VIN 0 // minimum vin before enter sleep mode
// do not configure this
#define BUFFER_SIZE 120
#define BUFFER_SIZE_MSG 120
#define BUFFER_SIZE_APN 15
#define BUFFER_SIZE_APN_USER 1
#define BUFFER_SIZE_APN_PASS 1
#define BUFFER_SIZE_REMOTE_SERVER 20
#define BUFFER_SIZE_REMOTE_PORT 6
#define BUFFER_SIZE_SMS_NUMBER 1
#define BUFFER_SIZE_DEVICE_NAME 20
#define BUFFER_SIZE_DEVICE_ID 20

Along this article we will explain these options.

Property Default value Desc
CFG_VERSION [Int] 1 Change to invalidate previous stored config. When there is a configuration saved on EEPROM the device will omit de user-conf and use the saved config. You have to invalidate saved conf if you make a change in your user conf file
DEVICE_NAME [String] "" Name for your device. It will be visible in web dashboard or when making a Bluetooth.
DEVICE_ID [String] "" The device ID. Ussually is set automatically when using a net modem like SIM868 (with SIM IMEI) or ESP32 (Wifi MAC address)

Serial Ports

Property Default value Desc
USE_SERIAL_SOFTWARE [Bool] false Enables the library SoftwareSerial of Arduino. You can use it with Duino Uno or ESP8266.
SERIAL_DEBUG [HardwareSerial] Serial Corresponding Arduino hardware Serial object for debug monitor. Usually is Serial, Serial1, Serial2, SerialUSB, SerialX... Use SERIAL_SOFTWARE to enable software library for this serial.
SERIAL_DEBUG_BAUDS [Int] 115200 Bauds for debug monitor
SERIAL_DEBUG_TX [Int] 0 TX pin if software serial is enabled. You should connect this pin to the RX of an external FTDItoUSB device connected to your computer.
SERIAL_DEBUG_RX [Int] 0 RX pin if software serial is enabled. As TX, connect to an external FTDItoUSB (TX pin)
SERIAL_DEBUG_WAIT [Bool] false Wait after SERIAL_DEBUG.begin(), for Duino Leonardo and Duino Zero
SERIAL_AT [HardwareSerial] Serial2 Serial object for modem communication (At commands). Bellow you can assign this serial to a Slave Module like SIM800/SIM868 or GPS L86, or any other module that requires UART communication. Use SERIAL_SOFTWARE to enable software library for this serial.
SERIAL_AT_BAUDS [Int] 115200 Bauds speed
SERIAL_AT_RX [Int] 0 TX pin if software serial is enabled
SERIAL_AT_TX [Int] 0 RX pin if software serial is enabled
SERIAL_AT_WAIT [Bool] false Wait after SERIAL_DEBUG.begin(), for Duino Leonardo and Duino Zero
SERIAL_EXT [HardwareSerial] -1 Serial object for external UART controller
SERIAL_EXT_BAUDS [Int] 0 Bauds for
SERIAL_EXT_RX [Int] 0 TX pin if software serial is enabled
SERIAL_EXT_TX [Int] 0 RX pin if software serial is enabled
SERIAL_EXT_WAIT [Int] false Wait after SERIAL_DEBUG.begin(), for Duino Leonardo and Duino Zero

Net Communication

Property Default value Desc
USE_NET [Bool] true Enable communication module. Set to false to use your device only as data logger without remote communication capabilities.
KEEP_TCP_OPEN [Bool] false Keep TCP open for fast transmissions. True if your TICK1 (transmission time interval) is less than 30 or 10 seconds, false otherwise.
BATCH_TRANSMIT [Int] 5 Transmit multiple messages at once. Each created message will be saved in a buffer (module storage), when the number of messages is reached the transmission of all will begin. This option will help you saving battery and data connection costs. The max number of messages is relative to the selected storage module.
REMOTE_SERVER1 [String] "192.168.1.37" Main remote server ip/domain. You should receive this information if you are using M2M System Source service
REMOTE_PORT1 [Int] 3000 Main remote server port.
REMOTE_SERVER2 [String] "" Backup remote server ip/domain
REMOTE_PORT2 [Int] 3000 Backup remote server port
NET_MODEM [Int] MODEM_ESP32 Select communication module. Available options MODEM_ESP32 or MODEM_SIM800 (SIM800 and SIM868)
NET_SERIAL [Int] -1 Assign a serial object, SERIAL_AT or SERIAL_EXT (previously defined). -1 to not use serial for this port (not recommended)
WIFI_USER [String] "" Wifi ssid if assign NET_MODEM = MODEM_ESP32. Keep empty to use the AP mode
WIFI_PASS [String] "" Wifi pass if assign NET_MODEM = MODEM_ESP32. Keep empty to use the AP mode
WIFI_AP_SSID [String] "rhomb.iot" Wifi hot spot user for AP modem if assign NET_MODEM = MODEM_ESP32. The device can generate a Wifi network (hotspot). You can connect to this wifi from your phone using this SSID as network name.
WIFI_AP_PASS [String] "12345678" Wifi hot spot pass for AP modem if using NET_MODEM = MODEM_ESP32
SIM_APN [String] "" SIM APN server when using SIM800/SIM868 for GPRS Data
SIM_USER [String] "rhomb.iot" SIM APN user when using SIM800/SIM868 for GPRS Data
SIM_PASS [String] "12345678" SIM APN pass when using SIM800/SIM868 for GPRS Data

Bluetooth

Property Default value Desc
USE_BL [Bool] false Enable Bluetooth module. This is under development and not ready for production
BL_MODEM [Int] false Bluetooth module name, available options: MODEM_ESP32BLC, MODEM_ESP32BLE and MODEM_SIM868BL

GPS Communication

Property Default value Desc
USE_GPS [Bool] false Enable GPS module
GPS_MODEM [Int] -1 Select GPS module, GPS_L86 or GPS_868
GPS_SERIAL [Int] -1 Assign a serial object, SERIAL_AT or SERIAL_EXT (previously defined)

GPIO Interruptions

Property Default value Desc
INTERRUPT_PIN [Int] NMI Main interrupt pin. May be used by other modules, like ESP32 to reset AP mode

Sensors

Property Default value Desc
USE_SENSORS [Bool] false Enable reading data sensors
USE_SENS_TEMP [Int] -1 Enable temperature sensor. Available options: SENSOR_DHT11, SENSOR_BME280 or -1 to disable
USE_SENS_HUMI [Int] -1 Enable humidity. Available options: SENSOR_DHT11, SENSOR_BME280 or -1 to disable
USE_SENS_PRESS [Int] -1 Enable atmospheric pressure. Available options: SENSOR_BME280 or -1 to disable

Time

Property Default value Desc
USE_TIME [Bool] true Send date and time of message creation to the server
TICK_TIMER1 [Int] 10 Main time interval for message creation
TICK_TIMER2 [Int] 0 Secondary time interval

Data Logger Module

Property Default value Desc
USE_LOG [Int] -1 Data logger module to backup failed message transmissions. Currently only available with ESP32 using SPIFFS. Available options: LOG_ESP_SPIFF for ESP32 or -1 for others.

Storage Module

Property Default value Desc
USE_STORAGE [Int] -1 Memory method for persistent configuration. Available options are STORAGE_EEPROM_ARDUINO for AVR (Uno, Mega Leonardo) and ESP; STORAGE_EEPROM_ZERO For Duino Zero (SAMD21)

Battery Management

Property Default value Desc
USE_BATT [Int] -1 Enable reading battery status. Available options: BATT_TLA2024 when using a Halley or Hydra PCB; BATT_DEIMOS when using a Deimos PCB with Power Shield; BATT_SIMCOM A reading of battery using the Slave Module SIM868. The most complete option is BATT_TLA2024, with support for reading VBAT, VSYS/VUSB and VIN.
USE_VBAT [Int] true Read VBAT (lithium battery) and add to the message
USE_VSYS [Int] true read VSYS (usb connector) and add to the message
USE_VIN [Int] true read VIN (pin VIN) and add to the message
REQUIRED_VBAT [Int] 0 When VBAT reaches this value the system will enter in sleep mode. 0 To disable sleep mode (not recommended).
REQUIRED_VSYS [Int] 0 When VSYS/VSUB reaches this value the system will enter in sleep mode. 0 To disable sleep mode.
REQUIRED_VIN [Int] 0 When VIN reaches this value the system will enter in sleep mode. 0 To disable sleep mode (not recommended).

Buffer sizes

Property Default value Desc
BUFFER_SIZE 120 Max size for Global buffer. Modules can use it as a temporary space to save any data.
BUFFER_SIZE_MSG 120 Max size for messages
BUFFER_SIZE_APN 15 Max size for APN server
BUFFER_SIZE_APN_USER 1 Max size for APN user
BUFFER_SIZE_APN_PASS 1 Max size for APN pass
BUFFER_SIZE_REMOTE_SERVER 15 Max size for remote server string
BUFFER_SIZE_DEVICE_NAME 15 Max size for device name
BUFFER_SIZE_DEVICE_ID 15 Max size for device ID
BUFFER_SIZE_WIFI_NAME 15 Max size for wifi APN SSID/Pass

Comments