RPi 3B+
For this project, we proceeded to use the Raspberry Pi 3B+. The RPi is a microprocessor-based mini computer with high processing power, thus it will contain the code for the graphical user interface (GUI) that users will interact with on the touchscreen, as well as code to send and receive information from the Arduino Mega.
PySimpleGUI
Initially, we were exploring the many different python packages available to create the GUI. Of the many options, we had 3 main ones in mind: pygame, tkinter and pysimpleGUI.
Attempt to use pygame with the 3.5″ touchscreen.
We chose to work with pysimpleGUI as it has wrapped portions of other existing packages in it (tkinter, pyQt, wxPython, Remi). The code required to set up a customized GUI is also much shorter using pysimpleGUI, optimizing the algorithm for quick user input and pill dispensing.
Design Considerations for the User Interface
Most pill dispensers that we found online are linked to phone apps, mainly for caregivers to key in the pill dispensing information (type of pill and dosage requirements). However, as we hope that our pill dispenser can enable the elderly to be more independent in taking their own medication, we envision having a touchscreen that is sufficiently big enough for the elderly and sufficiently straightforward for seniors to key in their inputs.
At first, we ordered a 3.5” capacitative touch screen, but we eventually settled on a 7” touch screen instead as it would be more user-friendly especially for the elderly (our main target audience).
The 3.5″ touchscreen (left) is much smaller than the 7″ touchscreen (right).
The user interface will consist of 2 main screens:
1. Menu Window
2. User Input Window
(to insert img)
The default “menu” window will show tabulated data of all the pill dispensing information that has been keyed in.
If “Add Row” is pressed, users can add a new row in the table by keying in a new input. Each input consists of quantities of each type of pill to be dispensed (maximum 3 types of pills are loaded at once into the pill dispenser) and the dispensing time in 24h format.
If “Edit Row” is pressed, users can edit any selected row’s values and press “Save Edit” to overwrite the previous values with the new values. If “Delete Row” is pressed, users can delete any selected row to remove those values permanently. To exit the application, simply press “Exit” – though this would not be necessary if the pill dispenser is operating normally.
Limitations and Suggestions for Future Work on RPi Code
We struggled with creating a time input field in pysimpleGUI as there is no built-in time input widget; only a calendar date input widget is available. PysimpleGUI is supposed to wrap portions of other packages like tkinter which have time input widgets available, so we did not expect to run into this problem. We managed to work around the problem to still create a time input field, but it is not as elegant and efficient as if we had used a package with a built-in time input widget.
Other python packages could be explored in future; so far, several smart pill dispenser prototypes have been invented but there has yet to be a consensus as to which is the optimal programming language / package to use for such purposes. Optimizing the user input and dispensing algorithm could be key to creating a viable pill dispenser prototype for further development into an actual marketable product.
Next Part of Project (RPi Code – Part 2)
Now that we have a functional user interface for users to key in the relevant pill dispensing information (type of pills, quantity of pills, dispensing time), we need to work on the serial communications between the RPi 3 B+ and the Arduino Mega for the RPi to send information from the user inputs to the Arduino Mega for the dispensing of the pills, as well as for the RPi 3 B+ to receive information from the Arduino Mega to confirm if pills have been dispensed.
References
- https://www.hackster.io/com-bros/smartypill-the-smart-pill-dispenser-for-everyone-c3a478 rpi+arduino
- https://ieeexplore.ieee.org/document/8073657 rpi+arduino
- https://courses.ece.cornell.edu/ece5990/ECE5725_Fall2016_Projects/qw99_mz474/index.html pygame
- https://github.com/PySimpleGUI/PySimpleGUI/issues/6141 lack of time input button