This project is about measuring the temperature of objects and then displaying these values on the two-digit 7-segment module. At the same time, the measured values are sent through the Ethernet module connected to the computer to be displayed in a program on the computer.
We'll list the tools and modules used in this project:
1) Hexabitz Thermopile Sensor (H09R9):
Use this module for non-contact temperature measurement, climate control, industrial process control, or household applications. Connect it to other Hexabitz modules to log sensor readings, wirelessly transmit data, or control external devices based on sensor readings [1].
2) Hexabitz 10Base-T Ethernet Module (H1DR5):
10Base-T Ethernet module plays a crucial role in enabling devices to communicate over Ethernet networks using the 10Base-T standard. It provides the necessary hardware support for data transmission and reception, ensuring reliable and efficient network connectivity [2].
3) Hexabitz 2 Digit Seven Segment Module (H3BR2):
Use this module as an output display device. Connect it to other Hexabitz modules to display information in text or decimal form [3].
4) Hexabitz Power Supply Module (H03R0x):
Power Supply is a 3.3V / 1A DC-DC Buck Power Supply With Terminal Block or DC Jack Input [4].
5) Software Program:
We used Ethernet Test, a program developed by the company's software team.
Notice:
The project can be run on any Ethernet interface.
6)User Tools Kit:
- 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) [5].
- 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 [6].
- Hexabitz BitzClamp:
Hexabitz BitzClamp is a modified Kelvin current clamp soldered to two 2.56 mm-pitch male jumper wires [7].
- Ethernet Cable:
We'll mention step-by-step instructions from designing to implementing of the project:
Planning the array and assembling the hardware:
1. Assembling The Hardware:
First, we prepare the project parts and plan our array design by aligning the four modules side by side. Then we solder the modules together using Hexabitz Fixture.
2. Writing codes with STM32CubeIDE software:
Let's first create the topology for the three modules (H09R9, H1DR5, H3BR2) and set their configurations, then add the same topology for all modules.
/*
BitzOS (BOS) V0.2.9 - Copyright (C) 2017-2023 Hexabitz
All rights reserved
File Name : topology.h
Description : Array topology definition.
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __topology_H
#define __topology_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32g0xx_hal.h"
#define __N 3 // Number of array modules
// Array modules
#define _mod1 1<<3
#define _mod2 2<<3
#define _mod3 3<<3
// Topology
static uint16_t array[__N ][7] ={
{_H1DR5, _mod2 | P1, _mod3 | P2, 0,0, 0, 0}, // Module 1
{_H09R9, _mod1 | P1, 0,0, 0, 0,_mod3 | P3}, // Module 2
{_H3BR2,0, _mod1 | P2, _mod2 | P6,0, 0,0}, // Module 3
};
// Configurations for duplex serial ports
#if ( _module == 1 )
#define H1DR5 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 == 2 )
#define H09R9 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
#if ( _module == 3 )
#define H3BR2 1
#define _P1pol_normal 1
#define _P2pol_normal 1
#define _P3pol_reversed 1
#define _P4pol_normal 1
#define _P5pol_normal 1
#define _P6pol_normal 1
#endif
#ifdef __cplusplus
}
#endif
#endif /*__ topology_H */
/************************ (C) COPYRIGHT HEXABITZ *****END OF FILE****/
Now, let's enable the topology by uncommenting its #include directive in project.h file inside all modules.
#include "topology.h"
- H09R9 Firmware main.c code:
In this module we measure the temperature by means of an instruction and store it in the transformer, and these values are constantly renewed, and then we send a message to the 7seg module to display the temperature on it, and then at the same time we send a message to the Ethernet module so that it transmits this value and displays it on the program on the computer.
First, we define our variables:
/* Private variables ---------------------------------------------------------*/
float temp;
uint8_t Number=0;
char data_to_send[10];
Second, inside the while(1) function, we write our code:
// put your code here, to run repeatedly.
while(1)
{
SampleTemperature(&temp);
Number=temp;
if (temp>=0 && temp<10)
{
sprintf(data_to_send,"%0.3f C", temp);
messageParams[0] = 7; //length
memcpy(&messageParams[1],&data_to_send,7);
SendMessageToModule(1,CODE_H1DR5_Ethernet_Send_Data,8);
messageParams[0]= Number;
SendMessageToModule(3,CODE_H3BR2_SevenDisplayNumber, 1);
}
else if (temp>=10 && temp<100)
{
sprintf(data_to_send,"%0.3f C", temp);
messageParams[0] = 8; //length
memcpy(&messageParams[1],&data_to_send,8);
SendMessageToModule(1,CODE_H1DR5_Ethernet_Send_Data,9);
messageParams[0]= Number;
SendMessageToModule(3,CODE_H3BR2_SevenDisplayNumber, 1);
}
else if (temp>=100)
{
Number=99;
sprintf(data_to_send,"%0.3f C", temp);
messageParams[0] = 9; //length
memcpy(&messageParams[1],&data_to_send,9);
SendMessageToModule(1,CODE_H1DR5_Ethernet_Send_Data,10);
messageParams[0]= Number;
SendMessageToModule(3,CODE_H3BR2_SevenDisplayNumber, 1);
}
}
Get filtered and calibrated temperature value in Celsius:
Display an integer value on the display:
Send data to Ethernet module:
- H1DR5 Firmware main.c code:
/*
BitzOS (BOS) V0.2.9 - Copyright (C) 2017-2023 Hexabitz
All rights reserved
File Name : main.c
Description : Main program body.
*/
/* Includes ------------------------------------------------------------------*/
#include "BOS.h"
/* Private variables ---------------------------------------------------------*/
uint8_t myGateway[4]={192,168,0,15};
uint8_t mySubnet[4]={255,255,255,0};
uint8_t myIP[4]={192,168,0,17};
uint8_t Mac_addres[6]={0x07,0x6,0x2,0x3,0x4,0x5};
/* Private function prototypes -----------------------------------------------*/
/* Main function ------------------------------------------------------------*/
int main(void){
Set_Local_mac_addr(Mac_addres); // Mac_addr ethernet
Module_Init(); //Initialize Module & BitzOS
//Don't place your code here.
for(;;){}
}
/*-----------------------------------------------------------*/
/* User Task */
void UserTask(void *argument){
Set_Local_IP(myIP); // ip ethernet
Set_SubnetMask(mySubnet); // SubnetMask laptop
Set_Remote_IP(myGateway); //ip laptop
Set_Local_PORT(90);// port ethernet
Set_Remote_PORT(95);//port laptop
Set_reseve_mac_and_ip_Remote();
// put your code here, to run repeatedly.
while(1){
}
}
/*-----------------------------------------------------------*/
In this module we adjust the settings for the ethernet:
Set Local_Mac_addr:
Set_Local_IP:
Set_SubnetMask:
Set_Remote_IP:
Set_Local_PORT:
Set_Remote_PORT:
Set_reseve_mac_and_ip_Remote:
The following video shows the final results of our project.
References:
[1]:Thermopile Sensor (H09R9x) – Hexabitz
[2]:10Base-T Ethernet (H1DR5x) – Hexabitz
[3]:2 Digit Seven Segment (H3BR2x) – Hexabitz
[4]:3.3V/1A DC-DC Power Supply (H03R0x) – Hexabitz
[5]:STLINK-V3MODS Programmer (H40Rx) – Hexabitz
[6]:E-Z-Hook Programming Kit – Hexabitz
[7]:Hexabitz BitzClamp – Hexabitz
[8]:Wiki – Hexabitz
Comments
Please log in or sign up to comment.