Library functionality is to format and log sensor data, coming from your microcontroller in a streamlined manner.
The StreamLog library simplifies the process of logging and formatting data from your Arduino sketch, allowing you to focus on your core logic without worrying about the intricacies of data formatting. With just one function call, you can log multiple data variables along with their corresponding names, and the library takes care of CSV formatting of your data, adding timestamps, and visualizing it directly on the Arduino serial console.
This streamlined approach eliminates the need for writing additional lines of code in your sketch for data logging purposes, saving your time and effort.
You can easily use the logged data with any additional application for further analysis, visualization, or integration with other systems as it formats the raw Arduino data into a comma-separated file (CSV). Whether you're prototyping a project or developing a complex application where you want to monitor changes in data patterns over an extended period of time, StreamLog simplifies the process and enhances the efficiency of data logging and formatting within one platform without using any additional or third-party application.
- No, need to write extra codes for data formatting and printing on the serial monitor.
- Standard data output as comma-separated file (CSV).
- Support custom time intervals for data output ( second, minutes, hours etc..)
- Use any software to see your data ( Arduino serial monitor, PuTTY etc. ) as long it supports serial communication.
- Available as plug-and-play, just import/include the library in your sketch.
- You can download the latest release of this library as zip : download and import it using the library manager.
- Available on Arduino IDE library manager
-
Import the StreamLog library in your Arduino sketch.
-
Call the functions of this library in your sketch, and put your data variables as arguments along with their names.
ex:
void setup (){
StreamLog.begin(9600); // intilize and define baud rate
}
void loop(){
StreamLog.head("LDR1, LDR2, LDR3, etc....");
StreamLog.data(5000, 3, LDR1intensity, LDR2intensity, LDR3ntensity, etc...);
}
Here,
StreamLog.head
function is for sensor data headings/names of columns, this could be as many as you want.- In
StreamLog.data
- 5000: Time interval between data logs in milliseconds (5 seconds)
- 3: Total number of variables ( sensor readings), including the delay and other values. This could be as many as you want.
Upload the sketch and turn on the serial monitor.
Output on the Arduino Serial monitor as CSV format, of an LDR connected as analog input.
You can also enable the timestamp feature of the Serial monitor, otherwise timestamp column will be zero.
Timestamp (HH:MM:SS.MMM), Light Intensity, Elapsed time ( S )
16.53.45.687, 100, 0
16.58.00.011, 75, 300
17.03.00.094, 46, 600
17.08.00.014, 17,900
This is data reading of sunset, the experiment was started just before sunset, and set to log data in an interval of every 5 minutes in StreamLog.data(300000, ..... );
- Now after completing the experiment, click on Serial monitor windows and copy everything.
- Open any text editor, here I am opening Notepad, and past it there, Click on "Save As.." or click Ctrl+Shift+S.
- Save it as .CSV
- Change "Text Documents (.txt)" to "All Files"
- You are done, the file was already in CSV format, just open it in MS Excel or anywhere else. Open it to see the changes in data over elapsed time or visualize the trend line
Feel free to report issues and contribute to this repository
Copyright © 2024 Abhijeet kumar. All rights reserved.
Licensed under the MIT License.