What is that?
Well, Wifi communicates without wiring and Mqtt is the way things talk to each other.
It is a smart, flexible and cheap way of controlling almost everything on a model railway.
Most known in the popular home automation systems but it can of course be used anywhere.
It can be connected to internet, but it can also be used in a closed, local network.
A wireless router is needed to provide wifi and if there isn't any wifi where the railroad is,
or if it not a smart idea to interfere with the rest of the family's web activities,
a separate router doesn't cost much.
There is a lot of Youtube videos on how to use this on a model railroad and I just want to show
how I do to make things work the way we want to.
I don't have any model railroad myself but my brother is building a new layout with Lenz track
and Lenz DCC turnout motors, and I have been given the task to get everything running.
As we don't live in the same town, I am building the electric parts in my home and visit him
once a week for testing and mounting.
The room he is building his layout in is about 7 x 3,5 meters, with a track in to another room where there is a small yard and a workshop.
There will be four separate trackplans and we will not sit and drive, we will walk around with wireless remotecontrols.
There will not be any automated driving, everything is done manually but with wireless remote control.
This is the way we want to do it.
We use the existing wifi in the house, with a range extender in the room where the railroad is.
The base in Mqtt is something called a "broker", everything goes thru that broker.
The "broker" is a computer program and for that we need some kind of computer where this can be installed.
It is possible to use a standard PC, but that is not a good idea. It can be used for testing.
We use a Raspberry Pi 3+ with built in wifi. It cost about €40 (+ €20 for power adapter if you don't have one) and
that is the most expensive part in this system. A small SD-card is also needed.
There is many installation guides on how to install the operating system on the Raspberry, so I wont go in to that,
but it is quite easy to follow the instructions on Raspberrys website, Raspberry Pi .
Make sure to make the right wifi-connections.
Then we need an Mqtt-broker, that is the only program (apart from the operating system) that we need to install.
We use a program called Mosquitto, it's free and it is probably the most popular, but there is other choises.
After installing Mosquitto that part is done and we don't have to touch that anymore.
As I have a couple of 3D-printers I printed out a small case, there is many to choose from on Thingiverse.
Then there is just one important thing we have to do, the Raspberry must have a static/fixed adress (ip-number) in the router.
So we are logging in to the router and in the LAN-settings we choose DHCP and assign a static adress.
How this is done can vary in different routers but this must be done.
It is also a good idea to write this IP-adress down, because it will be needed later.
And it is ready to run.
To be continued…..