I am a student from Automation Technology 3. semester at UCL. In this instructable i aim to move my previous project to industry 4.0.
The arduino has been replaced by a nodemcu - esp8266 in order to send data via. wifi.
Step 1: Communication
We wish for the nodemcu to be able to communicate to the PC.
In order to do this we use a broker between the nodemcu and node-red as a website which can display data to the user. The nodemcu has limited data storage so we use Wampserver to store data from node-red.
Firstly to communicate with our computer we need to connect to the local network. In order to do this i used this guide to achieve this:
Broker - Mosquitto:
If we want to process any data we have to make sure the data goes to the right place. For this purpose i used the mosquitto broker which can be found at this website.
To send the data to the right place it must be tagged with a "topic". These topics are either published or subscribed. Anything published in a certain topic will be send, by the broker, to any subscribed units connected to the broker.
It is a flowbased program that allows the user to create website or other interfaces.
This is used to display and process data from the nodemcu
It is a database which takes requests from node-red to either store or send data.
Step 2: Missing Link
I was unable to connect the nodemcu to the broker but managed to connect it to my wifi.
I have attached the code i used to attempt to connect to the broker. I think the problem is that i am using the wrong IP to connect to the broker. I was unable to get the broker IP adress.
Step 3: New Arduino Code
For the program to work you need to install those three libraries.
Furthermore you have to enter the name of you network (SSID) and password in order to connect to the wifi.
Step 4: Node-Red
Node-red is used as the interface for the program and allows the user to view the data collected by the temperature and humidity sensor. Furthermore all the collected data is saved to a data base which is cleared every 30 minutes. At any time the user can click a button to view all the current stored data.
Lastly a button can be placed to open the trashcan now.
Step 5: Wampserver
I used a database to store the data sent from the arduino to node-red. For the program to work you need to use the names. It's case sensitive.
Step 6: Conclusions
The program still needs a little work to make i usable. If you can connect to your broker it should be pretty easy to make the rest of the communication elements workable.