Introduction: UCL - Industry 4.0: Candy Mixer 4.000
For our project in Industry 4.0 we have decided to make a mixer for candy. The Idea is that we have a user panel, made in Node-Red, where customers can order their candy, then an arduino will process the order and mix the candy into a bowl. Then we have a database in SQL where we keep statictics over what kinds of candy is mostly ordered and the volume ordered.
First draft was to make a mixer for 8 kinds of candy, and have motors to open and close for the candy containers. We had some design trouble with the containers, the candy keept getting stuck, so we decided to go away from the motors and use some LED's to indicate the motors running.
Step 1: The Design
Our model is made with 4 containers for the candy, where a sliding lid is used to open and close for the candy. Under the containers we have a chute down to a bowl. The bowl is then on top of a load cell.
The design in Node-Red is devided up in 2 sections, Customer and Administration.
In the customer section we have 5 buttons, 4 of them is used for ordering the candy, and 1 is used to accept the purchase. With the purchase button the customer can see the weight of the candy, and the expected price, then when the purchase button is pushed the weight and price will show up in purchased.
In the administration section we can see how full our containers are and the total amount of candy bought.
In SQL we can see statistisks over what candy is choosen and the total weight and income from the purchases.
Step 2: The Arduino Curcuit
On the arduino board we have connected 4 pushbuttons, 4 two color LED's and 1 load cell with a HX711 module.
The pushbuttons is used for the candy operator to push when the containers have been filled with candy.
The two color LED uses Red and Green color. The red color indicates that the container is empty and needs to be filled, and the green color indicates what kind of candy have been choosen and then we can open for that container. This part was surposed to be automated but due to design problems we desided to make it manualy.
Step 3: I/O List
From the load cell we get 4 cabels, that get connected to a HX711 module
Red to E+
White to E-
Green to A-
Yellow to A+
The HX711 is then connected to the arduino board with
GND to ground
DT to Pin 3
SCK to Pin 2
VCC to 5V
Our pushbuttons are connected to pins 44, 46, 48 and 50, the green LED is connected to pins 30, 32, 34 and 36, the red LED is connected to pins 31, 33, 35 and 37.
Step 4: The Code
In the arduino code we start by defining our variables, and setting our LEDs and pushbuttons to some pins.
We also set up a variable for reciving the file from Node-Red.
When our buttons on the arduino is pushed we send status 5 to the Node-red, indicating that the containers have been filled and we are ready to disperse candy from that container.
When we push a button on the Node-Red customer side, we send over the number 1-4 to arduino. Arduino then checks the number and opens the container linked to that number. This is done with the green LED turing on for 5 seconds. At the same time we deduct 1 from the container status to indicate that some candy have been taken out of that container.
When the container status reaches 0 the red LED will turn on indicating that this container have to be filled up again.
When a purchase is being made the number 5 get send to arduino, and then it calculates the price and send the price and weight back to node-red and SQL.
The last part of the arduino code send the status' and weight/price back to note-red.
Step 5: Node-Red
Node Red makes all the connections between the arduino and the SQL database.
The data coming from the Customer screen in the Node-red goes to the arduino where it is processed. The processed data then goes back into Node Red and the Administration screen.
If we take the button 1 as excampel, we have it connected with the lines to both the arudino trough the com4, and the SQL server. When we then open the button, we can see that the info sent to the arduino is the Payload and the topic is sent to SQL.
We use a funktion in Node-Red to send the info from the arduino to the SQL. In this funktion we need some java code to tell Node-red what to do with the code.
var data = msg.payload.split(",");
var Vægt = data;
var Kroner = data;
var out = "UPDATE blanding SET Vægt= '"+Vægt+"', Kroner = '"+Kroner+"' WHERE id=1";
msg.topic = out;
In the code here, we get a string of data from arduino and it is split with a "," between the numbers.
For this funktion we need the numbers coming in the 13th and 14th place, and we put them into the variables "Vægt and Kroner". We then take the code that have to be executed in SQL and put into variable "out", and it is send as a topic to SQL.
Step 6: SQL
In the SQL database we keep the statistik over how many times each type of candy have been ordered trought the day, and the weight and price of the candy.
The button statestik comes from a counter connected to each button in Node-Red and the weight and price comes from arduino trough a funktion in Node-Red.
Step 7: Video
In the video we show that a container gets filled in the Admin panel, and then some candy gets ordered by clicking the buttons on the customer panel. At the same time the weight and estimated cost of the candy is shown on the customer panel.
When the customer is satisfied with his candy mix he pushes the purchase button, and the actual weight and cost is shown below the button. This then completes the customer part, and then the weight and cost is transfered to the admin panel and our database in sql.
In the database we then track how many times a surden piece of candy have been ordered and how much candy have been weight and the cost of it.
Step 8: Evaluation
This was a good project where we got to work with 3 programs and making them interact with each other. At first we had some functions being excecuted in Node-Red and some in Arduino, but to better keep an overview we decided to put all the functions into arduino and then have Node-Red stand for all the visual.
Step 9: Extend the Project
Our idea was to have one of the containers open with a motor, so the next step would be to make a design where the candy would not get stuck.