Connected mode (commands)
To connect to the tag and download the datalogger, it is recommended to configure an Advertising Interval less than or equal to 3 seconds. If the advertising period is greater than this value, establishing the connected mode may take longer and may require several attempts.
Command list
| Command | Action | Minimum firmware version |
|---|---|---|
| LED_ON | Turn ON the LED (infinite blinking) | ≥ 1.0.0 |
| LED_OFF | Turn OFF the LED | ≥ 1.0.0 |
| LED_ON XX | Turn ON the LED for XX seconds | ≥ 2.0.0 |
| BUZZ_ON | Turn ON the buzzer (repeated beeps) | ≥ 1.0.0 |
| BUZZ_OFF | Turn OFF the buzzer | ≥ 1.0.0 |
| BUZZ_ON XX | Turn ON the buzzer for XX seconds | ≥ 2.0.0 |
| DIGI_ON | Set digital output to ON | ≥ 2.1.0 |
| DIGI_OFF | Set digital output to OFF | ≥ 2.1.0 |
| DIGI_ON XX | Set digital output ON for XX seconds | ≥ 2.1.0 |
| RAZ_COUNT | Reset counter | ≥ 2.0.0 |
| LOG_DL | Download datalogger (chronological order) | ≥ 2.0.0 |
| LOG_SO_DL | Download in reverse order | ≥ 4.0.0 |
| LOG_RST | Erase datalogger and timestamp | ≥ 2.0.0 |
| LOG_SP_DL XX YY | Download values between index XX and YY (chronological) | ≥ 4.0.0 |
| LOG_SP_INV_DL XX YY | Download values between index XX and YY (reverse) | ≥ 4.0.0 |
| LOG_SP_DL_DATE | Download between dates (chronological) | ≥ 4.1.0 |
| LOG_SP_INV_DL_DATE | Download between dates (reverse) | ≥ 4.1.0 |
| LOG_SET_CURR_DATE | Set current tag date | ≥ 4.1.0 |
| LOG_READ_CURR_DATE | Read current date | ≥ 4.1.0 |
| LOG_READ_START_DATE | Read start recording date | ≥ 4.1.0 |
| GET_BATT_VOLTAGE | Return battery voltage (mV) | ≥ 2.1.0 |
| GET_SENSOR_DATA | Return last sensor value | ≥ 2.2.0 |
Simple data logger (relative time)
ELA Innovation sensor tags can use the datalogger feature.
The datalogger records data while advertising, with each value associated with a timestamp indicating when it was measured.
Operation
For firmware versions < 4.0.0, the datalogger can be retrieved in connected mode using:
LOG_DL
Data format
Example for a temperature sensor with a 30-second interval:
Temperature LOG:
DATA_START
0d0h0m30s:2712
0d0h1m0s:2730
0d0h1m30s:2695
…
1d3h25m30s:1505
END_OF_DATA
0d0h0m30s→ 30 seconds after startup1d3h25m30s→ 1 day, 3h, 25 min, 30 sec after startup
General format:
xxd xxh xxm xxs : sensor value
Sensor values match those transmitted in advertising frames.
Data deletion
Command:
LOG_RST
Deletes all datalogger content.
Partial download (firmware ≥ 4.0.0)
Used to reduce the amount of transferred data.
Commands
LOG_SP_DL XX YY
→ chronological order (XX = oldest)
LOG_SP_INV_DL XX YY
→ reverse order (XX = newest)
Examples
LOG_DL
DATA_START
0d0h0m30s:2712
...
END_OF_DATA
LOG_SP_DL 03 12
DATA_START
0d0h1m30s:2695
...
END_OF_DATA
LOG_SP_INV_DL 03 12
DATA_START
1d3h25m30s:1505
...
END_OF_DATA
Absolute time datalogger
For firmware versions strictly below 4.1.0, the datalogger timestamp can be retrieved in absolute time using the format:
DD/MM/YYYY HH:MM:SS Tz:Tz
with the command:
LOG_SP_DL_DATE
Operating principle
Using absolute time requires setting a reference date in the beacon using:
LOG_SET_CURR_DATE
This command must be sent:
- after the start of logging (after
LOG_RSTor device reboot) - before executing
LOG_SP_DL_DATE
Partial download
As with the simple datalogger, it is possible to download only part of the data by specifying a date range:
LOG_SP_DL_DATE DD/MM/YYYY HH:MM dd/mm/yyyy hh:mm
Reverse download
It is also possible to retrieve data in reverse chronological order (newest first):
LOG_SP_INV_DL_DATE
A date range can also be specified.
Command examples
LOG_DL
Temperature LOG:
DATA_START
0d0h0m30s:2712
0d0h1m0s:2730
0d0h1m30s:2695
…
1d3h24m30s:1617
1d3h25m0s:1500
1d3h25m30s:1505
END_OF_DATA
LOG_SP_DL 03 12
Temperature LOG:
DATA_START
0d0h1m30s:2695
0d0h2m0s:2700
0d0h2m30s:2705
…
0d0h5m0s:2902
0d0h5m30s:2875
0d0h6m0s:2822
END_OF_DATA
LOG_SP_INV_DL 03 12
Temperature LOG:
DATA_START
1d3h25m30s:1505
1d3h25m0s:1500
1d3h24m30s:1617
…
1d3h20m30s:1200
1d3h20m00s:1102
1d3h19m30s:1015
END_OF_DATA
Data Logger EN12830
BLE connected mode configuration
Start recording
To begin storing temperature measurements in the tag memory, you must send the start date/time to the tag. This start date/time will be used as the reference for timestamping the data. After sending the command, the data logger will start monitoring and storing values for the period defined in the NFC configuration.
Command: DATALOGGER_START
You must then provide the BLE password so that the command is accepted by the tag. Finally, you must provide the date using the following format:
DD/MM/YYYY HH:mm:SS +hh:gg
Where:
- DD: start day of the recording, written with 2 digits (e.g. 01, 08, 15...)
- MM: start month of the recording, written with 2 digits (e.g. 01, 05, 11...)
- YYYY: start year of the recording, written with 4 digits (e.g. 2019...)
- HH: start hour of the recording in 24-hour format, written with 2 digits (e.g. 02, 16, 23...)
- mm: start minute of the recording, written with 2 digits (e.g. 01, 26, 54...)
- SS: start second of the recording, written with 2 digits (e.g. 05, 18, 56...)
- hh: UTC timezone hour used to start the recording, written with 2 digits (e.g. 00, 03...)
- gg: UTC timezone minutes used to start the recording, written with 2 digits (e.g. 00, 30...)
Command example:
DATALOGGER_START PASSWORD_1 05/06/2019 11:20:00 +01:00
Tag responses:
- If the password is valid:
DATALOGGER_START: Success - If the password is invalid:
DATALOGGER_START: ACCESS DENIED - If the date is invalid:
DATALOGGER_START: WRONG PARAMETERS
When this command is sent to the tag, all previously stored content in the data logger is deleted and the recording restarts from zero.
When this command is sent to the tag, the first sensor measurement will be performed after the logging period defined in the NFC configuration.
For example, if the Datalogger period is 30 seconds, the first data entry will be measured and stored 30 seconds after the DATALOGGER_START command is sent.
Stop recording
You can stop the recording on the tag using the DATALOGGER_STOP command. The BLE password must be provided for the command to be accepted by the tag. Data already recorded will not be erased by this command.
Command example:
DATALOGGER_STOP PASSWORD_1
Tag responses:
- If the password is valid and recording is running:
DATALOGGER_STOP: Success - If the password is valid but recording is not running:
DATALOGGER_STOP: LOG not started! - If the password is invalid:
DATALOGGER_STOP: ACCESS DENIED
The data stored in the data logger memory can be retrieved using the READ_DATA command until another recording session is started or the tag is rebooted.
Data retrieval and verification
Reading all data logger values
You can read the stored data at any time without stopping the recording.
Four commands in connected mode are available to retrieve data from the data logger:
- READ_DATA: downloads the complete data logger in chronological order (oldest to newest)
- READ_INV_DATA: downloads the complete data logger in reverse order (newest to oldest)
- READ_SP_DATA DD/MM/YYYY HH:MM dd/mm/yyyy hh:mm: downloads the complete data logger in chronological order between the specified dates
- READ_SP_INV_DATA DD/MM/YYYY HH:MM dd/mm/yyyy hh:mm: downloads the complete data logger in reverse chronological order between the specified dates
For each command, the password must be specified. If the command syntax is valid, the tag returns READ_DATA: Success. The tag then starts transmitting its data.
Command examples:
READ_DATA PASSWORD_1
READ_INV_DATA PASSWORD_1
READ_SP_DATA DD/MM/YYYY HH:MM dd/mm/yyyy hh:mm PASSWORD_1
READ_SP_INV_DATA DD/MM/YYYY HH:MM dd/mm/yyyy hh:mm PASSWORD_1
Tag responses:
- If the password is valid:
READ_DATA: Success - If the password is invalid:
READ_DATA: ACCESS DENIED - If the password is valid but recording has not started:
READ_DATA: LOG not started!
Once the command is received, the tag transmits all data stored in the data logger memory. The data is formatted as follows:
---DOWNLOAD_START---
Firmware version: 2.1.0\n
MacAddress: 01:02:03:04:05:FE\n
Name: TAG_LOCAL_NAME\n
Unit: Celsius degrees\n
Start date: 01/04/2019 11:26:33 +01:00\n
<DATA_START>\n
01/04/2019 11:26:33+01:00: 23.34\n
01/04/2019 11:26:43+01:00: 23.44\n
[…]
<DATA_END>\n
CRC16: 0x0D06\n
---DOWNLOAD_END---
New line characters (\n) are not visible but must be taken into account when calculating the CRC.
Field description:
- ---DOWNLOAD_START---: marker indicating the beginning of the transmission from the data logger
- Firmware version: firmware version of the data logger (tag)
- MacAddress: unique identifier of the tag
- Name: tag name as configured in the NFC memory
- Unit: unit used for the temperature values (°C in this example)
- Start date: start of recording as sent by the
DATALOGGER_STARTcommand - <DATA_START>: marker indicating the beginning of temperature data transmission
- 01/04/2019 11:26:33+01:00: 23.34: example of timestamped temperature data
- <DATA_END>: marker indicating the end of temperature data transmission
- CRC16: cyclic redundancy check calculated from the transmitted data
- ---DOWNLOAD_END---: marker indicating the end of the transmission from the data logger
Reading temperature data
In the previous example, temperature readings are formatted as follows:
01/04/2019 11:26:33+01:00: 23.34
- 01/04/2019 corresponds to the date the temperature was measured
- 11:26:33 corresponds to the time the temperature was measured
- +01:00 corresponds to the UTC timezone provided with the
DATALOGGER_STARTcommand - 23.34 corresponds to the temperature value expressed in the unit transmitted by the data logger (23.34°C in this example)
Data logger CRC verification
The data logger data is verified using a CRC16 (Cyclic Redundancy Check) calculation.
CRC parameters:
- Algorithm: CRC-16-CCITT
- Polynomial:
0x1021 - Initialization value:
0xFFFF
Example calculation
Input data (ASCII type):
0123456789ABCDEF
Result:
0x2C1F
The CRC calculation is performed on all data between the marker ---DOWNLOAD_START--- (not included) and the string CRC16: 0x (included).
Complete data logger example:
---DOWNLOAD_START---
Firmware version: 2.1.0\n
MacAddress: FA:FD:50:39:A1:2C\n
Name: BE_TEST_T3\n
Unit: Celsius degrees\n
Start date: 14/06/2019 12:00:00 +01:00\n
<DATA_START>\n
14/06/2019 12:00:10 +01:00: 26.62\n
14/06/2019 12:00:20 +01:00: 26.62\n
<DATA_END>\n
CRC16: 0xDF91\n
---DOWNLOAD_END---
The CRC value is calculated using all the data displayed above (from Firmware version to CRC16: 0x included). In this example, the value is therefore 0xDF91.
An online CRC calculator is available at:
http://www.tahapaksu.com/crc/
Use the result from the CRC-CCITT (0xFFFF) field.
- Using the
READ_DATAfunction does not erase the recorded and transmitted data - Recording is stopped during transmission (until the marker
---DOWNLOAD_END---) and automatically resumes once the transmission is finished
Reading the recording start date
The command used to read the start date sent to the tag is READ_START_DATE. The BLE password must be provided for the command to be accepted.
Command example:
READ_START_DATE PASSWORD_1
Tag responses:
- If the password is valid but recording has not started:
READ_START_DATE: LOG not started! - If the password is valid and recording is running:
READ_START_DATE: DD/MM/YYYY HH:MM:SS +UU:UU - If the password is invalid:
READ_START_DATE: ACCESS DENIED