Skip to content

LED Feedback Component Documentation

Path: src/LEDFeedback.cpp

Revision History: Initial documentation

The LED Feedback component provides visual status indication through addressable LED strips (NeoPixel compatible). It offers multiple display modes including fading effects, level indicators, and tri-color blinking patterns that can be controlled via Modbus.

  • Digital output pin connected to WS2812B/SK6812 compatible LED strip
  • 5V power supply for the LED strip (separate from microcontroller logic)
  • Modbus TCP connection for remote control
  • Multiple display modes:
    • OFF: All LEDs turned off
    • FADE_R_B: Smooth color transition between red and blue
    • RANGE: Level indicator (0-100%) using lit LEDs
    • TRI_COLOR_BLINK: Three-section traffic light style blinking (red, yellow, green)
  • Modbus control interface for mode selection and parameters
  • Adjustable update rate for animations
  • Configurable pixel count to support different strip lengths

LEDFeedback

Component

Adafruit_NeoPixel

ModbusTCP

ArduinoLog

Bridge

Modbus write mode=1

Modbus write mode=2

Modbus write mode=3

Modbus write mode=0

Modbus write mode=2

Modbus write mode=3

Modbus write mode=0

Modbus write mode=1

Modbus write mode=3

Modbus write mode=0

Modbus write mode=1

Modbus write mode=2

OFF

FADE_R_B

Update level via Modbus

TRI_COLOR_BLINK

  • Consider power consumption optimization for battery-powered applications
  • Investigate using DMA-based LED control to reduce CPU usage
  • Add brightness control via Modbus to manage power usage
  • Validate Modbus values more strictly to prevent unexpected behavior
  • Consider adding access control for mode changes
  • Verify EMC compliance when LEDs change rapidly (potential for EMI)
  • Ensure ADA compliance for visual indicators in public/commercial settings
  • Use adequate power supply for LED strips (60mA per pixel at full brightness)
  • Consider adding a level-shifting circuit when connecting 3.3V microcontrollers to 5V LED strips
  • Add physical protection for LEDs in industrial environments
  • Implement custom modes for specific application requirements

This example shows how to initialize and mount an LED Feedback component in an application:

#ifdef PIN_LED_FEEDBACK_0
ledFeedback_0 = new LEDFeedback(
this, // owner
PIN_LED_FEEDBACK_0, // pin
LED_PIXEL_COUNT_0, // pixelCount
ID_LED_FEEDBACK_0, // id
LED_FEEDBACK_0_MB_ADDR // modbusAddress
);
if (ledFeedback_0)
{
components.push_back(ledFeedback_0);
Log.infoln(F("LEDFeedback_0 initialized. Pin:%d, Count:%d, ID:%d, MB:%d"),
PIN_LED_FEEDBACK_0, LED_PIXEL_COUNT_0,
ID_LED_FEEDBACK_0, LED_FEEDBACK_0_MB_ADDR);
}
else
{
Log.errorln(F("LEDFeedback_0 initialization failed."));
}
#endif