Considering the occurrence of errors in setting the required weight of coffee beans and avoid this dilemma and the work is less effort, and with the proliferation of smart machines these days it is possible by using simple techniques to work smoothly.
This system simply shows you the weight in grams through a load cell, which is displayed on the screen that gives a visual warning. When the required weight is reached, the motor is activated by the relay and works for the required time and then stops.
Tools used in this projectWe'll list the tools and modules used in this project.
1) HexabitzRGB LED module (H01R0x):
H01R0x is a smart RGB LED module [1].
2) Hexabitz 6 Digit Seven Segmentmodule (H3BR6x):
H3BR6x is a 6 digit seven segment interface module [3].
3) Hexabitz Load Cell module (H26R0x):
H26R0x is a Load Cell (Strain Gauge) Sensor [5].
4) HexabitzSPDT Mechanical DC Relay(H0FR1x):
H0FR1x is a SPDT Mechanical DC Relay module [7].
5) User Tools Kit:
This kit includes the tools that are essential for programming, debugging, and powering Hexabitz modules.
- FTDI USB to UART Serial cable:
The 4-pin USB 2.0 to UART serial cable is an indispensable tool for Hexabitz development! It incorporates FTDI’s USB to UART interface [9].
- Hexabitz BitzClamp:
Hexabitz BitzClamp is a modified Kelvin current clamp soldered to two 2.56 mm-pitch male jumper wires [10].
- STLINK-V3MODS Programmer (H40Rx):
H40Rx is a programmer module which contains STLINK-V3MODS stand-alone debugging and programming mini probe for STM32 microcontrollers (Hexabitz modules and other MCUs) [11].
- E-Z-Hook Programming Kit:
Instead of soldering SMD connectors there, you could use a nice off-the-shelf E-Z-Hook kit that we assembled for you [12].
We'll mention step by step instructions from designing to implementing of the project.
1. Planning the array and assembling the hardware:
First, we prepare the parts of the project and layout our matrix design by aligning the four modules side by side. Then we weld the modules together using Hexabitz Fixture.
2. Writing codes with STM32CubeIDE software:
This project uses a technique based on the principle of detecting weight changes by tracking changes in the weight cell.
After creating the topology for the four modules (H01R0x, H3BR6x, H26R0x, H0FR1) and determining their configurations, we add the topology for each module. See this link for help in creating a topology file.
#define __N 4 // Number of array modules
// Array modules
#define _mod1 1<<3
#define _mod2 2<<3
#define _mod3 3<<3
#define _mod4 4<<3
// Topology
static uint16_t array[__N ][7] ={
{_H01R0, 0, 0, 0, 0, _mod2 | P3, 0 }, // Module 1
{_H3BR6,0,_mod3 | P3,_mod1 | P5,0 , 0, 0, }, // Module 2
{_H26R0, _mod4 | P4, 0 , _mod2 | P2, 0,0,0 }, // Module 3
{_H0FR1,0, 0 ,0,_mod3 | P1,0, 0,}, // Module 4
};
// Configurations for duplex serial ports
#if ( _module == 1 )
#define _H01R0 1
#define _P1pol_normal 1
#define _P2pol_normal 1
#define _P3pol_normal 1
#define _P4pol_normal 1
#define _P5pol_reversed 1
#define _P6pol_normal 1
#endif
#if ( _module == 2 )
#define _H3BR6 1
#define _P1pol_normal 1
#define _P2pol_reversed 1
#define _P3pol_normal 1
#define _P4pol_normal 1
#define _P5pol_normal 1
#define _P6pol_normal 1
#endif
#if ( _module == 3 )
#define _H26R0 1
#define _P1pol_reversed 1
#define _P2pol_normal 1
#define _P3pol_normal 1
#define _P4pol_normal 1
#define _P5pol_normal 1
#define _P6pol_normal 1
#endif
#if ( _module == 4 )
#define _H0FR1 1
#define _P1pol_normal 1
#define _P2pol_normal 1
#define _P3pol_normal 1
#define _P4pol_normal 1
#define _P5pol_normal 1
#define _P6pol_normal 1
#endif
First, we define our variables in the main.c file of the Load Cell module (H26R40):
float Weight=0, timeout = 60000 ,n ;
Second In the UserTask function, we now write our recursive code that checks if the weight is displayed regularly. If the weight does not reach the desired weight, we send a message to the module RGB LED, so that it lights red when the weight value falls within the range (g). In this case, we send a message to the module RGB LED, so that it lights green.
We write our code:
while(1){
Weight = SampleGram(1);
memcpy(&messageParams[0], &Weight,4);
messageParams[4] = 2;
messageParams[5] = 'G';
messageParams[6]=0;
SendMessageToModule(2,CODE_H3BR6_SevenDisplayQuantities,7);
if(Weight>=75)
{
memcpy(&messageParams[0], &timeout, 4);
SendMessageToModule(4, CODE_H0FR1_ON, 4);
messageParams[1] = GREEN;
messageParams[2] = 75;
SendMessageToModule(1, CODE_H01R0_COLOR, 3);
n=1;
}
else if (n==1)
{
messageParams[1] = RED;
messageParams[2] = 100;
SendMessageToModule(1, CODE_H01R0_COLOR, 3);
Delay_s(5);
SendMessageToModule(4, CODE_H0FR1_OFF, 0);
n=0;
}
else
{
messageParams[1] = RED;
messageParams[2] = 100;
SendMessageToModule(1, CODE_H01R0_COLOR, 3);
}
}
}
When the desired weight is reached, we send a message to the SPDT Mechanical-DC-Relay module to put it in a closed seam state so that the motor is turned on and coffee grinding begins.
To set the load cell values in pound units, we used the following API from the H26R0 factsheet [6].
To show the weight value displayed on the screen, we used the following Message from the H3BR6 factsheet [4].
To send a command to run to RGB led we use the following Message from the H01R0 factsheet [2].
To send a command to run to SPDT Mechanical DC Relay we use the following Message from the H0FR1 factsheet [8].
To send a command to off to SPDT Mechanical DC Relay we use the following Message from the H0FR1 factsheet [8].
Once we have written our codes, we download them for each module using the programmer.
Results:Here are the results of our project. Enjoy watching!
[1]: RGB LED (H01R0x) – Hexabitz
[2]: H01R0x Factsheet – Hexabitz
[3]:6 Digit Seven Segment (H3BR6x) – Hexabitz
[4]:H3BR6x Factsheet – Hexabitz
[5]:Load Cell Sensor (H26R0x) – Hexabitz
.[6]:H26R0x Factsheet – Hexabitz
[7]:SPDT Mechanical DC Relay (H0FR1x) – Hexabitz
[8]:H0FR1x Factsheet – Hexabitz
[9]:4-Pin USB-Serial Prototype Cable – Hexabitz
[10]:Hexabitz BitzClamp – Hexabitz
Comments
Please log in or sign up to comment.