Esraa Alkadour
Published

Low Pass Filter for Thermocouple Temperature Sensor

All signals in nature contain noise components that affect the original signal. Therefore, we always try to remove noise from digital signal

BeginnerFull instructions provided1,473
Low Pass Filter for Thermocouple Temperature Sensor

Things used in this project

Hardware components

4-Pin USB-Serial Prototype Cable
Hexabitz 4-Pin USB-Serial Prototype Cable
×1
BitzClamp
Hexabitz BitzClamp
×1
STLINK-V3MODS Programmer (H40Rx)
Hexabitz STLINK-V3MODS Programmer (H40Rx)
×1
Thermocouple Temperature Sensor (H09R0x)
Hexabitz Thermocouple Temperature Sensor (H09R0x)
×1

Software apps and online services

STMicroelectronics STM32CubeIDE
STMicroelectronics STM32CubeMonitor

Story

Read more

Code

Low Pass Filter for Temperature Sensor

C/C++
/*
 BitzOS (BOS) V0.2.5 - Copyright (C) 2017-2021 Hexabitz
 All rights reserved

 File Name     : main.c
 Description   : Main program body.
 */
/* Includes ------------------------------------------------------------------*/
#include "BOS.h"

/* Private variables ---------------------------------------------------------*/
float tempc;
float tempc1;
float lpf_temp,lpf_temp1;
/* Private function prototypes -----------------------------------------------*/

/* Main function ------------------------------------------------------------*/

int main(void){

	Module_Init();		//Initialize Module &  BitzOS

	//Don't place your code here.
	for(;;){}
}

/*-----------------------------------------------------------*/

/* User Task */
void UserTask(void *argument){

	// put your code here, to run repeatedly.
	while(1){
		//take samples from the temperature module
		SampleC(&tempc);
		//take the previous sample
		lpf_temp1=lpf_temp;
		tempc1=tempc;
		//low-pass filter equation applied to the temperature module signal
		lpf_temp1=0.9377*lpf_temp+0.031*tempc+0.03*tempc1; //fc=0.041Hz
		Delay_ms(10);


	}

	 }


/*-----------------------------------------------------------*/

Credits

Esraa Alkadour
1 project • 1 follower

Comments