.
Overview.
During this COVID time, retail outlets start to enforce the social distancing regulation by limiting the number of customers in a fixed size store. They need a system which help to put the flow of customers in order.
.
.
One of the method to control the flow is by passing a fixed number of 'tokens' among the customers. This is normally done manually by having a person handing out the tokens to cumtomers.
.
.
I am building a Smart Queue system which limits the number of customers being serviced in a outlet by a 'smart' queue system. Most existing solutions do not have the number of customers limiting feature in an automated manner. This feature is useful in easing the enforcement of social distancing rule during this COVID time.
.
In the proposed solution, the AWS IoT EduKit and varous AWS services are used to automate a store's customers flow control. The IoT EduKit will turn on the RED LED if the store is FULL or otherwise BLUE LED if it is UNDER capacity. At the moment, a temperature reading and sound signal are used to derive the status as FULL or UNDER capacity. Customers are allowed to enter an outlet only if the queue status is UNDER capacity i.e. when the LED is lighted BLUE.
.
Setup.
The AWS IoT EduKit documention has all the information need to set things up. I follow the tutorials here to setup the development environment.
.
Device provisioning is important and follow the instrucitons to get it setup. The Smart Queue solution is built based on the Smart Thermostat tutorial. To build the solution, I follow those instructions and add the "queue" status.
.
Solution Architecture.
.
The queueApplication in the IoT Event detector model:
.
Code Fragment.
Change the input resource in IoT Event service and use the following schema:
.
{
"current": {
"state": {
"reported": {
"sound": 10,
"temperature": 35,
"roomOccupancy": false,
"hvacStatus": "HEATING",
"queueStatus": "FULL"
}
},
"version": 13
},
"timestamp": 1606282489
}
.
This is the queue callback in main.c
:
void queue_Callback(const char *pJsonString, uint32_t JsonStringDataLen, jsonStruct_t *pContext) {
IOT_UNUSED(pJsonString);
IOT_UNUSED(JsonStringDataLen);
char * status = (char *) (pContext->pData);
if(pContext != NULL) {
ESP_LOGI(TAG, "Delta - queueStatus state changed to %s", status);
}
if(strcmp(status, FULL) == 0) {
ESP_LOGI(TAG, "setting side LEDs to red");
Core2ForAWS_Sk6812_SetSideColor(SK6812_SIDE_LEFT, 0xFF0000);
Core2ForAWS_Sk6812_SetSideColor(SK6812_SIDE_RIGHT, 0xFF0000);
Core2ForAWS_Sk6812_Show();
ui_textarea_add("Queue is FULL", NULL, 0);
} else if(strcmp(status, UNDER) == 0) {
ESP_LOGI(TAG, "setting side LEDs to blue");
Core2ForAWS_Sk6812_SetSideColor(SK6812_SIDE_LEFT, 0x0000FF);
Core2ForAWS_Sk6812_SetSideColor(SK6812_SIDE_RIGHT, 0x0000FF);
Core2ForAWS_Sk6812_Show();
ui_textarea_add("Queue is UNDER CAPACITY", NULL, 0);
} else {
ESP_LOGI(TAG, "clearing side LEDs");
Core2ForAWS_Sk6812_Clear();
Core2ForAWS_Sk6812_Show();
ui_textarea_add("Queue is STANDBY", NULL, 0);
}
}
.
Screenshots.
.
Summary.
This project is a very simple queue management system. It can be improved by using motion sensor and database in the backend to keep track of the count of customer in the store. Once the count threshold is reached, the system will tell the limit is reached and nobody is allowed to enter the store.
.
Comments