Sensors with Meshtastic - via serial?

It is obvious that a lot of hard work has gone into developing a robust app for ASCII messaging on a mesh. However, I see another large application this could benefit from this underlying robust mesh network: the monitoring of a distributed array of sensors.

But, I concede that it would not be a straightforward task to supply code for a wide range of sensor protocols within the Meshtastic core. So, I would propose the following compromise that would be simple to implement, and would offer an universal sensor interface: How about just including a routine that would read a string from a serial port - and transmit this string onto the mesh? If I know that there is an underlying robust mesh protocol, I am quite willing to add a small Arduino CPU to do the sensor interface and generate the appropriate sensor string - which could have a JSON format for example.

Any comments would be appreciated.

3 Likes

There is almost this (but young and not yet fully documented for end-users I think), @mc-hamster wrote a serial plugin that tunnels serial through the mesh.

Also @crossan007 has been making good progress on a more abstracted environmental sensor plugin. Perhaps you can join up with them?

1 Like

Hi @Mike !

Take a look at this:

3 Likes

Thanks @ms-hamster - will try that.

2 Likes

@Mike What if you were to use the Meshtastic Python library on a Raspberry Pi Zero? You could use the GPIO on the Pi to either read the sensor or use the serial on the Pi to interface to Arduino. You could then read/write message on the network from the Pi Zero.

I’m very new to Meshtastic and LoRa and have only briefly looked at the Python library, so I could be way off on all of this.

I’m thinking I can also use the Python library to report locations (and hopefully sensor data) to Home Assistant. It’s going to be a few months before I can dive into this unfortunately.

1 Like

@Mike @geeksville Another thought: Assuming you’re using an ESP32 or another Arduino with BLE, could you use the same BLE protocol as the mobile app to send/read messages on the network?

Yes, can use the Meshtastic library on the RPi Zero to read the sensors BUT that will mean that I need a Pi Zero at each sensor - which seems like overkill. I don’t mind putting a Arduino Nano and TTGO Lora at each sensor - if I can rely on a solid mesh network.

@Mike Have you read about the Plugin API? I just found and my reading through it myself. Looks like you can run Arduino code that can read GPIO on the Meshtastic device and read/write messages. Not sure if/how you could install other libraries though.

There is also a Device API (Bluetooth/serial/TCP protocol) if you wanted to go with another Arduino board.

1 Like

@danmandle I could send mobile messages onto the network using either the Android App or the newly announced iOS beta app. But my preference would be to use MQTT from my iOS to the Meshtastic Python library - although I have seen mention of integrating MQTT directly into Meshtastic.

1 Like

@danmandle I was going to look at using the serial API plugin to read from an Arduino Nano - but your message seems to indicate that there is a Plugin API to read GPIO directly into the TTGO ESP32 - ie no extra Arduino required. Either way, I need to figure how to enable the Plugin API’s - seems that I need to recompile using PlatformIO. Will try and give that some attention.

1 Like

@Mike Looks like it’s been covered in detail here: Temperature Sensing

1 Like

Thanks - lots of detail there - seems like I have to bite the bullet and run PlatformIO installed in VScode.

1 Like

@danmandle You may want to look at another thread which has provided some useful responses: https://meshtastic.discourse.group/t/plugins-installation/2684

2 Likes