Design content
To address the issue of low utilization efficiency of library seats, a smart library seat management system based on narrowband Internet of Things (IoT) was designed. This system uses a microcontroller and pyroelectric infrared sensors to collect the usage status of each library seat in a non-contact, proactive, and real-time manner, and then sends the data to the IoT platform via a narrowband IoT module.
Requirements and Data
1. The seat information acquisition terminal consists of a pyroelectric infrared sensor, a microcontroller, and a narrowband Internet of Things module;
2. Data is transmitted using the Quectel BC95 IoT NB-IoT narrowband IoT module, which features high performance and low power consumption.
3. Select a suitable IoT platform to receive data;
4. Others.
Partial program:
#include "./HAL/key/key.h"
#include "./HAL/delay/delay.h"
/**********************************
Variable definition
**********************************/
uint8_t chiclet_keyboard_num = 0; // Key-value variable
/**********************************
Function definition
**********************************/
/****
Independent key scan function
Return value: key-value pair
*****/
uint8_t Chiclet_Keyboard_Scan(void)
{
if(K1 == 0) // Button K1 is low level
{
delay_us(2000); // 2ms debouncing
if(K1 == 0) //Button K1 is still low, confirming that K1 has been pressed.
{
chiclet_keyboard_num = 1; // Set the key value to 1
}
while(!K1); // An infinite loop, until the user raises their hand and exits.
return chiclet_keyboard_num; // Returns the key value
}
if(K2 == 0) // Button K2 is low level
{
delay_us(2000); // 2ms debouncing
if(K2 == 0) //Button K2 is still low, confirming that K2 has been pressed.
{
chiclet_keyboard_num = 2; // Set the key value to 2
}
while(!K2); // An infinite loop, until the user raises their hand and exits.
return chiclet_keyboard_num; // Returns the key value
}
if(K3 == 0) // Button K3 is low level
{
delay_us(2000); // 2ms debouncing
if(K3 == 0) //Button K3 is still low, confirming that K3 has been pressed.
{
chiclet_keyboard_num = 3; // Set the key value to 3
}
while(!K3); // Infinite while loop, continues until the user raises their hand and exits.
return chiclet_keyboard_num; // Returns the key value
}
return 0;