MERIDIAN Thermal Imager Sensor

Preface

Meridian offers advanced CMOS thermal imaging solutions, enabling the production of thermal image sensors that can receive infrared wavelengths ranging from 8 to 14 μm. These sensors are primarily applied in consumer and commercial products. What sets them apart from conventional imaging is their affordability, as they require only a low-cost MCU to handle processing, significantly reducing application costs.
One notable product is the MI0802 thermal imaging module, which includes a thermal sensor, lens, 64 KB Flash memory, and a PCBA 10-pin FPC connector.

How do Thermal Imager sensor work?

Principle of Thermal Imaging Sensor: The thermal radiation of an object is collected through a lens, and the energy is then directed through a selected spectral band filter. It reaches a pixel detector, where the infrared (IR) radiation is converted into an electronic signal and further transformed into a temperature image

MI48Dx Thermal Image Processor

The MI48Dx thermal image processor is designed to be used in conjunction with the MI0802 thermal imaging module. Its main functions include performing calibration for each pixel, executing bad pixel correction (BPC), converting raw data into temperature, and suppressing pixel noise.
In simple terms, it serves as a small MCU that handles the front-end calibration clock. Due to its non-standard specification (beyond the usual 8080), it can be interfaced with your own MCU, but using the MI48 interface allows for convenience and speed.

Hardwave Connet

You can refer to the diagram below, which requires a total of 12 pins to be connected. Please note that pins 8, 11, and 12 should be connected, even if they are not being used; they should be connected to GND.

in ADDR (pin 11 of the 12 pins header) in order to use slave address of 0x40.

Also the MODE pin (pin 8 of the 12 pins header) has to be pulled low to enable SPI/I2C operation

STM32 sample code ON H7

During the initialization process, the following functions will be used. They involve configuring GPIO, I2C, and communication with MI48. If there is a hang-up, please inspect these connections.

  mi48Reset();
  mi48EnbleTemporalFilter();
  mi48SetFrameRateDivisor(2);
  mi48StartContinuousCapture();

Function detail

void mi48Reset()
{
	HAL_GPIO_WritePin(MI48_RST_GPIO_Port, MI48_RST_Pin, GPIO_PIN_RESET);
	HAL_Delay(100);
	HAL_GPIO_WritePin(MI48_RST_GPIO_Port, MI48_RST_Pin, GPIO_PIN_SET);
	HAL_Delay(1000);
}

void mi48EnbleTemporalFilter()
{
	uint8_t buf[16];

	buf[0] = 0xd0;
	buf[1] = 0x0b;
	HAL_I2C_Master_Transmit(&hi2c1, 0x40<<1, buf, 2, HAL_MAX_DELAY);

	HAL_Delay(1000);
}

void mi48SetFrameRateDivisor(uint8_t framerateDivisor)
{
	uint8_t buf[16];

	buf[0] = 0xb4;
	buf[1] = framerateDivisor;
	HAL_I2C_Master_Transmit(&hi2c1, 0x40<<1, buf, 2, HAL_MAX_DELAY);
}

void mi48StartContinuousCapture()
{
	uint8_t buf[16];

	buf[0] = 0xb1;
	buf[1] = 0x03;
	HAL_I2C_Master_Transmit(&hi2c1, 0x40<<1, buf, 2, HAL_MAX_DELAY);
}

Next, it’s simply a matter of reading out the SPI data. However, the data here is not the typical RGB565 or RGB888 format. Therefore, a color map is provided to facilitate the conversion and mapping onto the display panel.

 while (1)
  {
	  if(HAL_GPIO_ReadPin(MI48_DATA_READY_GPIO_Port, MI48_DATA_READY_Pin))
	  {
		  HAL_GPIO_WritePin(GPIOA, MI48_SSA15_Pin, GPIO_PIN_RESET);

		  if(HAL_SPI_Receive(&hspi3, (uint8_t *)spiBuf, 4960+80, HAL_MAX_DELAY) != HAL_OK)
		  {
			  HAL_GPIO_WritePin(GPIOA, MI48_SSA15_Pin, GPIO_PIN_SET);

		    Error_Handler();
		  }
		  else
		  {
			  HAL_GPIO_WritePin(GPIOA, MI48_SSA15_Pin, GPIO_PIN_SET);

			  processThermalData();
		  }
	  }
    /* USER CODE END WHILE */

    /* USER CODE BEGIN 3 */
  }

The data retrieval process in the ‘processThermalData’ function can be referred to below (it essentially involves extracting the minimum and maximum values and performing color map conversion).

void processThermalData()
{
	uint32_t min = 0;
	uint32_t max = 0;

	if (isFillRollingArray){
		for (int i=0; i<minMaxRollingCount; i++){
			minArray[i] = spiBuf[6]; // min
			maxArray[i] = spiBuf[5];  // max
		}
		isFillRollingArray = false;
	}

	if (spiBuf[6]!=0){
		minArray[minMaxRollingIndex] =  spiBuf[6]; // min
		maxArray[minMaxRollingIndex] = spiBuf[5];  // max
	}

	for (int i=0; i<minMaxRollingCount; i++){
		min+= minArray[i];
		max+= maxArray[i];
	}
	max = (max/minMaxRollingCount)+paddingOnMinMax;
	min = (min/minMaxRollingCount)-paddingOnMinMax;

	minMaxRollingIndex++;
	if (minMaxRollingIndex==minMaxRollingCount){
		minMaxRollingIndex = 0;
	}

	  if (spiBuf[6]!=0){

			  mi48TemperatureToRGB565WithColorMap(spiBuf+80, outputBuffer, spiBuf[6], spiBuf[5], colorMapIndex, false);
			  ST7735_DrawImage(0, 30, 80, 62, (uint16_t*)outputBuffer);
			  printMaxMin(spiBuf[5],spiBuf[6], false);
			  min = 0xffff;
			  max = 0;
	  }
}

Leave a Comment

Your email address will not be published. Required fields are marked *

Shopping Cart