Gemini : How to set MQTT communication
Procedure to quickly establish a MQTT communication between Gemini and the MQTT broker, and then subscribe to a MQTT topic to receive messages that are posted by Gemini to the broker.
The MQTT Broker used here is the open-source message broker Eclipse Mosquitto. It will be installed on a laptop.
Instructions
Installing Mosquitto on your machine
On MacOS
brew install mosquitto
Check the mosquitto service is started
brew services list
On Linux
sudo apt install mosquitto mosquitto-clients
Check the mosquitto service is started
sudo systemctl start mosquitto
enable the service to be ran at startup.
sudo systemctl enable mosquitto
Configure Mosquitto to allow :
connections without credentials
Listen to port 1883 on every ethernet interfaces available:
sudo nano /etc/mosquitto/mosquitto.conf (for mac : /opt/homebrew/etc/mosquitto/mosquitto.conf./)
Add/uncomment the following lines
allow_anonymous true
listener 1883 0.0.0.0
then restart the mosquitto service
sudo systemctl restart mosquitto (Linux)
brew services start mosquitto (macos)
Now the broker is set up to allow any connections without credentials and to listen to port 1883 on any ethernet interfaces available.
Specify the interface IP instead of 0.0.0.0, if you want mosquitto to listen a specific interface
Configuring Gemini to post data to the MQTT broker
In Gemini → Settings Tab → Lidar Hub, under mqtt_publishers section :
Source : Select only one source at a time. eg: source: object_list, if more source is required duplicate the MQTT publisher and select different source.
Host : IP on the machine where the MQTT broker is installed
Example of my own settings :
Check with Wireshark than Gemini sends data over the network to the broker IP
Subscribe to a broker topic to get data posted by Gemini with the GUI MQTT Explorer.
Navigate to MQTT Explorer and download MQTT Explorer
Create a new connection using your broker IP
You should see the incoming messages refreshed once per second.