Dokumentation (english)

Basic Sensor Plots with Arduino

Learn how to use Arduino/ESP32 with the Aicuflow library to create plots on a connected SPI TFT Display.

This tutorial focuses on the ESP-32 T-Display S3 with Arduino IDE, because it can be connected to the Internet easily and has a large display - great for debugging purposes.

Development Setup

  1. Set up your IDE and Aicuflow Microcontroller Library (see library details)
  2. Install and set up the TFT_eSPI library for your board by changing User_Setup_Select.h in the libraries folder.
  3. Connect your Microcontroller to your computer / laptop and flash the device with the code below.

Example code

Copy the following definitions and functions into your Arduino IDE and upload to device:

/**
 *  Aicuflow AI Flow Builder + Arduino ESP32 Quickstart
 *  Created: 20260122, by Finn Glas @ AICU GmbH
 *  Simple sensor graphing example.
 *  Uses ESPI v2.5.43 Bodmer, which needs customisation.
 *  Check https://aicuflow.com/docs/library/arduino for more!
 */

#include <TFT_eSPI.h>
#include "SensorMeasurement.h"

bool isTDisplayS3 = true;
int leftButton = 0;
int rightButton = isTDisplayS3 ? 14 : 35;

TFT_eSPI tft = TFT_eSPI();
SensorMeasurement sensors("dev");
void setup() {
  tft.init();
  tft.fillScreen(TFT_BLACK);
  tft.setRotation(1);
  tft.setCursor(10, 10);
  tft.println("Aicuflow Sensor Plot (left & right button)");

  pinMode(leftButton, INPUT_PULLUP);
  sensors.registerSensor("left_button", "Button L", [&]() { return digitalRead(leftButton) == 0 ? 1.0 : 0.0; }, 0, 1, TFT_PURPLE, LOG_SEND, SHOW_GRAPH);

  pinMode(rightButton, INPUT);
  sensors.registerSensor("right_button", "Button R", [&]() { return digitalRead(rightButton) == 0 ? 1.0 : 0.0; }, 0, 1, TFT_BLUE, LOG_SEND, SHOW_GRAPH);

  sensors.setGraphSpacing(tft.height()/2-2*tft.height()/10, tft.height()/10);
  sensors.initGraphs(&tft, tft.width(), tft.height());
}

void loop() {
  delay(100);
  sensors.measure();
  sensors.updateGraphs();
}

You can add other sensors (like the internal voltage detection) and change the Sketch parameters. Go ahead!


Command Palette

Search for a command to run...

Schnellzugriffe
STRG + KSuche
STRG + DNachtmodus / Tagmodus
STRG + LSprache ändern

Software-Details
Kompiliert vor 1 Tag
Release: v4.0.0-production
Buildnummer: master@bcd249e
Historie: 23 Items