Research Article: A Smart System For Sitting Posture Detection Based On Force Sensors and Mobile Application
Research Article: A Smart System For Sitting Posture Detection Based On Force Sensors and Mobile Application
Research Article: A Smart System For Sitting Posture Detection Based On Force Sensors and Mobile Application
Research Article
A Smart System for Sitting Posture Detection Based on Force
Sensors and Mobile Application
Received 5 October 2020; Revised 2 November 2020; Accepted 5 November 2020; Published 19 November 2020
Copyright © 2020 Slavomir Matuska et al. This is an open access article distributed under the Creative Commons Attribution
License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is
properly cited.
The employees’ health and well-being are an actual topic in our fast-moving world. Employers lose money when their employees
suffer from different health problems and cannot work. The major problem is the spinal pain caused by the poor sitting posture on
the office chair. This paper deals with the proposal and realization of the system for the detection of incorrect sitting positions. The
smart chair has six flexible force sensors. The Internet of Things (IoT) node based on Arduino connects these sensors into the
system. The system detects wrong seating positions and notifies the users. In advance, we develop a mobile application to receive
those notifications. The user gets feedback about sitting posture and additional statistical data. We defined simple rules for
processing the sensor data for recognizing wrong sitting postures. The data from smart chairs are collected by a private cloud
solution from QNAP and are stored in the MongoDB database. We used the Node-RED application for the whole
logic implementation.
Microsoft Kinect camera to recognize human activity and of the application solution of the microcontroller and its
rehabilitation. His research focuses on monitoring elderly communication with the server. We will also focus on the
humans. He modeled 6 different exercises and consequent server side based on the QIoT Suite cloud solution. QIoT
positions, of which 4 of them were in sitting poses. He used features MQTT gateways, Node-RED application, and
the properties of Kinect to skeletonize the figure from the MongoDB database. In this section, we will describe the
stereo image. Using a video system, Kuo [6] monitored the carried out experiments and explain the algorithm for the
correct posture of the head against the body and spine in the detection of sitting posture correctness. The last part of the
sitting position. Placing the reflective markers on the human system is a client application. It is a smartphone application
body around the head, neck, and spine simplified video for communication with a smart chair. It provides a fun-
signal analysis. The markers detection provides data for damental interaction with the smart chair. We describe here
further estimates of the angles of curvature of the spine in the the concept of the communication protocol between the
neck and cervical spine. client and the server.
Systems using wearable sensors or intelligent clothing
have several advantages over image-based systems. They are 2. System Concept Proposal
usually easily portable and independent of the angle of view
like camera systems. The sensor either is part of the clothing In our system proposal, we were focusing on creating a
or can be easily attached to the clothing. Other types of practical smart system for sitting posture detection in the
sensors can even be placed directly on human skin. Ailneni office. Our primary goal is to design a system, which could be
[7] used a wearable posture correction sensor to improve easy to implement in any office space where the person does
posture while sitting. The sensor detects postures and gives not have to use the same chair every day. Figure 1 illustrates
the user feedback in the form of vibrations. He claims that he the proposal of the system concept. The overall system
can improve the posture of a man working in the office in consists of a variable number of chairs, the cloud server, and
about 25 days. The sensors are located on the head and the client stations, smartphones. Each chair has an electronic
neck; the system reacts to incorrect head-neck position by device based on the Arduino microcontroller, external
light vibrations. Bismas [8] proposed the 3 systems for battery power source, and six flexible force sensors. The
monitoring health and wellness through wearable and network-attached storage from QNAP holds the cloud so-
ambient sensors. The system is focusing on the activity lution. It features the Message Queuing Telemetry Transport
monitoring of older people with incipient dementia. He (MQTT) broker for communication, Node-RED for the
designed a comprehensive sensor system that collects data logic, and Mongo database for data storage.
from several sources located not only on the wearables but The daily routine for the people working in our smart
also around the living area. Analyzed data from the sensors office should be as follows:
can manage processes, for example, automatic help calling. The person chooses a free chair in the office and sits
Otoda [9] designed the Census sensory chair, which can down. The Arduino hardware will wake up from sleep
classify 18 types of sitting positions. The chair has 8 ac- at this point and connect to the cloud.
celerometers. The author states an 80% success rate of sitting
The person turns on the mobile application and logs in
position classification. Zemp et al. [10] used several sensors.
to the chair. Each smart chair has an identification
They equipped an ordinary office chair with their custom
number to login. The information about the sitting
module for motion detection. The module consists of an
posture with additional data is displayed in the
accelerometer, gyroscope, and magnetometer. Comparison
smartphone application.
to [9], they placed this module on the back of the chair and
placed several pressure sensors on the backrest. These After finishing the work, the person logs out from the
sensors respond by changing the resistance depending on chair. Finally, you can view the daily report.
the pressure. It is interesting in this work that they tried to The following sections describe the individual parts of
analyze the measured data with various pattern recognition the system in more detail.
algorithms. They compared the following algorithms: Sup-
port Vector Machine (SVM), Multinomial Regression 3. Smart Chair Hardware Design
(MNR), Boosting, Neural Networks (NN), Radial Basis NN,
Random Forest (RF), and their various configurations. The To made a smart chair capable of measuring the pressure of
combination of 3 methods, Boosting, NN, and RF, has the sitting person, it was necessary to embed the force sensor
reached in this experiment the best results. Huang [11] into the regular office chair. The six single-zone force-
developed a piezoresistive sensor matrix with a thickness of sensing resistors FSR402 are used to measure the force. The
0.255 mm, which can monitor the way of sitting by a resistance of the sensors decreases with increasing force.
noninvasive method. The sensor field consists of two layers Measured resistance changes from tens of kOhm to hun-
of polyester film. dreds of ohms. The sensor does not need calibration before
The next section will deal with the concept of the whole or between the measurements. The seat is equipped with 4
system and how to implement it in the office room. The sensors and the backrest with 2 sensors. The appropriate
consequent section deals with the description of the sensor positions are found empirically. The sensors are
microcontroller hardware solution implemented in the under the lining, so they are not visible to the user. We use
chair. In Arduino Software section, we describe the concept the NodeMCU microcontroller based on the Arduino board
Mobile Information Systems 3
R1 QIoT Suite
MQTT MQTT Chair-
MQTT
22K NodeMCU
Node-RED
1
2
3
4 MongoDB
1 30 5 Mobile application
A0 D0
2 GND D1 29 6
3 VV D2 28 7 Figure 4: The system communication chain.
4 S3 D3 27 8
5 S2 D4 26
6 S1 3V 25 BOTTOM
4.1. QIoT Suite Lite. QIoT Suite Lite is a complete and
NodeMCU
7 SC GND 24
8 S0 D5 23 practical IoT private cloud platform for building and
9 SK D6 22
10 GND D7 21 1 managing IoT applications. QIoT Suite leverages popular
11 3V D8 20 2 tools like Node-RED and Freebord to create an IoT envi-
12 EN RX 19 3
13 RST TX 18 4 ronment easily and helps in efficient IoT development cases.
14 17
15
GND GND
16
It supports multiple protocols such as MQTT, Hypertext
VIN 3V BACK
Transfer Protocol (HTTP), and Constrained Application
Figure 2: Hardware schematic with NodeMCU. Protocol (CoAp). It allows us to simply create multiple
dashboards and quickly connect them with multiple sensors.
QIoT Suite also supports MQTT’s and HTTP’s security
Start layers on the protocol for secure network connections. The
suite was designed to shorten the IoT application design
lifecycle and its deployment. By default, the suite provides a
quick setup wizard to assist in creating IoT applications. It is
Variable definition also possible to use prepared codes of Python or Node.js on
and initialization
starting kits such as Arduino Yun, Raspberry Pi, Intel
Edison, or MTK Linklt Smart 7688. For using other kits or
use a custom source code database, it is necessary to create
Setup IO, custom Thing. The QIoT home screen is shown in Figure 5.
serial and WiFi The left side of the screen provides a link to other pages.
The mainframe of the screen provides links to IoT appli-
cations, Things and Things types, and their total number.
Yes WiFi The quick setup wizard is also accessible from the main
connected? screen. It is possible to create IoT applications using a quick
setup wizard or custom step by step. The custom IoT ap-
No plication requires at the beginning only identification name.
Wait 1 s MQTT connect The core application is complete after the confirmation. The
and subscribe Wait 5 s details of our smart IoT system application for sitting
posture detection are shown in Figure 6.
There are three tabs on this screen, providing links to
No MQTT application dashboard, rule engine, and Things. Figure 6
connected ? shows the table with the active Things for this application.
There are two different types of Things in our application:
No General Thing type for mobile applications
Read subscription Sending
sending enabled enabled
The chair types
Yes The general type is only one in the system where the
mobile application uses this credential to log in to the MQTT
Yes broker. The second type is for the chairs. Each chair in the
system needs to have a unique record in Things. In the QIoT
No Sending Measure and Suite, each Thing has its topic on the MQTT broker created
successful send data automatically with the Thing creation. The topic looks like
“qiot/things/Matuska/chairDuino1,” where chairDuino1 is
Figure 3: NodeMcu source code flowchart. the Thing name. The Representational State Transfer (REST)
application programming interface (API) is also available for
measured data to the cloud. Data are processed via Node- each Thing to fetch the data using the HTTP protocol. Each
RED, stored into MongoDB, and then sent to the mobile Thing can define one or more “resources.” These resources
application. More details and communication descriptions could be sensors, peripheral, switch, or another data
of the mobile application will be in Mobile Application channel/state that needs to be transmitted or received.
section. Adding a resource means creating the data channel ID
Mobile Information Systems 5
(MQTT ⟶ topic, HTTP, and CoAP ⟶ URL) to connect The main advantage of the resources is that they could be
with QIoT Suite Lite. Using QIoT Graphical User Interface implemented in a few steps as a dashboard gadget and are
(GUI), it is possible to generate JSON configuration file automatically stored in the MongoDB database if this da-
different connection types (MQTT, HTTP, or CoAP) for tabase is configured. The resource can be imported to the
particular Thing. This file can be used with prepared codes to dashboard using the rule engine QBroker. There are two
accelerate and simplify the Thing deployment. The example methods to use QBroker:
of this file is shown as follows:
Importing data from the resource
{ Importing data from the rule engine
“
username”: “generated_username”,
“
After a few steps, the resource value will appear on the
myqnapcloudHost”: “Not Available”, dashboard. The dashboard supports different kinds of wid-
“
clientId”: “chairDuino1_1601447263″”, gets, such as text, gauge, sparkline, pointer, indicator, action
“
host”: [ widget, or QIoT historic chart. The third tab is the rule engine
“ based on Node-RED and features a flow editor to simplify IoT
IP address”
development. There are four customized QIoT nodes:
],
“ QDashboard: it provides a live data API endpoint
password”: “generated_password”,
“ QBroker (in): it receives Thing data
port”: MQTT_port,
“ QBroker (out): it transmits Thing data
resources”: [
QHistoricData: it retrieves the maximum, minimum,
{ and average values stored in the database for defined
“
description”: ““, resources
“
datatype”: “String”,
“
resourceid”: “pressureData”, 4.2. Node-RED Application. The Node-RED application
“
topic”: “
qiot/things/Matuska/chairDuino1/ implements the logic part of the smart system for sitting
”
pressureData , posture detection on the private cloud platform. Such an
“
resourcename”: “Tlakove senzory”, application is usually splitting into the program Flows. There
“ are two main flows in our solution:
resourcetypename”: “Custom Sensor(String)”,
“
unit”: “bar” The flow for pressure data processing
} The flow for chairs and mobile application
management
]
} Figure 7 shows the schematic design of flow for chairs
and mobile application management.
6 Mobile Information Systems
1 - appStatus
connected
“
The flow starts with the QBroker in node. This input data”: [“6.04″”, “6.21″”, “7.80″”, “6.75″”, “2.21″”,
“
node listens on the topic “appLogin.” The purpose of this 1.35”]
flow is to manage chairs and mobile applications and there is }
only one common input node for all chairs and applications
in this flow. All data coming through the QBroker node have The next node “Sum pressure data” sums the pressure
to be in JSON format. The example of the expected JSON data and adds the message timestamp in Unix format. The
response data is as follows: message is routed in the switch node based on the chair
identification. The next node “Chair ID statistic” is the
{ most important in the system. In this node, the function
“
chairId”: 1, implements the whole logic for bad sitting posture de-
“
query”:”login” tection. The QBroker out is implemented for each chair
with the topic “chairs/ch1/appData,” where ch1 is chair
}
identification number. The WebSocket node is also
The chairId specifies the identification number of the implemented with URL “/ws/ch1/appData.” The same
chair. The tag “query” represents the performed action. The message is sent via MQTT QBroker and WebSocket.
action could be “login” or “logout” action to the chair. The Websocket is implemented because we expect further
message is routed in the switch node depending on the chair communication with the client application. The sent
identification number “chairId.” Then the system checks if message structure is as follows:
the selected chair is unoccupied. The function for checking
{
the chair state adds an attribute to the message about the “
operation success. The message with the response is then chairId”:1,
“
sent to the mobile application via the QBroker out node on data”:[“5.63″”,”5.70″”,”5.61″”,”5.51″”,”2.64″”,”5.71”],
the topic “chairs/ch1/appStatus.” The message is also router “
sum”:30.80,
via another switch, which evaluates if the added attribute is “
actual_time”:1601455127,
true or false. If the added attribute is true, the command “
message is sent to the chair using the topic “chairs/ch1/ avg”:5.612500000000001,
“
sendingEnabled.” The sent message contains a command to deviation”:0.00461875,
start or stop sending the pressure data. There are two “
chdata”:{
QBroker out nodes for each chair. If there is a request for “
adding a new chair to the system, it is necessary to copy the actual_sitting_state”:”green”,
“
whole block for the chair and change the topic name avg_deviation”:0.0070274999999999825,
“
according to the chair identification number. This could be avg_back_deviation”:2.790704999999999,
done easily with a few steps. Figure 8 shows the flow for “
chair_id”:1,
pressure data processing. “
The flow starts with the QBroker in the node. This input actual_sitting_time”:45,
“
node listens on the topic “chairPressureData.” The purpose back_data_present”:1,
“
of this flow is to collect, evaluate, and propagate the chair long_sitting”:0,
pressure data. There is only one common input node for all “
duration”:1358,
chairs in this flow. Only chairs publish the data on this topic. “
The example of sending data by “publish” command is as start_time”:1601453768.362,
“
follows: sitting_history”:[
{ {“timestamp”:1601455120.569,”sitting_status”:
“ 1},
chairId”:1,
Mobile Information Systems 7
Debug 1
ws app data 1
Sum pressure data Chair switch by id
Debug 2
Data storage
Chair 2 statistic 2 - appData
connected
connected
ws app data 2
Debug N
ws app data N
Start node
function
Variables and
chair data object
initialization
Pressure data
accumulation
No
Evaluate sitting
posture correctness
Return msg
end
connection form with the server address, communication has no connection to the chair. Figure 11(b) is displaying the
port, user login, password, and chair identification number. state when the MQTT link is open, but the chair is still not
The login activity is shown in Figure 11 with filled con- accessible. The current active client must release the chair to
nection data. make further connections. The client application allows only
The data from multiple chairs are stored on one server. one active connection per chair. If login to smart chair is
The successful connection to the MQTT server is followed by successful, the full chair image appears with its measured
automatic login to the selected chair. If the smart chair is parameters. The current sitting position is represented by the
occupying another person or chair is inactive at the time, in colors. Additional sound alerts signalize poor sitting pos-
such a case application is connected to the MQTT server but tures. The color representation is as follows:
10 Mobile Information Systems
State:
T:0 seconds
0.00 0.00
0.00 0.00
0.00 0.00
Report
Figure 11: The connection to the MQTT server and login to the chair: (a) Login activity, (b) succeed connection to MQTT server, and (c)
succeed logging to chair.
Green: the client is sitting in the correct position with login activity is the first screen that the user can see. He
an evenly distributed load. The unoccupied smart chair passes the login data to the MqttChair communication
is also green, with an additional title “Free,” as shown in module. This module uses the MQTT communication
Figure 11(c). protocol services with the help of the “eclipse/paho.mqt-
Orange: the participant is sitting, but his weight is not t.android” library. The inputs to the module are the login
distributing evenly. data to connect the server and the necessary user and chair
identification. First, it ensures the establishment of a con-
Red: the participant is sitting in an unhealthy sitting
nection with the MQTT server. The entire communication
position. This position is signalizing an excessive load
takes place asynchronously since it is event-controlled. After
on one side. This condition may also occur when the
successfully connecting to the server, it subscribes to the
client sits continuously for more than an hour.
subscription, whether the chair is available SUB-
The first color scale panel to the left of the chair rep- SCRIBE_LOGIN. Subsequently, a request to join the
resents the measuring range, in Figure 12, where the green PUBLISH_LOGIN chair is published. Availability LOGI-
color is the lowest pressure, and the red is the highest N_ACK returns information about whether the smart chair
pressure. The second single color panel to the right of the is occupied by another participant. If the smart chair is
chair picture represents the basic sitting state {green, orange, unoccupied, the module MqttChair subscribes to collecting
or red}. The circles represent sensor positions, and their chair data using SUBSCRIBE_DATA. The new data is re-
color depends on the pressure, following the color palette. In ceived via the call-back function.
the middle is a symbolic representation of a chair. The The communication ends when the user requests a
numbers (no units) are pressure measurements that express logout action, or the connection is unexpectedly broken. The
the intensity of the load. The color of individual points is standard way is to send the message PUBLISH_LOGOUT
adjusting according to the current load. Figure 12(a) rep- and consequently disconnect from the MQTT server. The
resents an evenly distributed body weight on the pressure response to logout action is an acknowledgment of LOG-
sensors following the orange state. After transferring the OUT_ACK. The communication with the server is user
scale to one side of the chair, the system detects the incorrect terminated by sending a message DISCONNECT and
position of Figure 12(b), seating condition (condition or- subsequently confirmed by DISCONNECT_ACK. The
ange). In the orange state, the application plays a short quiet MQTT module provides an interface with two listener call-
tone (“elevator tone”). It unobtrusively alerts the user to the back functions. The first function onReport() returns a
wrong sitting position. In case when the user load distri- message designed to monitor traffic and generate events. The
bution is extreme, the state changes to the red state. The red second function onDataReceived() provides data received
state is signalizing by an annoying audio signal (alert tone). from the smart chair. To transfer chair data internally, the
The user has the option to turn the application of or move his ChairData object is used. The most user interaction is
body to a healthy sitting position to stop the annoying alarm. performed by the Monitor Activity. This activity represents
The bottom of the screen reports different events. The report the main GUI for the user, sends commands to the
can hold a history of sitting states, variety events, logging and MqttChair module, and receives data and messages using
connection issues, and debug information. MqttChair listeners. It provides basic functionality for user
Figure 13 shows the schematics of the mobile application login and logout actions. The Monitor Activity is also holder
and its communication with the MQTT server. The design of place for the ChairView widget. The ChairView widget is a
modules for communication with the MQTT server is module for displaying smart chair data. The input is the
considered to be a reusable code for further applications. The instance of the ChairData object. The document-view
Mobile Information Systems 11
Figure 12: The examples of sitting states: (a) green (standard sitting), (b) orange (bad sitting), and (c) red (heavy load for the backbone).
LOGIN MqttChair
ACTIVITY MODULE
Host
Port Connect
User
Pwd Connect ACK
chairId
Subscribe login
Logout ACK
Disconnect
Disconnect ACK
Figure 13: The communication between the mobile application and MQTT server.
12 Mobile Information Systems
architecture system is used, where the document is repre- possible to run our smart system on cheap hardware such as
sented by the ChairData object, and the view is displayed by Raspberry Pi with only minimal changes. The QIoT specific
the ChairView module. gateway must replace it with a regular MQTT gateway. It is
also necessary to install services like Mosquito MQTT
6. Discussion broker, standalone Node-RED application, and optional
MongoDB manually on Raspberry Pi.
The most crucial part of our proposed smart chair is the
hardware uptime without the need for a recharge. During Data Availability
the testing, we used the external power bank with a capacity
of 4000 mAh as the power source. With this external source, The source codes are available upon request to the corre-
our hardware can run up to 48 h of active measurement. For sponding author.
most of the day, the chair is not occupied and the NodeMCU
could enter the sleep mode and wake up only when someone Conflicts of Interest
is sitting on the chair. This will theoretically improve uptime
The authors declare that they have no conflicts of interest.
up to 12 days and thus can be used in a real application. The
other issue is implementing the force sensors into the chair.
This process is rather difficult and the implementation itself
Acknowledgments
takes some time. On the other hand, if we want to produce This work was supported by the European Union’s Horizon
the smart chair in numbers, it will be necessary to create a 2020 Research and Innovation Program under the Marie
more automated way. Software deployment on the server Skłodowska-Curie Grant agreement no. 734331 and by the
side is easy and straightforward and while it can run on as project “Competence Centre for Research and Development
cheap hardware as Rasberry Pi, it is also cost-effective. in the Field of Diagnostics and Therapy of Oncological
Overall, the proposed system is easy to implement. Diseases,” ITMS: 26220220153, cofunded from EU Sources
The user receives the notifications about the sitting and the European Regional Development Fund.
posture correctness on the mobile application on Android.
For Apple users, it is necessary to develop an application for References
iOS or use the multiplatform framework to write one ap-
plication for both platforms with a common codebase. Using [1] Vos, “GBD 2015 Disease and Injury Incidence and Prevalence
the information from the application users can adjust their Collaborators, “Global, Regional, and National Incident,
sitting customs and improve their health and well-being Prevalence, and Years Lived with Disability for 310 Diseases
easily. and Injuries, 1990-2015: A Systematic Analysis for the Global
Burden of Disease Study 2015,” The Lancet, vol. 388,
no. 10053, pp. 1545–1602, 2016.
7. Conclusions [2] H. Scott and K. Williams, “Impact of seating posture on user
comfort and typing performance for people with chronic low
This paper presents a smart IoT system for sitting posture back pain,” International Journal of Industrial Ergonomics,
detection based on force sensors and mobile applications. vol. 38, no. Issue 1, pp. 35–46, 2008.
Six flexible force sensors, two on the backrest and four on the [3] F. Tlili, R. Haddad, Y. Ouakrim, R. Bouallegue, and
bottom seat, were embedded in the office chair. NodeMCU N. Mezghani, “A Survey on Sitting Posture Monitoring
board was used to measure the sensor’s resistance and sends Systems,” in Proceedings of the 2018 9th International Sym-
the data to the cloud using the MQTT protocol. The data are posium On Signal, Image, Video And Communications
stored and evaluated on the cloud using Node-RED and (ISIVC), pp. 185–190, Rabat, Morocco, November 2018.
MongoDB. The user can see the information about sitting [4] S. SathyanarayanaR. K. Satzoda et al., “Vision-based patient
monitoring: a comprehensive review of algorithms and
posture correctness and other pieces of detailed information
technologies,” Journal of Ambient Intelligence and Humanized
in the mobile application. Our goal was to create simple rules Computing, vol. 9, no. 2, pp. 225–251, 2018.
to detect correct sitting posture in the term of minimal [5] Š. Sathyanarayana et al., “Accuracy and Robustness of Kinect
computation power requirements. We defined 9 sitting Pose Estimation in the Context of Coaching of Elderly
postures and carried out experiments on 12 people to Population,” in Proceedings of the 2012 Annual International
identify the rules. The standard deviation from the bottom Conference Of the IEEE Engineering In Medicine and Biology
seat sensors shows a strong dependence on sitting postures. Society, pp. 1188–1193, San Diego, CA, USA, August 2012.
The calculation of the standard deviation is not hard for [6] Y.-L. Kuo, E. A. Tully, and M. P. Galea, “Video analysis of
computing power. Based on our observation, we divided the sagittal spinal posture in healthy young and older adults,”
sitting posture correctness into three groups, namely, green, Journal of Manipulative and Physiological Therapeutics,
orange, and red, and defined the three threshold values. We vol. 32, no. 3, pp. 210–215, 2009.
[7] R. C. Ailneni, K. R. Syamala, Kartheek, I.-S. Kim, and
used these threshold values for the evaluation of the sitting
J. Hwang, “Influence of the wearable posture correction sensor
posture into one of the three groups. The system also cal- on head and neck posture: Sitting and standing workstations,”
culates the time of sitting without a break and informs the Work, vol. 62, pp. 27–35, 2019.
user in the case of long-term continuous sitting. We deploy [8] J. Biswas, A. Tolstikov, M. Jayachandran et al., “Health and
our solution on the network-attached storage from QNAP. wellness monitoring through wearable and ambient sensors:
But because of the evaluation algorithm simplicity, it is exemplars from home-based care of elderly with mild
Mobile Information Systems 13