Getting started with MOSQUITTO

After my first experiments with 2elemtry, I decided to give MOSQUITTO a try. Mosquitto is a small MQTT message broker, which provides basically the same functionality like 2lemetry.

Here the steps, I got Mosquitto up und running on my Windows 8 machine:

  • Install Mosquitto from the website. To avoid any security issues I installed it in the directory c:\mosquitto
  • Edit the existing configuration file mosquitto.conf. Uncomment the following parameters and change them

port 1883
password_file c:/mosquitto/pwfile
allow_anonymous false

  • Open a command prompt (cmd.exe) and navigate to c:\mosquitto
  • Create a new password file for the new user dl2sba using this command mosquitto_passwd.exe -c pwfile XXXXXX. Enter the password YYYYYY twice.
  • Be sure to enable the windows firewall to let external applications access mosquitto.exe.
  • Start mosquitto in the command window with mosquitto.exe -v -c mosquitto.conf
  • Now you should see some initial output:

C:\mosquitto>mosquitto.exe -v -c mosquitto.conf
1400926309: mosquitto version 1.2.3 (build date 22/12/2013 13:36:32.54) starting
1400926309: Config loaded from mosquitto.conf.
400926309: Opening ipv4 listen socket on port 1883.

  •  Open another command window an start the provided subscribe-client of mosquitto

C:\mosquitto>mosquitto_sub.exe -t -h -d -v -u XXXXXX -P YYYYYY
Client mosqsub/5916-DL2SBA-5 sending CONNECT
Client mosqsub/5916-DL2SBA-5 received CONNACK
Client mosqsub/5916-DL2SBA-5 sending SUBSCRIBE (Mid: 1, Topic:, QoS: 0)
Client mosqsub/5916-DL2SBA-5 received SUBACK
Subscribed (mid: 1): 0

  • In the first command windowyou should now see some additional message

1400926458: New connection from on port 1883.
1400926458: New client connected from as mosqsub/5916-DL2SBA-5 (c2, k60).
1400926458: Sending CONNACK to mosqsub/5916-DL2SBA-5 (0)
1400926458: Received SUBSCRIBE from mosqsub/5916-DL2SBA-5
1400926458: (QoS 0)
1400926458: mosqsub/5916-DL2SBA-5 0
1400926458: Sending SUBACK to mosqsub/5916-DL2SBA-5

 If this happens, your first steps are done. Now continue reading hwoto connect to your Mosquitto MQT server from your arduino.