The Brick Logger can collect sensor data from Bricks and Bricklets and write it to a CSV file for later analysis. Which data from which Bricklet with which interval and with which options should be collected can be configured.
The Brick Logger is part of Brick Viewer since version 2.3.0 and can be opened with the "Data Logger" button. From here it can be configured and executed. There is also a standalone version that can be executed from a terminal.
All logged sensor data and debug messages are timestamped. The time format can be configured. The Brick Logger offers different presets:
If you are unsure what to choose here then use either DD.MM.YYYY HH:MM:SS or MM/DD/YYYY HH:MM:SS.
By default the sensor data and debug messages are only shown on the "Data" and "Debug" tabs. Those tabs only show the latest 1000 entries. Additionally, the data and messages will also be written to files if the corresponding check boxes are activated.
The "Devices" tab allows to configure which sensor data should be collected and how. First, the UID of the Brick or Bricklet has to be configured. The "Add Device" dialog will suggest connected devices including their UID.
Each supported device provides at least one loggable sensor value listed in the "Values" section. By default the interval for each sensor value is set to 0, which means that the value will not be logged. If the interval is set to X seconds or milliseconds (with X larger than 0) then the corresponding sensor value is logged every X seconds or milliseconds. If you configure an interval in milliseconds then also make sure to choose a time format with millisecond resolution on the "Setup" tab.
If the device has options then those are listed in the "Options" section. The Brick Logger automatically takes care of applying the selected options.
Once the configuration is finished the logging process can be started with the "Start Logging" button. The logging process continues until it is stopped with the "Stop Logging" button or by exiting Brick Viewer.
The "Load Config" and "Save Config" buttons can be used to load and save the current configuration.
The Brick Logger can also be used outside of Brick Viewer. It is available
as single Python script.
To use it you need to install the Python API bindings and create and save a configuration in Brick Viewer.
Then you can run it like this (
config.json is your manually saved
python brick-logger.py config.json
After the program got imported the configuration has to be uploaded as
config.json replacing the existing dummy file. Next, the Brick Logger has
to be exited using the "Exit" button in Brick Viewer. The RED Brick will
automatically restart it with the new configuration.