Transmitting sensor data serially to meshtastic node to share data to mesh

I am trying to figure out a way to use meshtastic to send sensor data serially. After researching I found out it is better to use the microcontroller to read the sensor data then using the meshtastic arduino library, serially transmit the data to the meshtastic node which can then send data to the mesh.
The problem is I am not sure if I am taking the right approach. Can anyone explain if I am on the wrong track for measuring sensor data remotely?

And if my approach is alright, how do I use the meshtastic device to send data to mesh. Like what library do I need to use? Do I need to use some other application and not arduino? Since the telemtery options in meshtastic are limited, how do I go about sending the sensor data to the node?

Thank you very much in advance to anyone who can provide some idea on the project.

Well yes, probably the ‘easiest’ technically, is to use two devices/microcontrollers.

One running your ‘custom’ code, that takes data from the sensor, and outputs messages on serial. You wouldnt HAVE to use the Arduino library, although you could. You might make it work with simple serial/uart output.

This serial is connected to the other controller, which is just running the vanilla meshtastic firmware. It takes care of accepting the serial message, and transmitting it over the lora mesh (and/or submitting to MQTT broker)
… this second microcontroller, would just be flashed with the normal firmware build. Not a library. YOu would configure the “node” remotely via a app, or web browser. Flashing Firmware | Meshtastic

That been said the the meshtastic firmware, does have some support for reading direct from some sensors. Telemetry Module Configuration | Meshtastic So might be able to use one device - running meshtastic firmware, and just connect your sensor.

If want a different sensor, then could possibly build ‘custom’ firmware. ie extend the core Arduino code to read your sensor, and compile new firmware.

Depending on your microcontroller, might technically be able to have meshtastic firmware running on one core, and your code on another core (and cross connected with serial!). But that is going to be techncially more challanging to setup, might again end up compiling custom fireware build.