Sparklines For Your ESP32 Projects

On a typical microcontroller project we may only have access to a relatively tiny screen. Information display can be a challenge, but it’s one that may be made easier by [0xPIT]’s ESParklines library for Espressif processors using the Arduino framework.

A sparkline is a simple line graph without annotations (like axes or units) intended to fit within the flow of text. They’re largely associated today with the statistician Edward Tufte, and if you’ve not encountered them or Tufte before then we suggest you’ll enjoy educating yourself.

It’s a simple enough library and it comes with example code. Usefully it maintains a data buffer all of its own allowing simple updating, and as well as the examples there is a YouTube video we’ve put below the fold showing graphs evolving as more information is added to them. We’re curious about one thing though, it’s billed as an ESP library, for either the ESP8266 or the ESP32, but we can’t find any ESP-specific code in there and neither could our friendly ESP-guru. Have we missed something? The comments are below if you can shed any light.

9 thoughts on “Sparklines For Your ESP32 Projects

  1. There’s no mystery. The source code of the library expects you to give it a “drawline” method which is specific to your display.

    The example “SparklineExample_OLED_U8G2.cpp” shows how.

    Worst case, you have to implement a “drawline” function for your display. The example uses a class specific to the used display, which provides a “drawline” method.

    The ESParklines only provides the little bit you need to handle the data and draw the lines. It does NOT talk to any specific hardware.

    1. Was pretty much going to say something similar. The guy probably only mentions esp, cause that’s all hes tested on. Either A) not having other platforms to test it on, or B) not caring enough to test it. I don’t ever bother testing code i’ve written for my esp based projects against arduino. I have the hardware, but a rarely use them anymore these days. The esp is a far superior micro controller in almost every way, except if you have have limited power budget. Though the ESP can do great for low power projects where you only need it to wake up occasionally to process something then go back to sleep. An example I have an esp32 attached to an e-ink dispay that displays the weather. It wakes up every 15minutes, connects to wifi, grabs the weather data from the internet, updates the eink display then goes back to sleep, this whole process only takes maybe 5seconds. It has been running off the same 1000mah lipo cell since I built it a month ago and has only drained the cell to 80% charge remaining.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.