Serial Commands

Hi,
I’m working on a projekt(c#), where i read data from meshtastic :heavy_check_mark:, but i like to send data from serial too (SerialPort.write(“Send something to mesh”)), is it only possible with python through librarys? or is there something i’m missing? :pray:

-Morten

2 Likes

Catch …

2 Likes

Thanks for the answer!
Sorry for another possibly stupid question, i’m new in meshtastic… which file / where to change serialplugin_enabled? and is it possible to use serial plugin via usb connection?
Hope you can help me :pray:

Right now the easiest way of setting those configuration settings is to use the python api.

As you go through this, please share your experience and any tips you come up with. I’d happily update the docs.

I already tried this(meshtastic --set serialplugin_enabled 1)… but get:
“Can’t set serialplugin_enabled due to ‘Userpreferences’ object has no attribute ‘serialplugin_enabled’”,

my tbeam have the newest firmware (1.1.48) have tried 1.1.46 too
Is there anything i should do before i try to change the setting?

I am also having problems, as the instructions are not clear. For example, is the time to wait millis?

I’ve verified I am sending/receiving serial message between two esp32s. I also have two meshtastics nodes communicating via the sendtext function in python sdk.

I then use the cli to send…

meshtastic --port /dev/cu.SLAB_USBtoUART --set serialplugin_enabled 1 --set serialplugin_rxd 35 --set serialplugin_timeout 1000 --set serialplugin_echo 1

(i got these settings from the defaults in the code)

and get a confirmation.
the esp32 is sending a 5 bytes messages every 10 seconds. it appears the meshtastic node is echoing back. however, i never see the message on the network.

I’ll keep messing with it as I feel it’ s a very essential feature for lots of DIY folks who don’t want to muck around in the lower level firmware code. Would appreciate assistance, though. Thanks.

Few things stand out.

  1. You’re on a Mac, I used to have problems with the python api on the Mac, but it might be better now.
  2. You don’t need to set serialplugin_timeout unless you have a special need.
  3. If you set your rx pin, then you also should set your tx pin.
  4. serialplugin_echo Turns on a local echo. It just confirms what you entered into the node is then sent out. It doesn’t confirm it was received by another node. Generally you don’t need to set this. It’s mostly useful for debugging.
  5. When you say you don’t see the message, how are you looking for the message? We transmit the serial data over a special port so you can have serial data on the same network as the regular text messages and it won’t clutter the displays. We also wouldn’t want to have text messages get fed into your arduino. If you would prefer that text and serial data go over the same channel, open a feature request and give me the ID. I’m working on another plug-in right now, but I know how to get it sent over the messages port. If you need a workaround sooner, reply here and I can walk you through a workaround.
  6. Depending on your radio configuration, a message ever 10 seconds may be too aggressive. Once every 60 on long slow is a good starting point.

I think you’re the 3rd person I know who has used the plug-in. After you get it working, I’ll update the docs with better usage examples based on your experience.

1 Like

That suggests your python api may be too old. I don’t remember the update command off the top of my head, but try getting a newer version.

1 Like

Pip3 install --upgrade meshtastic

1 Like

Hi mc-hamster,

Instead of opening up another thread pertaining to the same topic, I’ll just message here.

So I am also attempting to use the plugin and I do get the ttgo to confirm the serialplugin is enabled (get a success confirmation on the terminal). However I am sort of confused as to how it exactly operates. I have a arduino device (adafruit feather) and I am able to read messages from the tx pin of the ttgo tbeam v1.0 (this is before enabling the plugin) (baud rate of 921600) and perform actions based on the text messages that I recieve. However, when I was looking at your plugin, it mentions using another baud rate of 38400. Does that baud rate affect both the tx and rx pins of the ttgo or just the rx pin of the ttgo? the reason why I ask is because I only have two serial interfaces on the arduino (usb and rx,tx pins). So, i find using two different baud rates for the purpose sort of bothersome. Is there a way where I can set both pins to operate at the same baud rate?

Also when the ttgo recieves a serial message on the Rx pin, does that message get relayed as a text message to the whole channel?

Sorry, if I am asking too many questions but I am just attempting to better understand this useful plugin.

Thanks.

Anywhere works!

That’s just the baud rate of the rx and tx pins used by the serial plugin. Both pins will work at 38400. 921600 is the rate used for the debug / usb api port for the device. No relation to the serial plugin.

You got it. Anything received to the RX pin of the serial plugin will be relayed back out for everyone on the network, but not as a “text message”. It’s sent on a special port for just the serial plugin. This is to allow coexistence of the serial plugin with other uses.

Ask away!

Thanks for getting back to me!

I really appreciate it.

You mention this “special port”. Is there a way to access this port and read/look from it? Would the message that’s being forwarded from the Rx pin to everyone appear at the com port on the serial monitor if the TTGO is connected to a computer?

Thanks again.

The message isn’t printed onto the serial monitor, but that wouldn’t be difficult to add.

Could I ask you to put in a feature request and give me a link to it? I’ll add it in the next few days.

I have not checked and it may not be in there, but take a look at the debug menu on the android app. It might be in there.

Here is the link to the feature request:

I will test out the item you mentioned to see if the serial message appears on the debug menu and report back.

My PyGUI opens a serial connection to radios and will display sent and recieved messages, a lot comes down to how COM ports are handled on your system

Hey mc-hamster,

I was messing with the serialplugin earlier and I have a question.

Does the plugin affect the outputs from the USB debug thats seen on a serial monitor? When I recently enabled it using the cmd on windows and set the tx, rx pins to the ones suggested on the documentation; the USB debug console ( I tried it twice) no longer displays “msg = …” when an incoming txt message appears. Furthermore, there was an instance where the power info data was not coming through (usually displays every 20 secs on the usb debug). However, I was able to fix them by just restarting the device.

Also, I will place the link of the thread to the github features. I got stuck up with other tasks and forgot.

If the esp32 is in a sleep mode, the rx and tx of the esp32 won’t function. You’ll need to either keep the esp32 fully powered up or work around this.