SEU1zC9c

Multifunctional Tester Based on STM32

 
Overview
The schematic design describes

the acquisition of voltage and current signals using an INA226 microcontroller.
Temperature is acquired using a MAX6675 microcontroller and a K-type thermocouple.
The software

cyclically prints the acquired parameters, and users can select data to upload to the serial port via buttons.
Code block:
int main(void)
{
uint16_t cur,temp;
// Clock initialization
SysTick_Init();
uart_init(115200);
// Screen initialization
TFT_Init();

// ADC initialization
Adc_Init();
// INA226 initialization
INA226_Init();
// MAX6675 initialization
MAX6675_Init();

// Key pin initialization
Init_Key_GPIO();

// Fill black
TFT_Fill(0,0,160,128,BLACK);

// Initialize static UI
TFT_StaticUI(&TestTools);

while(1)
{
// Key scan processing function
Key_Handle(&TestTools);
// Parameter display UI
TFT_ShowUI(&TestTools);

TestTools.InaVoltage=INA226_GetVoltage(WRITE_ADDR)/8;

cur = INA226_GetShuntCurrent(WRITE_ADDR); // Get current value
if(cur&0x8000)cur = ~(cur - 1); // Negative current // Because the negative terminal needs to be grounded, reverse current measurement is not allowed. Negative values ​​are actually not allowed.
TestTools.InaCurrent=cur;

TestTools.ResAdcValue=Get_Adc(4);//Get the resistance measurement ADC value
TestTools.BatAdcValue=Get_Adc(2);//Get the battery charge ADC value


temp=readMAX6675();
TestTools.TempConnection=temp&0x4;//0x4 is disconnected, 0 is connected to the thermocouple
temp= temp<<1;//Get bits 3~14
temp= temp>>4;
TestTools.temperature=temp;

if(TestTools.showmode==1)
printf("Voltage:%.2f
",TestTools.InaVoltage/100.0f);
if(TestTools.showmode==2)
printf("Current:%.3f
",TestTools.InaCurrent/1000.0f);
if(TestTools.showmode==3)
printf("Temperature:%.1f
",TestTools.temperature*0.25f);

delay_ms(300);

}
}


Physical demonstration instructions

and precautions
: Note that the battery is a single lithium battery.
Demonstration video
: https://space.bilibili.com/35559163?spm_id_from=333.1007.0.0
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2026-03-26 14:39:51

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号