All Projects → fabianoriccardi → esp-logger

fabianoriccardi / esp-logger

Licence: GPL-2.0 License
An Arduino library providing a minimal interface to log data on flash memory and SD cards with ESP8266 and ESP32

Programming Languages

C++
36643 projects - #6 most used programming language

Projects that are alternatives of or similar to esp-logger

Dsckeybusinterface
An Arduino/esp8266/esp32 library to directly interface with DSC security systems.
Stars: ✭ 202 (+405%)
Mutual labels:  esp8266, esp32, arduino-library
PCF8575 library
Library to use i2c digital expander with arduino, esp8266 and esp32. Can read write digital value with only 2 wire (perfect for ESP-01).
Stars: ✭ 28 (-30%)
Mutual labels:  esp8266, esp32, arduino-library
Arduinowebsockets
A library for writing modern websockets applications with Arduino (ESP8266 and ESP32)
Stars: ✭ 213 (+432.5%)
Mutual labels:  esp8266, esp32, arduino-library
Easybutton
Arduino library for debouncing momentary contact switches, detect press, release, long press and sequences with event definitions and callbacks.
Stars: ✭ 187 (+367.5%)
Mutual labels:  esp8266, esp32, arduino-library
Somfy Remote Lib
Emulate a Somfy remote using a 433.42 MHz transmitter.
Stars: ✭ 43 (+7.5%)
Mutual labels:  esp8266, esp32, arduino-library
Esp Webota
Simple web based Over-the-Air (OTA) updates for ESP based projects
Stars: ✭ 189 (+372.5%)
Mutual labels:  esp8266, esp32, arduino-library
docker-esp-sdk
Executable docker image to easily compile and flash for the ESP32 and ESP8266
Stars: ✭ 30 (-25%)
Mutual labels:  esp8266, esp32, esp
Pzem004t
Arduino communication library for Peacefair PZEM-004T Energy monitor
Stars: ✭ 165 (+312.5%)
Mutual labels:  esp8266, esp32, arduino-library
FirebaseJson
🗃 JSON parser and builder for ESP8266, ESP32, Teensy3.x and Teensy4.x, SAM, SAMD and STM32 (128 k flash or more)
Stars: ✭ 29 (-27.5%)
Mutual labels:  esp8266, esp32, arduino-library
TP Arduino DigitalRain Anim
A library that represents Digital Rain Animation on color displays that support TFT_eSPI
Stars: ✭ 80 (+100%)
Mutual labels:  esp8266, esp32, arduino-library
Arduino Applemidi Library
Send and receive MIDI messages over Ethernet (rtpMIDI or AppleMIDI)
Stars: ✭ 177 (+342.5%)
Mutual labels:  esp8266, esp32, arduino-library
ESP-Mail-Client
⚡️Arduino Mail Client Library to send, read and get incoming mail notification for ESP32, ESP8266 and SAMD21 devices. The library also supported other Arduino devices using Clients interfaces e.g. WiFiClient, EthernetClient, and GSMClient.
Stars: ✭ 78 (+95%)
Mutual labels:  esp8266, esp32, arduino-library
Influxdb Client For Arduino
Simple library for sending measurements to an InfluxDB with a single network request. Supports ESP8266 and ESP32.
Stars: ✭ 176 (+340%)
Mutual labels:  esp8266, esp32, arduino-library
home
Monorepo for all home automation related development, including integrated firmware, PCBs, configuration, and bridges
Stars: ✭ 104 (+160%)
Mutual labels:  esp8266, esp32, esp
Espmqttclient
Wifi and MQTT handling for ESP8266 and ESP32
Stars: ✭ 169 (+322.5%)
Mutual labels:  esp8266, esp32, arduino-library
Pixie Chroma
Arduino library and documentation for Pixie Chroma displays!
Stars: ✭ 33 (-17.5%)
Mutual labels:  esp8266, esp32, arduino-library
Irremoteesp8266
Infrared remote library for ESP8266/ESP32: send and receive infrared signals with multiple protocols. Based on: https://github.com/shirriff/Arduino-IRremote/
Stars: ✭ 1,964 (+4810%)
Mutual labels:  esp8266, esp32, arduino-library
Split Single Phase Energy Meter
Split Single-phase Energy Meter
Stars: ✭ 158 (+295%)
Mutual labels:  esp8266, esp32, arduino-library
telnetspy
Telnet Server For ESP8266: Cloning the serial port via Telnet. "Debugging over the air"
Stars: ✭ 41 (+2.5%)
Mutual labels:  esp8266, esp32, arduino-library
OpenWeather
Arduino library to fetch weather forecasts from OpenWeatherMap
Stars: ✭ 88 (+120%)
Mutual labels:  esp8266, esp32, arduino-library

ESP Logger for Arduino IDE

arduino-library-badge Compile Library Examples

ESP Logger is an Arduino library offering a simple but complete interface to log events on ESP32 and ESP8266. Given the connection-oriented applications using these MCUs, ESP Logger provides a simple way to buffer data and efficiently send them through the most appropriate communication protocol.

Motivations

Nowadays, tons of projects are related to the IoT world: this implies network connection and data collection. ESP8266 and ESP32 were born with native WiFi paired with effective libraries to communicate. These libraries are very mature both in NONOS framework as well as in Arduino environment. Unfortunately, I noticed that often there is the need to rewrite everything about the data collection. For example, the existing libraries support perfectly raw files, but for every project, you should implement every basic control such as check if the file is open, decide the open mode, check lines terminator, check if the file is ended, check if there is enough space and so on. In my personal opinion, managing all these details every time is tedious and sloppy: avoiding them would be a plus feature in many projects. Raising the abstraction level is an unquestionable benefit for Makers interested in prototyping advanced connected objects. Moreover, abstractions always increase code sharing and reuse, without forgetting that it is a key point to promote communication among people, fundamental in Arduino-like communities. Before ending up with my library, I searched on the Internet to discover a library answering the requirements above. I didn't find anything matching all of them because, usually, data collection projects implement their custom solution, and often, searching for "log" term, you will found a lot of results regarding software development and debugging, not concrete data collection.

For all these reasons, I have developed ESP Logger library, which is built on top of flash memory and files, leaving you the decision on when logging, when flushing data, and how to flush data.

Features

  1. Log on internal flash and or on SD card*
  2. Methods to monitor and limit log size
  3. Support for multiple log files to store different information
  4. Callback to flush your data over the network
  5. Full control on when and how to flush your data
  6. Agnostic to the data format, the atomic measurement unit is Record
  • On ESP8266, you can decide if using SPIFFS or the newer LittleFS file system for flash memory.

Installation

The latest version of ESP Logger is available on Arduino Library Manager and on PlatformIO registry.

Usage

There are 2 main functions to be aware of: append and flush.

Append

bool append(const char* record)

it creates and stores a Record. You cannot log data containing non-printable characters, nor new line or carriage return. Return true if the data is saved, false otherwise.

Flush

bool flush()

it calls your callback function which has the following prototype:

bool flusher(char* chunk, int n);

where chunk is a buffer that contains one or more records separated by '\0' char; n tells how many bytes is long the chunk, including '\0'. This function must return true is the buffer flush has succeeded, false otherwise (e.g. the server wasn't reachable). If true, the library deletes the flushed data and, if other data are available, it calls flusher() again, otherwise it stops. If false, the library stops the flushing process and preserves the unflushed data for the next flush().

This kind of packetization can be useful in various scenarios, especially when the log is very large and you cannot send everything in one shot. The maximum size of a chunk can be set at run-time through setSizeLimitPerChunk().

Please note that the flush() method guarantees that:

* The data are sent in the order they were recorded 
* During a single flush(), a record is sent at most once
* At the first failure, the flush() method ends

It returns true if flush succeeds (hence the log file is emptied), false otherwise.

Other APIs and examples

To complete the library's overview, you may look at the examples folder, in which you can find some working examples to understand how easy it is to master ESP Logger. Look at commented header files (*.h) for the full library specifications.

Limitations

ESP Logger is designed to log human-readable data, this means that data should be composed only by readable characters (excluding also carriage return and newline).

Data corruption is not managed, hence there is no CRC or other integrity system to check that your log file is not altered. It assumes that the flash memory is reliable and no other code will access the log file.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].