英飛凌PSoC62是一款Cortex-M0+與Cortex-M4的雙內(nèi)核MCU,其有著非常優(yōu)秀的超低功耗性能。
溫度計(jì)的器材
選型原因
以上三款都具休有超過(guò)功耗性能
程序代碼
- 本次的代碼是基于RT-Thread Studio創(chuàng)建的。
- 電子墨水屏是移植微雪的標(biāo)準(zhǔn)例程。這里不過(guò)多介紹。
- hs3003是利用rtt軟件包的模塊創(chuàng)建。
- 低耗實(shí)現(xiàn)的代碼,MCU利用Cortex-M0+的標(biāo)準(zhǔn)進(jìn)入深度睡眠模式。然后用RTC的ALARM中斷來(lái)喚醒。設(shè)置的喚醒程序如下:
void set_rtc_alarm_date_time(void)
{
cy_rslt_t result;
/* Print the RTC alarm time by UART */
//LOG_D("RTC alarm will be generated after 10 seconds
");
/* Set the RTC alarm for the specified number of seconds in the future by editing the macro(USE_SECONDS_FOR_ALARM) */
result = cyhal_rtc_set_alarm_by_seconds(&rtc_obj, USE_SECONDS_FOR_ALARM);
if (result != CY_RSLT_SUCCESS)
{
rt_kprintf("RTC alarm err
");
}
}
5、主程序代碼:
int main(void)
{
cy_rslt_t result;
float temp, humi;
uint8_t show_str[20] = {0};
EPD_GPIO_Init(); //EPD GPIO initialization
//Cy_SysDisableCM4();
__enable_irq();
rt_pin_mode(LED_PIN, PIN_MODE_OUTPUT);
// rt_thread_mdelay(500);
Paint_NewImage(BlackImage, 128, 296, 270, WHITE); //Set screen size and display orientation
Paint_SelectImage(BlackImage);//Set the virtual canvas data storage location
Paint_NewImage(BlackImage, EPD_WIDTH, EPD_HEIGHT, 270, WHITE); //Set screen size and display orientation
Paint_SelectImage(BlackImage);//Set the virtual canvas data storage location
EPD_DeepSleep();
/* Initialize RTC */
cyhal_rtc_enable_event(&rtc_obj, CYHAL_RTC_ALARM, RTC_INTERRUPT_PRIORITY, true);
set_rtc_alarm_date_time();
for (;;)
{
// cyhal_system_delay_ms(LONG_GLITCH_DELAY_MS);
/* Set MYPIN_0_NUM to Analog HI-Z for low power using HAL APIs. */
// /* Go to deep sleep */
cyhal_syspm_deepsleep();
set_rtc_alarm_date_time();
// rt_kprintf("Wack from sleep!
");
hs300x_read_data(&temp_humi_dev, &humi, &temp);
EPD_HW_Init(); //Electronic paper initialization
EPD_HW_Init_GUI(); //EPD init GUI
Paint_Clear(WHITE);
sprintf(show_str,"溫度%02d.%02d℃",(int)temp, (int)(temp*100)%100);
Paint_DrawString_CN(40,0,show_str, &Font24CN, WHITE, BLACK);
sprintf(show_str,"濕度%02d.%02d%%",(int)humi, (int)(humi*100)%100);
Paint_DrawString_CN(40,40,show_str, &Font24CN, WHITE, BLACK);
EPD_Display(BlackImage); //display image
EPD_DeepSleep();//EPD_DeepSleep,Sleep instruction is necessary, please do not delete!!!
}
}
實(shí)驗(yàn)的效果
經(jīng)調(diào)試休眠模式下,整體的待機(jī)電流低到450uA:
工作電流為19mA:
總結(jié)
目前待機(jī)電流基本上達(dá)到電池供電的效果,后期再加上NB-IoT的數(shù)據(jù)傳輸模式。
-
英飛凌
+關(guān)注
關(guān)注
68文章
2344瀏覽量
140587 -
溫濕度傳感器
+關(guān)注
關(guān)注
5文章
600瀏覽量
36517 -
溫濕度計(jì)
+關(guān)注
關(guān)注
1文章
26瀏覽量
8523 -
RT-Thread
+關(guān)注
關(guān)注
32文章
1406瀏覽量
41905 -
NB-IoT
+關(guān)注
關(guān)注
413文章
1452瀏覽量
186647
發(fā)布評(píng)論請(qǐng)先 登錄
常見(jiàn)的溫濕度傳感器類(lèi)型?
溫濕度變送器功能有哪些?一文詳細(xì)解析
智能倉(cāng)儲(chǔ):溫濕度監(jiān)控方案應(yīng)用

用樹(shù)莓派RP2350 DIY 桌面動(dòng)態(tài)溫濕度計(jì)

樹(shù)莓派RP2350 - 桌面動(dòng)態(tài)溫濕度計(jì)
如何操作電子溫濕度記錄儀

XKCON祥控生物質(zhì)燃料堆溫濕度無(wú)線監(jiān)測(cè)系統(tǒng)

工廠溫濕度監(jiān)控系統(tǒng)
XKCON祥控倉(cāng)庫(kù)存儲(chǔ)環(huán)境溫濕度在線監(jiān)測(cè)系統(tǒng)能夠取代人工巡檢,實(shí)現(xiàn)遠(yuǎn)程倉(cāng)庫(kù)存儲(chǔ)環(huán)境溫濕度變化的實(shí)時(shí)

LORA無(wú)線溫濕度監(jiān)測(cè)系統(tǒng)
溫濕度控制器的功能和應(yīng)用
藍(lán)牙溫濕度傳感器:準(zhǔn)確監(jiān)測(cè),智能管理
利用相對(duì)濕度傳感器增強(qiáng)功能實(shí)現(xiàn)超低功耗系統(tǒng)

評(píng)論