Skip to content

The library's functionality is to format and log sensor data coming from Arduino in a streamlined manner as CSV.

License

Notifications You must be signed in to change notification settings

Abhijeetbyte/StreamLog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StreamLog

The idea of streamlining your data logging process.


Releases GitHub Tag License GitHub top language arduino-library-badge

Library functionality is to format and log sensor data, coming from your microcontroller in a streamlined manner.

Need ? 🙄

The StreamLog library helps you log and format data in your Arduino or similar microcontroller sketches, letting you concentrate on your core project instead of dealing with data formatting hassles. With a single function call, you can effortlessly log multiple data variables along with their names. The library handles CSV formatting, adds timestamps, and even visualizes data directly on the Arduino serial console or any other terminal program.

By simplifying the data logging process, StreamLog saves you time and effort. You no longer need to write extra lines of code inside your microcontroller for logging—StreamLog does it all for you. The logged data is formatted into a comma-separated file (CSV), making it easy to use with any application for further analysis, visualization, or system integration.

Whether you're prototyping a new project or developing a complex application where you need to monitor data patterns over time, StreamLog enhances efficiency. It simplifies the data logging and formatting process within a single platform, eliminating the need for additional or third-party applications.

Features 🌟

  • No, need to write extra codes for data formatting and printing on the serial monitor.
  • Standard data output as a 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.

Download 👇


  • You can Download the latest release of this library as a zip and import it into your Arduino IDE.

    Or

  • Available on the Arduino IDE library manager, you can search for it directly there.



image



Working ⚙️

  • 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.

void setup() {

  // Initialize serial communication with a baud rate of 9600
  sensorLogger.begin(9600); 

  // Log the sensor data headings
  sensorLogger.head("Light Intensity"); // Variable name or column heading
}
void loop() {

  // Read the analog value from the LDR sensor
  int lightIntensity = analogRead(LDR_PIN);

  // Log the sensor data
  sensorLogger.data(300000, 1, lightIntensity); // Variables
}

Here,

  • StreamLog.head function is for sensor data heading/name of columns, this could be as many as you want.
  • In StreamLog.data
    • 300000: Time interval between data logs in milliseconds ( 5 minutes)
    • 1: Total number of variables ( sensor readings), this could be as many as you want.

Upload the sketch and turn on the serial monitor.



Output 🚀

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.

Timestamps (HH:MM:SS), Elapsedtime (S), Light Intensity
16.53.05.687,          300,                100
16.58.10.011,          600,                75
17.03.08.094,          900,                46
17.08.06.014,          1200,               17

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, ..... );



Post Processing 👷‍♂️

  • Now after completing the experiment, click on the Serial monitor window 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

image

  • 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

image



Reporting Issues & Contributions

Feel free to report issues and contribute to this repository

License

Copyright © 2024 Abhijeet kumar. All rights reserved.

Licensed under the MIT License.