服務熱線
0755-83044319
發布時間:2024-10-17作者來源:薩科微瀏覽:747
深圳市薩科微SLKOR(baixing316.com.cn)半導體有限公司技術骨干來自清華大學和韓國延世大學,以新材料新工藝新產品引領公司發展,較早就掌握國際領先的第三代半導體碳化硅功率器件技術。薩科微集電子產品的設計開發、生產和銷售一體化的高新科技企業,為客戶提供可靠的產品和配套的技術服務,“slkor”逐漸發展成為國際知名品牌,為全世界超過10000家客戶提供產品和解決方案。為了努力為客戶提供全系列的配套產品,薩科微推出一系列數字紅外熱電堆非接觸測溫應用設計demo板使用教程。
1.1名稱:薩科微數字紅外熱電堆非接觸測溫應用設計demo板使用教程
1.2應用:智能可穿戴設備、智能手機、工業溫度監測、非接觸表面人體測溫、智能溫度感應與控制等近距離測溫尺寸較小的設備
1.3薩科微SL-W-TRS-5.5Dx系列demo板:
用于對各型號傳感器進行評估測試。測 量結果會在屏幕上顯示,并可以通過 USB 轉串口打印到 PC 端串口調試軟件。按鍵說明:左側按鍵為復位,右側按鍵可以控制程序啟動、暫停。
2.薩科微SL-W-TRS-5.5Dx系列硬件設計
芯片引腳包含電源、I2C 總線共 4 個管腳,供電電壓允許范圍為 2.3~3.6V。傳感器本身功耗很低,電源地之間使用一顆 0.1uF 電容即可,如果傳感器離供電部分比較遠,可以考慮增 加一個10uF 電容,以保證電源穩定降低噪聲。
3.薩科微(www.slkoric.com)SL-W-TRS-5.5Dx系列demo板說明
3.1 demo 板通過 Type-C 插座供電,demo 板供電電壓為 5V。使用時將 demo 板通過 Type-c 連接至 PC 端,即可從屏幕上查看結果。如需串口顯示數據,需安裝沁恒 CH340 驅動程序然后使用串口調試軟件進行操作,串口通信設置為: 波特率:9600 數據位:8 停止位:1 無奇偶校驗
3.2 demo 板屏幕顯示從上到下依次是:環境溫度(tamb)、傳感器輸出電壓(vtp_cor)、 物體(表面)溫度(tobj)、人體溫度(tbdy)。上述數值溫度單位為℃,電壓單位為 uV。 其中前三個值為器件原始輸出,體溫值使用我司算法根據原始值計算得到,僅供參考,用戶可以根據需要使用自家體溫算法來處理數據。
串口顯示效果
3.薩科微SL-W-TRS-5.5Dx系列demo板程序示例
//////////////////////////////////////////////////////////////////////////////////////////////////////
// main.c
//////
#define FOR_CUSTOMER
#ifdef FOR_CUSTOMER
#include "drv_uart.h"
#include "drv_i2c.h"
#include "drv_key.h"
#include "oled/oled.h"
#include "trs55d.h"
extern void SystemCoreClockUpdate(void);
extern void delay_ms(int cnt);
int main(void)
{
uint8_t key;
uint8_t run = 0x01;
SystemCoreClockUpdate();
if (SysTick_Config(SystemCoreClock / 1000))
while(1);
uartInit();
drv_i2c_init();
drv_key_init();
OLED_Init();
OLED_Refresh();
OLED_Clear();
OLED_ShowString(8,0,"Tamb:",16,1);
OLED_ShowString(8,16,"Vtp:",16,1);
OLED_ShowChinese(8,32,0,16,1);
OLED_ShowChinese(24,32,2,16,1);
OLED_ShowChinese(40,32,3,16,1);
OLED_ShowChinese(8,48,1,16,1);
OLED_ShowChinese(24,48,2,16,1);
OLED_ShowChinese(40,48,3,16,1);
OLED_Refresh();
uartSendString("SL-W-TRS-5.5Dx Demo program\r\n");
while(1) {
key = drv_key_read();
while(drv_key_read());
if (key) {
run = (run)?0:1;
}
if (run) {
TRS55D_read();
OLED_Refresh();
}
delay_ms(20);
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
//trs55d.h
//////
#ifndef _TRS55D_H_
#define _TRS55D_H_
#include
#define TRS55D_NORMAL_Tobj_MSB_R 0x10
#define TRS55D_NORMAL_Tobj_CSB_R 0x11
#define TRS55D_NORMAL_Tobj_LSB_R 0x12
#define TRS55D_NORMAL_TEMP_MSB_R 0x16
#define TRS55D_NORMAL_TEMP_CSB_R 0x17
#define TRS55D_NORMAL_TEMP_LSB_R 0x18
#define TRS55D_NORMAL_DATA1_MSB_R 0x19
#define TRS55D_NORMAL_DATA1_CSB_R 0x1A
#define TRS55D_NORMAL_DATA1_LSB_R 0x1B
#define TRS55D_NORMAL_DATA2_MSB_R 0x1C
#define TRS55D_NORMAL_DATA2_CSB_R 0x1D
#define TRS55D_NORMAL_DATA2_LSB_R 0x1E
#define TRS55D_RAW_DATA1_MSB_R 0x22
#define TRS55D_RAW_DATA1_CSB_R 0x23
#define TRS55D_RAW_DATA1_LSB_R 0x24
#define TRS55D_RAW_DATA2_MSB_R 0x25
#define TRS55D_RAW_DATA2_CSB_R 0x26
#define TRS55D_RAW_DATA2_LSB_R 0x27
#define TRS55D_RAW_TEMP_MSB_R 0x28
#define TRS55D_RAW_TEMP_CSB_R 0x29
#define TRS55D_RAW_TEMP_LSB_R 0x2A
#define ADDR_TRS55D 0xFE //(0x7F << 1)
#define _STATUS_DRDY_ 0x01 void TRS55D_read(void);
#endif
//////////////////////////////////////////////////////////////////////////////////////////////////////
// trs55d.c
//////
#include
#include "drv_i2c.h"
#include "trs55d.h"
#include "body_temp.h"
extern uint8_t uartSendString(const char* buf);
extern void OLED_ShowString(uint8_t x,uint8_t y, const char *chr,uint8_t size1,uint8_t mode);
extern void OLED_ShowBNum(uint8_t x,uint8_t y,float num,uint8_t len,
uint8_t size2,uint8_t mode); uint8_t TRS55D_IIC_Read(uint8_t addr_dev, uint8_t addr_reg,
uint8_t *buf, uint16_t count)
{
uint8_t ret;
uint8_t ackflag;
uint16_t i = 0;
drv_i2c_start();
drv_i2c_select_dev(addr_dev,DRV_I2C_OPWR);
drv_i2c_writebyte(addr_reg);
drv_i2c_start();
drv_i2c_select_dev(addr_dev,DRV_I2C_OPRD);
for(i = 0; i < count; i ++) { ackflag = (i < (count-1)) ? 1:0; buf[i]
= drv_i2c_readbyte(ackflag);
}
drv_i2c_stop();
return ret;
}
void TRS55D_IIC_Write(uint8_t addr_dev, uint8_t addr_reg, uint8_t *buf, uint16_t count)
{
uint16_t i = 0;
drv_i2c_start();
drv_i2c_select_dev(addr_dev,DRV_I2C_OPWR);
drv_i2c_writebyte(addr_reg);
for (i = 0; i < count; i ++)
{ drv_i2c_writebyte(buf[i]);
}
drv_i2c_stop();
}
typedef union{
int16_t i16;
uint16_t u16;
struct {
uint8_t u8l;
uint8_t u8h;
}un;
}uu16_t;
typedef union{
int32_t i32;
struct {
uint8_t u8b0;
uint8_t u8b1;
uint8_t u8b2;
uint8_t u8b3;
}un;
}uu32_t;
static char buffer[264];
uu32_t tobj, tamb_cal;
uu32_t vtp_cor;
float vtp_uv_f = 0.0;
float vtp_cor_f = 0.0;
float tambf = 0.0; float tobjf = 0.0;
float tbdyf = 0.0;
void TRS55D_read(void)
{
uint8_t rbuf[4];
uint8_t raddr,rdat;
uint8_t waddr = 0x0, wdat = 0x0;
int timeout=0;
waddr = 0x30;
wdat = 0x09;
TRS55D_IIC_Write(ADDR_TRS55D, waddr, &wdat,1);
//start conversion delay_ms(100);
// waite for conversion over
raddr = 0x03;
do {
TRS55D_IIC_Read (ADDR_TRS55D, raddr, &rdat,1);
} while(((rdat == 0xFF) || (!(rdat & 0x30))) && timeout++ < 200);
raddr = 0x02;
do {
TRS55D_IIC_Read (ADDR_TRS55D, raddr, &rdat,1);
} while(((rdat == 0xFF) || (!(rdat & 0x0B))) && timeout++ < 200);
// voltage value after calibration
raddr = TRS55D_NORMAL_DATA1_MSB_R;
TRS55D_IIC_Read (ADDR_TRS55D, raddr,&rbuf[0],3);
vtp_cor.un.u8b2 = rbuf[0];
vtp_cor.un.u8b1 = rbuf[1];
vtp_cor.un.u8b0 =rbuf[2];
if (vtp_cor.un.u8b2 & 0x80) { vtp_cor.un.u8b3 = 0xFF;
}else {
vtp_cor.un.u8b3 = 0x00;
// vtp after corrected
}
vtp_cor_f = (float)vtp_cor.i32/524288.0;
vtp_cor_f *= 1000;
// ambient temperature value after calibration
raddr = TRS55D_NORMAL_TEMP_MSB_R;
TRS55D_IIC_Read (ADDR_TRS55D,raddr,&rbuf[0],3);
tamb_cal.un.u8b2 = rbuf[0];
tamb_cal.un.u8b1 =rbuf[1];
tamb_cal.un.u8b0 =rbuf[2];
tambf = (float)tamb_cal.i32 / 16384.0; // ambient temperature
// object(surface) temperature after calibration
raddr = TRS55D_NORMAL_Tobj_MSB_R;
TRS55D_IIC_Read (ADDR_TRS55D,raddr,&rbuf[0],3);
tobj.un.u8b2 = rbuf[0]; tobj.un.u8b1 = rbuf[1];
tobj.un.u8b0 =rbuf[2]; tobjf = (float)tobj.i32 / 16384.0;
// object(surface) temperature
// get bodytemp
tbdyf = get_body_temp(tambf,tobjf); // get bodytemp
// display on uart sprintf(buffer, "tamb = %.2f, vtp_cor = %.2f, tobj = %.2f, tbdy = %.2f\r\n",\ tambf, vtp_cor_f, tobjf, tbdyf); uartSendString(buffer);
// display on oled
float vals[4] = {tambf, vtp_cor_f, tobjf, tbdyf+0.05};
OLED_ShowBNum (64, 0, vals[0], 4, 16, 1); // Tamb
OLED_ShowBNum (48, 16, vals[1], 6, 16, 1); // vtp
OLED_ShowString(112,16, "uv",16, 1);
OLED_ShowBNum (64, 32, vals[2], 4, 16, 1); // Tobj
OLED_ShowBNum (64, 48, vals[3], 4, 16, 1); // Tbdy
}
友情鏈接:站點地圖 薩科微官方微博 立創商城-薩科微專賣 金航標官網 金航標英文站
Copyright ?2015-2024 深圳薩科微半導體有限公司 版權所有 粵ICP備20017602號-1