Skip to main content

Serial, MQTT, and Ambient Light Modules

Serial Module

The Serial module lets external hardware send and receive Meshtastic messages over a UART serial connection — enabling integration with microcontrollers, GPS units, custom sensors, and computer software.

Modes of Operation

ModeDescriptionUse Case
DEFAULTRaw bytes in/out, app-layer messagesArduino/ESP32 integration
SIMPLENewline-delimited text in/outSimple text message bridging
PROTOProtobuf framingFull programmatic access
NMEAOutputs NMEA sentences from node GPSFeeding position to chartplotters
CALTOPOCalTopo-compatible position formatSAR map integration

Configuration

meshtastic --set serial.enabled true
meshtastic --set serial.mode SIMPLE
meshtastic --set serial.rxd 16
meshtastic --set serial.txd 17
meshtastic --set serial.baud BAUD_9600

RXD/TXD pin numbers are board-specific. In SIMPLE mode, text sent to the serial port (terminated with newline) is broadcast as a mesh message; received mesh messages are printed as text to the serial port.

MQTT Module

The MQTT module directly connects a Meshtastic node to an MQTT broker (internet required), enabling cloud integration without a separate gateway computer.

meshtastic --set mqtt.enabled true
meshtastic --set mqtt.address "mqtt.meshtastic.org"
meshtastic --set mqtt.username "meshdev"
meshtastic --set mqtt.password "large4cats"
meshtastic --set mqtt.root "msh"
meshtastic --set mqtt.uplink_enabled true
meshtastic --set mqtt.downlink_enabled false

Topic Structure

Meshtastic publishes to: msh/{region}/{channel_name}/{packet_type}

Example: msh/US/LongFast/text for text messages on the LongFast channel in the US region. Subscribe with wildcards: msh/US/# to receive all traffic from US nodes.

Ambient Light Sensor Module

When a supported ambient light sensor (BH1750, VEML7700, or TSL2591) is connected via I2C, this module adjusts the screen backlight brightness automatically based on ambient light conditions — reducing battery drain in dark environments and ensuring readability in sunlight.

meshtastic --set ambient_lighting.led_state true
meshtastic --set ambient_lighting.current 10

Also works with RGB LED hardware (NeoPixel/WS2812) to set a status color. current is the LED current in milliamps (for current-controlled LEDs). For the screen backlight use case, no explicit configuration is needed beyond enabling the module — brightness is automatically managed.