Introduction

In the records of recent past death rates of humans due to improper dosage of medication are reasonably greater and have been increasing every passing year. This rate could be brought down by detecting and tweaking the percentage of medical faults instigated. The recent improvement made in the field of healthcare has been providing a betterment in human life. Medical devices working on software programs overcome a lot of issues pertaining to network problems, security, inconvenient to perform operate on different devices or upgraded devices and so on. To overcome these issues consumer-based technologies and automations are being implemented for health care machines. With evolving technology, medicine and healthcare has become one of the main areas of interest in IoT. Aim of usage of IoT and embedded devices is to enhance the efficiency of the system, make it user-friendly and provide a better operational experience based on one’s needs or requirements. The field of medicine has adapted these new emerging applications and frameworks to provide security and service with the help of IoT. Its main purpose is to design a compact device such that it is patient friendly and easy to use without technological complications.

Literature Survey

Authors [1] provide a user-friendly design to operate and troubleshoot any problems faced during the usage of the device with an intelligent chat assistant. Non-adherence in the field of medicine is a critical factor; SPES also helps in live tracking and analysis of the medication history of the patient and tried to reduce the ambiguous dosage consumptions. Authors [2] specially designed and modeled to meet the needs of the elders and visually impaired beings to maintain and manage their medicine consumption pattern. This feature is presented by offering an approach to sort their daily medicine cycle. In addition, the device is programmed to give out alerts when a person must consume his dosage. Authors [3] programmed to give buzzer notifications along with LED lights to users indicating their medicine consumption time. This is an upgrade that has been made for healthy world. The IoT-based medicine container [4] has various features along with the sensors to supervisor health check-ups. It also has a temperature sensor to monitor the patient’s body temperature along with wireless communication facility between the patient and the caretaker. Authors [5] state about how effectively can food pattern be observed and maintained through a pet feeder machine. Here, the dry pet food has been pre-stored by the owner of the pet and is customized for certain time intervals to feed their pets. The system [6] can be regulated through phone or by use of buttons on the device and set time intervals for medicine intake. It also sends text messages to indicate if the tablets were pickup from the container box at the given time period or not helping the care-taker to track the consumption of the medicines. System [7] is similar to the system described by authors [6] with advanced options of security provided to the device to prevent kids unintentional consumption of the tablets when at households. This device is designed such that it reads the prescription and sets its time intervals or respective drugs. The use of “Blynk” mobile application [8] improvises the automations of the device that had have more user control over the network. All actions performed by the device are monitored through the application like dispensing the drug, opening the valve for drug consumption, etc. Authors [9] use Instapush feature for providing notifications to cell phones along with microcontrollers and infrared sensors to monitor medicine consumption. The designing and development described by Authors [10] was a very crucial and all components were interlinked. Thus, failure of a single component would lead to failure of the complete system. There was a precise methodology incorporated to enhance the model and reduce the number of failures and is presented in the IEC62304 guidelines. This also helped in enhancing the medical dispenser’s probability of function right. Based on TOPSIS, In [11], a workflow scheduling method for cloud computing has been proposed. This method involves selecting the most suitable virtual machine for each task, achieved through the utilization of the TOPSIS approach. We have considered a cloud system with DVS and heterogeneous VM instances that are based on pay-per-use. The MIPS (Million Instructions Per Second) of the virtual machine (VM) instances used in the experiment is directly correlated with the VM price. Kumar et al. [12] states a projection model-based approach to risk evaluation and decision-making for information system assets is suggested, and it is utilized to address the MADM issue where the evaluation index value is an IVIFN and the index weight is unknowable.

In [13], the decision-making process regarding the prioritization of pipe network improvement projects for replacement and rehabilitation is influenced by the age of pipe installation. The study evaluated the economic efficiency of these renovation projects, considering multiple factors associated with non-revenue water (NRW), including pipe deterioration and demand energy ratio [14]. The proposed approach can eliminate the issues that arose when utilizing CCR, such as many optimal solutions occurring and DMUs that cannot be fully sorted, as well as avoid the over-subjective evaluation matrix in the AHP. The suggested approach is therefore more logical and scientific than some of the existing approaches. The research discussed in [15] demonstrates the implementation of a mixed performance measurement approach, which involves combining game theory with the balanced scorecard methodology. This integration enables players or perspectives to optimize their rewards while striving to achieve equilibrium by selecting the most efficient methods available. The outcomes indicate that the proposed model efficiently selects the appropriate set of indicators and the balanced scorecard's equilibrium point, resulting in cost minimization and maximizing returns for the perspectives, all achieved without the need for laborious mathematical computations. In [16], the study demonstrates the application of a hybrid algorithm to create an ensemble technique for short-term load forecasting (STLF) in a wind energy system. Combining deep neural network (DNN) and chicken swarm optimization (CSO), the hybrid method combines these two techniques. The New England ISO provides 24-h demand data for the wind energy system, which is first used to train the DNN network and analyze load forecasting. In [17], the research is centered around multivariate time-series data gathered from diverse fields. The study proposes a bi-directional long short-term memory (LSTM) model that considers the unique properties of these fields. Unlike existing models, this new approach involves splitting the data input into the input layer, allowing the model to learn distinct features from each field. Additionally, the study aims to simultaneously learn the data's value and its variations, enabling the model to grasp the trend of the time series data effectively. Deep neural networks were used to develop two decision-making approaches in [18] for the Spares reserve that address the issue of too many subjective elements in comparison with more conventional approaches like fuzzy comprehensive assessment, grey evaluation, and hierarchical analysis. These techniques frequently have the drawbacks of difficult calculation and significant subjectivity in determining the index weight vector.

In [19], the study introduces the incorporation of graph convolutional networks (GCNs) into the Transformer architecture. This addition aims to train and consider dependencies at a more detailed level, thereby addressing the dynamics of changing dependencies more effectively. Furthermore, the researchers include the temporal convolutional network (TCN) as a component of the self-attention layer to tackle the local insensitivity issues of the Transformer model. This combined approach aims to enhance the model's ability to capture complex patterns and dependencies in the data, improving its overall performance. The Dombi aggregation operators for spherical fuzzy sets are effectively studied and introduced in [20]. Additionally mentioned and examined are the fundamental characteristics of spherical fuzzy Dombi operators. Then, after examining the drawbacks and benefits of the prior literature, we present a novel method for solving the decision-making problem based on the suggested Dombi aggregation operators. Additionally, the decision method's decision-making processes were built. The suggested method will solely use data from the choice problem to produce an objective decision result. In [21], cluster approaches are employed to develop an ANFIS-based reconstruction method for multifunctional sensing. By using cluster analysis to the experimental data with subtractive clustering, the structure of the produced ANFIS may be adaptively recognized. In-depth analysis of the fuzzy MCDM-based WS selection techniques discussed in the [22]. It then categorizes the studied schemes in accordance with the used fuzzy MCDM approaches, illustrative of the background information regarding the WS selection. It outlines their primary contributions and describes how, during the WS selection process, they employed MCDM methods, particularly the fuzzy ones, to rank the WS and select the best one. In [23], the study suggests the use of emerging tools such as the wavelet transform (WT), adaptive autoregressive modeling (AARM), and vector machines (VMs) like the support vector machine (SVM) and relevance vector machine (RVM) for different purposes. WT is recommended for pre-processing due to its improved time–frequency resolution, while AARM is suitable for feature extraction as it can capture characteristics that change over time, allowing measurement of time-varying spectra. VMs, specifically SVM and RVM, are proposed for classification tasks as they effectively model nonlinear data Additionally, [24] focuses on creating an innovative hybrid model designed to predict sugarcane yield using nonlinear time series data. The study utilizes recurrent neural networks (RNNs) due to their extensive memory capabilities, which enable reliable forecasts with fewer parameters. To enhance the efficiency and accuracy of the RNN, the researchers improve its weights and thresholds using the whale optimization method. This hybrid approach is designed to produce more accurate results and increase the overall efficiency of the neural network in predicting sugarcane yield. It might be difficult to steadily improve performance when predicting time series volatility. WOARNN-GARCH, RNN-GARCH, and BPNN-GARCH are three hybrid models.

By taking into account meteorological conditions (temperature, humidity, and pressure), in [25], the study demonstrates the effectiveness of a hybrid 3-level wavelet transform extreme learning machine for short-term (a day ahead) and medium-term (a season ahead) load forecasting. This hybrid approach proves to be efficient in predicting both short-term and medium-term loads with improved accuracy. The Extreme Learning Machine (ELM) is trained and tested using data that has been separated into multiple frequency components through the utilization of Wavelet Transform (WT) on load and weather data. This approach allows for improved load forecasting performance, making it suitable for both short-term and medium-term predictions. Investigating pertinent ELM weights and biases improves the performance of the proposed technique. Travel routes are defined with operational efficiency in mind, which is not always connected to the passenger experience in [26]. The topic of how flexible the passenger transportation options now offered by the sector are raised as a result.

As far as our knowledge goes, there have been no prior proposals that integrate artificial emotions into cognitive agents employed in the context of flexible passenger transportation. This novel approach aims to equip these agents with the ability to independently reason and make decisions, taking into account both objective factors (such as travel time or cost) and subjective variables (such as emotions and passenger satisfaction) within a unified and integrated layer, using individual traveler and passenger profiles. This novel approach would enable these agents to independently reason and make decisions, considering both objective factors like travel time and cost, as well as subjective variables such as emotions and passenger satisfaction, all within a unified and integrated layer. The system would be designed to leverage traveler and passenger profiles, ensuring a personalized and efficient travel experience that takes into account individual preferences and emotions, alongside practical considerations. Comparative Analysis Study.

The following comparative analysis was conducted based on the kind of technology that was used and implemented in the products. There is also an analysis provided for the currently available dispensers in the market. An overall conclusion can be brought after comparison of the features and limitations provided for each technology-based system in Table 1.

Table 1 Technology-based comparison

Sensor-based systems [27,28,29,30] detect the operation of medicine compartments, mobile application integration, antibacterial, portability, battery life and accuracy to detect the medication is very low. Visibility- based systems [31, 32] operate with the help of antenna and senses the open and close of the compartments, requires group of detectors for validation. There are lot of assumptions made regarding medicines that are self-sorted. Vision-based systems [31, 33] require good camera resolution to recognize movements. The placement of the camera is very critical and is presumed to monitor the medication region and analyses the usual and unusual medication behaviors via hand gestures.

Philips' Pill Dispenser [34] offers various features, including fall detection and a flexible monthly payment option based on usage rates. The device has been enhanced from its previous model, boasting an elegant and compact design. It allows users to customize their service plans according to their specific needs. Additionally, the gadget integrates with a mobile app to facilitate seamless communication between the user and their caregiver, streamlining coordination and ensuring efficient assistance. This combination of advanced features and user-friendly design makes the Philips' Pill Dispenser a comprehensive and convenient solution for medication management and care. Waterproof designing has been implemented for a better and efficient life cycle. A good battery life with customer care services is a plus point for this model. Hero’s Pill Dispenser[20, 21]provides flexible programming of up to 10 various medicines for everyday consumption. The device caters for a 90-day period with predefined intervals for medicine dispensing. These are not dependent on the shape or size of the medicine. Audible and visible alarm alerts [22, 23] are provided for missed dosages along with security notifications. It is the most affordable option that never runs out and has a pay per plan service[35].

Implementation

The proposed design approach of SPEC 2.0 is formulated in 4 stages: Architecture Design, Proposed System Block Diagram, System implementation and Testing.

Architecture Design

The architecture of the proposed system can be viewed as a top view and a dispensing view. The top view shows the closed rectangular structure that houses the medication. This structure has a plastic covering that can be opened for filling the medications based on the user’s requirements. Here are 3 compartments in which there are 2 time slots (Day” D” and Night” N”/Morning “M” and Evening “E”). There is a dummy compartment that is placed at the opening mouth of the structure for pill dispensing. The structure rotates anticlockwise, starting from the empty compartment. There is an alarm buzzer mounted, and top view is shown in Fig. 1. The dispensing view illustrated in Fig. 2 shows the actual working of the dispensing mechanism of the system. The rectangular structure is mounted on top of the structure. Below this, there is a container box that acts as the pill box which has a flap mechanism powered by a DC motor employed for the over-dosage event handling.

Fig. 1
figure 1

Top view

Fig. 2
figure 2

Dispensing view

This sits on top of the compartment containing the over-dosage container.

Block Diagram

Here, we are using Renesas microcontroller which sends command to the L293D Motor Driver. It is a motor driver used by microcontrollers to automate driving the DC motors. This motor driver drives 2 motors in our case. The 1st DC motor connected to the pill container is used to rotate the pill container in the clockwise direction according to medicine’s timings. The 2nd DC motor is connected to the Dispense; its function is to drop the dispensed medicine to the overdose pill container as a safety measure if the medicine is not consumed within the stipulated time limit. For the working of the 2nd DC motor, we are using IR obstacle sensor, and it is used to check whether the medicine has been taken by the user or not from the dispenser box. Block diagram is shown in Fig. 3.

Fig. 3
figure 3

Block diagram of SPEC 2.0

To make all the above-mentioned functionality possible, we have an android application for the user to operate the product like they can set alarms and check their previous medical history. For obtaining the connection between the android application and microcontroller, we have used GSM module, and data transfer between app and GSM module is uni-directional.

To maintain the medical history, we are using a database server, which is interacting with the android app in a uni-directional manner. Through the LCD, any data can be displayed to the users. Through the buzzer, at the time of dispensing, it is used as an alarm for the user.

Implementation

Since the proposed system is a prototype, we are mainly focusing on 4 events for a single day. The 4 main events are filling up medication in the system, setting up the time interval through the mobile application, dispensing and taking care of over-dosage medication. There are a number of significant factors that must be taken into account while conducting data analysis for the smart pill dispenser model mentioned above:

  • Data Accuracy It is critical to make sure that the information gathered from the dispenser is accurate. Any inconsistencies or mistakes in the data that were recorded could result in inaccurate analysis and perhaps negative effects for the patients. To accurately record information on the distribution of medications and user behavior, it is critical to have trustworthy procedures in place.

  • Data Privacy and Security Due to the sensitive nature of personal health information, strong security and privacy precautions must be taken. Data gathered by the dispenser and communicated to the analysis system should be protected by appropriate protocols and encryption techniques.

  • Data Volume and Variety The smart pill dispenser produces a lot of information about the administration of medications, user behavior, and system performance. Managing and interpreting this much data can be difficult. Additionally, the data may originate from several sources or be in a variety of formats, necessitating the use of appropriate methodologies for data integration and analysis.

  • Real-Time Analysis To identify anomalies or patterns that need rapid attention in a healthcare context, real-time analysis is frequently essential. The data analysis system should be able to process and analyze data in real-time to quickly spot any possible problems or faults with medicine delivery.

  • Predictive Analytics Using predictive analytics can be helpful in seeing patterns or trends about medication adherence, potential hazards, or negative effects. In order to examine historical data and anticipate future events, this calls for sophisticated algorithms and machine learning approaches.

Data interpretation and practical knowledge: Data analysis should not only concentrate on spotting trends but also offer practical knowledge to healthcare professionals or carers. The information should be presented by the data analysis system in a relevant fashion, emphasizing any possible problems or suggestions for suitable remedies.

By addressing these problems, the smart pill dispenser system will be more effective and dependable, enabling accurate data analysis and reducing the possibility of medication errors that could have serious negative effects on patients.

Filling Medication

There is a closed rectangular design. We are not adopting a matrix design with rows and columns since each compartment will then require a stepper interface for pill dispensing, increasing the number of hardware components. There is a single hollow opening cut out at the front in the design for pill dispensing. There will be an outer circular plastic cover given for the head that can be opened/ closed for filling up the medication to providing safety of no sharp edges. The Doctor’s prescription usually revolves around 2-time frames Morning-Evening/Day-Night for a day. Each time frame has a predefined time interval to indicate the same like M–12 AM to 1 PM E–2 PM to 11:59 PM, but based on the user’s preferences of his medication intake, it will be varied. The user can set his own time interval duration in the predefined time frame for medication dispensing There are 3 compartments that are linearly placed next to each other. So, we will have 2 compartments that indicate a day with 2 intervals like D1M, D1E. To provide easy usability and better understanding, the compartment will have markings of D1M, D1E in the bottom. There is another compartment that is left empty to indicate the initial starting point setup of the system. The buzzer will be set off when the pill dispensing event occurs. An SMS will also be sent to the registered mobile number for both the results of the pill dispensing event (Medicine Consumed Medicine Not Consumed).

Setting Up the Alarm in the Mobile Application

The mobile application allows the user to set his time intervals for a given day based on his medication intake. The user would login in with his credentials (username, password). If the user has already registered his mobile number, he can directly set his alarms. Else, the user will also have to register his phone number for availing the SMS service. With the predefined time intervals, the user can select a given date and alarm time for his morning evening medication. There will be an ON/OFF button provided for each time interval. Once the ON button has been selected, the data (day, time) will be stored in the database and will be sent as a SMS to the SPEC 2.0. These data need to be accurate and can be set well ahead in time or at the present time. Once the pill dispensing event occurs, the status (Medicine Consumed Medicine Not Consumed) will also be appended stored in the database. These data can be viewed under “View Data” screen.

Dispensing Mechanism

The medication housing is placed on top of the final container box that houses the dispensed medication. Based on the alarm time slot selected by the user for a given day and given time in the time interval through the android application, an SMS will be sent to the hardware component and in turn to the DC motor to rotate and access the required compartment. An alarm beep will be sounded on the activation of the pill dispensing event. When the compartment is accessed at the hollow opening cut, due to gravity and force, the medication directly drops downward into the final container box. An SMS will be sent to the registered phone number of the user to report the same. This container box will provide a flap mechanism with a DC Motor for the over-dosage event. The flap mechanism is deployed vertically at the end of the box that will open its flaps downward.

Over-Dosage Event

Based on the predefined time du- ration threshold (¿ = 10 s), a medication is deemed overdosed if the user does not remove them from the container box, which is handled by the IR Obstacle Sensor. In that case, the box activates the flap mechanism through the DC motor that will drop the medication downwards to another container called “over-dosage container,” that is lying exactly under the final medicine compartment box, used for the storage of over-dosage medication. A SMS will be sent to the user to report the same.

System Implementation

The implementation has been broken down into 4 modules—hardware setup, software setup, integration of hardware software components and design structure. Hardware implementation includes embedded C programming with the MC components. The hardware setup involves programming of the Renesas Microcontroller with the LCD, Buzzer, IR obstacle sensor, L293 Driver circuit to in turn operate the DC motor, analog-to-digital converter and GSM module. The IR obstacle sensor is attached to the MC at the Input Port 3. The DC motors that are responsible for accessing the medicine compartment and for the over-dosage event are placed at Output Port 5. The buzzer is also mounted at the Output Port 5. A/D Convertor pins ANI0–ANI4 are assigned as analog input. Serial transmission channels UART0 UART1 are used for both transmission receival with a baud rate of 9600 bps transfer rate. Software implementation involves the design of android mobile application. The android mobile application is built with android stack using JDK. Eclipse was used to provide a common user interface (UI) model for working with tools using the ADT plugin as an integrated environment. For testing the android application, android software development tool is used which provides a platform to develop, test and debug the developed application. The application has 5 screens—Login, Home Page, Register GSM number, Set Alarm and View Data. The user logins with his username password. The Home Page consists of options to navigate to the other 3 screens. Register GSM number page asks the user to register his phone number for receiving SMS. Set Alarm screen allows the user to select his day-time alarm for his pills to be dispensed. There are ON/OFF buttons provided for the morning evening slots. View Data provides a consolidated view of the number of transactions of the pill dispensing events. It has 4 columns – Dates, Times, Status and Action. Dates Times indicate the user’s selected day-time slot. Status is either “Medicine consumed”/“Medicine not consumed.” Action can be used to delete a particular event. Integration involves connection of the MC hardware to the android app. This involves setting up the GSM functionality of sending SMS containing the daytime from the android app to the hardware. The hardware’s GSM Module receives the SMS sent to it (GSM module has its own SIM Card for receiving sending SMS). Based on the daytime received, the DC motor in the pill housing will move and access the compartment. Design structure involves building the outer and inner structures. The pill housing structure was created using a rectangular plastic box. The compartments were bifurcated using the remaining PCBs (4) mounted in the teeth of the DC motor at counts of 6 that is mounted centrally in the rectangular plastic box. In the rectangular plastic box, a hollow opening is cut out at the base for pill dispensing. Under this, there is another smaller rectangular plastic box that is screwed onto a clamp support, in turn to the other DC motor for the over-dosage event. This DC motor is mounted below the pill housing compartment that will flap up down. The whole product is mounted over a cardboard sheet that contains the circuitry and SPEC 2.0 structure.

Working Mechanism

A user fills up his prescribed medication for a day manually. To set his own customized alarm time at which the medication must be dispensed, he specifies the timing through the mobile application like for D1 Morning slot, he chooses the time interval for dispensing his medication to be at 9:00 AM. This information will be hosted locally on the device. When D1 arrives, at exactly 9 AM, an alarm beep is sounded and the compartment is accessed by the DC motor that moves a certain amount of distance. The medication drops down to the final container box, waiting for the user to remove them. If the user picks up the medicine, it is said to be “consumed” and an SMS is sent to the user to report the same. After 10 s or more, if the medicine is not removed, it is said to be “over- dosage”. At this event, the box activates its mechanism and drops down the medication to the over-dosage container and an SMS is sent to the user to report the same.

The DC Motor will remain in its position until the next time interval for D1 evening slot is triggered. The overall system flowchart and its BPMN diagram shown in Figs. 4 and 5 can be formulated.

Fig. 4
figure 4

Flowchart of SPEC 2.0

Fig. 5
figure 5

BPMN of SPEC 2.0

Drawbacks of the System

There are a number of noteworthy characteristics and restrictions with the smart pill expert system discussed in this article. First of all, it is intended to have just one user interface that caters to one person's needs at a time. As a result, the system can only be tailored for a single user to provide individualized medicine distribution and monitoring. The technology is primarily intended for the dispensing of tablets and pills, which brings us to our second point. Its application is restricted to solid pharmaceutical forms because it is unable to administer liquid syrups or tonics. It is also vital to note that the system does not have a backup battery for power. As a result, it needs to be recharged frequently and lacks a power backup option in case of power shortages or interruptions. Furthermore, the designed system does not have features for personal monitoring. It is unable to determine whether the user has truly swallowed the prescribed drug or whether they afterwards threw it up. The user is in charge of following the recommended medication schedule; the system cannot be held responsible for user neglect. Despite these drawbacks, the smart pill expert system still offers useful features like tailored prescription dispensing and timely reminders, which can help people manage their medication intake successfully.

Results

The overall SPEC 2.0 has been successfully built following up on the architecture and design. The mobile application has successfully been built and has been sent across to the Google Play Store. There are around 8 test cases that have been brought to light to test the working of the system—to check whether the morning slot has been accessed successfully and the medication has been dispensed, to check whether the database has been updated with the success of the user taking out the dispensed medication from the pill container box for the Morning slot and a SMS indicating the same, been successfully sent to the user, to check whether the Evening slot has been accesses successfully and the medication has accessed successfully and the medication has been dispensed, to check whether the database has been updated with the success of the user taking out the dispensed medication from the pill container box for the evening slot and a SMS indicating the same, has been successfully sent to the user, to check whether the Morning slot has been accessed successfully and the medication has been dispensed but the user has not taken them out from the pill container box, indicating “over-dosage” event, To check whether the database has been updated with the failure of the user taking out the dispensed medication from the pill container box for the Morning slot and a SMS indicating the same, has been successfully sent to the user, To check whether the evening slot has been accessed successfully and the medication has been dispensed, but the user has not taken them out from the pill container box, indicating “over-dosage” event and To check whether the database has been updated with the failure of the user taking out the dispensed medication from the pill container box for the Evening slot and a SMS indicating the same, has been successfully sent to the user. Figure 6 shows top view of SPEC 2.0.

Fig. 6
figure 6

SPEC 2.0. Top view

These test cases were used to properly assess the system's functionality and performance. The accuracy and functionality of the system were shown by the results from the testing phase plotted on an outcome graph. It was noted that the system's structure, which lacks a strong construction like a 3D-printed or wooden framework, may occasionally run into problems.

Additionally, a user's service provider may experience network connectivity issues that result in delays in the pill dispensing capability. Additionally, because the system lacks a backup battery, it is unable to work in the case of a sudden power outage. The overall accuracy and usefulness of the system were found to be about 90%, which represents a 5% improvement compared to existing systems, after taking into account these potential limits and use scenarios. The observed results were plotted as an outcome graph with respect to the system’s accuracy and functionality. Based on these results, the system sometimes fails to perform its functionalities as it is not designed with a sturdy structure like 3D printed or wood structure. Sometimes, due to the user’s network connectivity with his service provider, the network transmission might not be very efficient. So, there will be a bit of delay in the pill dispensing functionality. When there is a sudden power cut, the system stops working as it does not have a back-up battery. Considering all these use cases, based on the graph, the system provided overall 90% accuracy and functionality, a 5% increase from the existing systems shown in Figure 7. Dispensing view of SPEC 2.0., mobile app—home page and alarm setting page of system is shown in Fig. 8. Figure 9 shows view data page in SPEC 2.0. Figures 10 and 11 and show accuracy, performance graph and comparison of existing and proposed system.

Fig. 7
figure 7

SPEC 2.0. Dispensing view

Fig. 8
figure 8

SPEC 2.0 mobile app—home page and alarm setting page

Fig. 9
figure 9

SPEC 2.0 mobile app—view data page

Fig. 10
figure 10

Accuracy and performance graph of SPEC 2.0

Fig. 11
figure 11

Comparative analysis with existing systems

Conclusion

Increasing growth in number of affected people to a certain type of disease leads to carelessness of consuming right dosage of medication; this has turned out to be one of the vital issues in the field of medicine and healthcare. As a solution to this problem, we have designed the SPEC 2.0 to overcome issues like low reliability, non-expandability, lack of communication and inconvenience. This model is built with the help of microcontrollers and sensors with which the doctor’s prescription is examined and accordingly the medicines will be dispensed to the patient based on certain customizations. Advantages of this approach would be facilitating users to schedule or configure the medications, remote management, makes it much more scalable and reduces the cost management and one’s effort. To overcome the adherence of overdosage or underdosage of medicine, smart pill expert system 2.0 can be employed.

Conversely, it cannot prevent patient’s voluntary actions like throwing the medicine after it is dispensed for the system or faking that medicine was consumed. SPEC 2.0’s main goal is to ease life of people who consume medicines on daily basis and thus this device can be installed in hospitals and households branding it as an economical solution. The future enhancements that can be provided to this system can be usage of multiple users, housing of liquid medication, upgradation to 3 time slots—morning, afternoon and night, upgradation to 7 days of a week back-up battery power supply, integration of cloud services to facilitate easy access of data for a user’s doctor, 3D-printed outer structure, generation of reports for a particular user’s pill dispensing events and security feature of fingerprint or an open/close door mechanism.