The target is to make a meshtastic sensor or geodata can be view or shared through internet on some where else.
HW:
I still use my unknow version of lilygo 32lora.
Device A: Client,work as device to sent lora data to MQTT
Device B: Tracker,with GPS, work as tracker
Device C: Client,with rotary encoder configed for canned message.
SW: all three are loaded on meshtastic 2.5.15
Lora/frequency is overide to avoid too much trafic.channel/PSK is also set to non-default.
upto here, all 3 devices can communicated through message no problem.
MQTT server:
as 2025, it seems meshtastic has set some "rules", and I saw a video about using MQTT explorer to "see" if data is on meshtastic's MQTT server. I did the same, it does connect, but I only saw some strange topic, not the msh/topic we set in SW.
So, I decided to work on other MQTT, I created an account on
HiveMQ create a cluster, it will give you a set of URL and the port is 8883, later I found out that without TLS enabled, it won;t work.
in the mqtt overview page, there is a TLS mqtt URL, which is the url with :8883(as port nr), this is the url to be filled in the meshtastic node(with out :8883 it was not working for me.)
Then created a authentication on access management page, pay attention to permission, there are options, I choose subscript and publish.
HiveMQ has a web client page, where you can test the setting we just created.
Same, I can't connect with mqtt explorer ether.
MQTT setting in meshtastic:
you can find a lot of demo on net, doing following configuration:
1. radio/channel/ enable uplink enable and downlink enable.
2. radio/lora enble OK to MQTT. this will be added in message, to indicate the recivers that this message can be sent to MQTT or not. at first I did not understand, I though this is the setting form my device A to send message received from mesh to MQTT. No, you have to set this for all the nodes(even not the one to sent to MQTT).
3. module/MQTT:
here enable MQTT,
put my hiveMQ URL( with :8883)
put username and password as created in HiveMQ.
I did not enable the encryption.
enable JSON(for easier reading)
enable TLS( I did not get message when TLS is not enabled)
set my root topic.
Set Client Proxy Enabled, this allow my meshtastic device to send data to MQTT through BLE using the internet connection of my phone.
(I also tried to enable the wifi of my node to connect to my wifi, I can also connect android app to to the device, but the MQTT message did not goes out to HiveMQ, no idea why)
I did not enable the map reporting option.
After setting above, when I use android app connect to device A, I can see message I sent through deviceA, apprear in HiveMQ, with protobuf and Json format. But data sent from other devices did not transmitted to MQTT.
Only after I set OK to MQTT in device B and C, I can see goe message from device B and canned messagefrom device C.
My feeling is that meshtastic is going too complicated, it added a lot of functions, and lot of setting, names and descriptions could be different in different setting app. sometimes can be very confusing.
As to setting methods, for esp32, when you connect to wifi, you will not able to connect to device through BLE. I did few configuration through wifi IP address, some times it freezed.
Serial and BLE seems to be the most stable way to connect devices for App.
Why my client device can't not send MQTT when not enabling client proxy and using only wifi connection? I'm not sure, maybe changing role of device could be different.
留言
張貼留言