IoT
Last updated
Last updated
I decided to build my first IoT project to automate my small garden with Peperoncini and Tomatos plants.
For development purpose we may want to install Node Red under Docker on our local machine.
To run the latest
container (we use slim
tag for alpine linux since we don't need native dependencies):
Hit Ctrl-p
Ctrl-q
to detach from the container. This leaves it running in the background.
To reattach to the container:
Now we can open the browser and navigate to .
Click on the top right menu icon and select Manage Palette, click the Install tab, then search node-red-dashboard and install it.
Mosquitto is a very popular MQTT Broker.
We can now create 3 volumes to:
Override the default mosquitto.conf.
To give a persistent data folder.
To give a persistent log folder.
Create a file for configure persistence and logs:
Run the container:
In MQTT.fx, press the settings icon to setup a new connection. We’ll use the server address details above for this. Once we’ve setup our new connection, select it from the list and press the blue connect button.
Once you’ve connected to your MQTT server, we should first “subscribe” to a topic. Let’s move to the subscribe tab, and enter a topic to subscribe to. For now, let’s choose the topic home/garden/fountain which is the default for MQTT fx.
Now that we’ve subscribed to our topic, let’s move back to the Publish tab, and now we’ll send a message on the home/garden/fountain topic. In the message body, let’s type “hello world!” and then press the blue Publish button.
If we switch back to the Subscribe tab, we should now see our home/garden/fountain topic has a message with hello world!
We may need to access the infrastructure from outside of our private network.
To do that we need to setup a VPN connection.
To make the VPN start on boot edit the rc.local file:
sudo nano /etc/rc.local
At the end of the file add this content:
To check that the dashboard is correctly installed navigate to .
Read this to set up a Dashboard.
.
More info on the .
There’s a handy free program called which is available for Mac, Windows and Linux. Or if you’re using Chrome there’s a free Chrome Extension called .
OpenVPN was added following this [guide](
To use the openvpn official service (on boot as well) follow this [link](
To use the port forwarding and host the OpenVPN server directly on the raspberry follow this [link](