I am completely new to the world of IoT and I want some recommendations. I want to build a home automation system that is accessible from anywhere in the world using internet. The ultimate goal is the ability to access my home devices from around the globe.

Over the internet, I have seen many tutorials, but most of them either deal with local networks or third party cloud networks (e.g. AWS or HiveMQ) which charge a fee.

Is there a way I can set-up a cloud mqtt broker on my laptop or raspberry pi that is accessible from anywhere in the world? Is there an existing piece of software (node-red?) that can help me with this?

  • 2
    it is your router that you have to configure
    – jsotola
    Commented Sep 4, 2019 at 6:04

3 Answers 3


Indeed you can! Regarding what you are most comfortable with you can use different technology as a broker.

For instance you can use : https://mosquitto.org/ Which is a well know opensource mqtt broker. You'd find plenty of tutorial/example to help you getting started.

If you're a node guy, I've tested https://github.com/mcollina/mosca which works very nicely however I've red somewhere that it didn't scale well though. But for dev purpose it's pretty good !

And as hardillb mentioned, you'll then need to do some port forwarding. But you will have trouble accessing the service from anywhere in the world because most likely your self hosted server will change its public address sometimes and that will leave all your client without service.

So the self hosted way is good enough for development but at some point you'll probably need to go a little deeper and use a VPS instead.

  • Thanks for your reply. In case I set up mosquitto on my laptop/raspberry pi, will I be able to access in anywhere in the world?
    – Kiran Nisa
    Commented Sep 4, 2019 at 16:02
  • Yes, you'll just need to know the IP adress of your computer and open up your router port. With most internet provider you'd find a guide on how to do the port opening thing on your getaway directly on there website.
    – YCN-
    Commented Sep 5, 2019 at 12:56

If you want to run your own publicly exposed broker then you will need a static IP address for your home broadband (because MQTT connections are persistent).

Assuming you have that, then you will need to enable port forwarding on your router to expose the broker (the default port is 1883) to the outside world. If you do this then you should probably make sure you have enabled some form of security as sites like Shodan regularly index MQTT brokers.


Refer the below links,these provides extra features on topic level security,authorisation,authentication etc

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.