
proposed Budget
Week 11
SafeRx is fully functional. Below is a video of the basic features of the UI.
The following videos are simultaneous simulations regarding the demonstration for quanity discrepancies
Week 10
Arduino and Raspberry Pi
We were able to successfully upload weight and manipulate lock status via PHP application. Below is the screenshot of the lock closing and the weight reported to IoT. To confirm IoT has received this message, we check the shadow state of the thing and that will tell us if IoT has received this string.

Screenshot of Terminal inside Raspberry Pi

Screenshot of AWS IoT Shadow
GUI
Lastly, the GUI now has a live camera view, much needed UI changes is a secured site by an SSL cert. The images below show the infrared function, live camera view and confirmation of storage into S3 upon the desired transaction.

Live Camera View

S3 Upload Confirmation

Secure site Confirmation
Week 9
Lockbox
The door on the lockbox needed to be resized and a shelf needed to be installed around the scale to hide wires and components. A knob also needed to be installed on the door. These tasks were completed this week. With these tasks done, the lockbox has been completed.


Arduino and Raspberry Pi
Arduino is now able to send and receive commands to the Raspberry pi which then passes it to IoT AWS. The web UI is now able to open and close via the web browser both remotely and locally. There was a requirement to add weight and count information (processed on raspberry pi) on the Web UI.

GUI
A PHP script was created to communicate with IoT. This was done by adding the same certificates on Raspberry pi to the remote server. The certificate was installed into Windows Certificate manager and as a backup, stored locally with in its folder structure. Users can now lock and unlock the box remotely.
Week 8
Arduino
The Arduino is still not functioning correctly. It keeps giving an error when attaching it to amazon. The error stems from lack of authentication to AWS. AWS provides certificates that allow IoT Things to communicate to and from. The Raspberry pi has certificates generated to it; however, it is not correctly passing through this information to AWS.
GUI
The GUI has been fully integrated with the fingerprint reader and is able to authenticate users. When a user logs in, it will require a fingerprint and when users click on dispense, it will require a fingerprint.

Lockbox:
One of the things that was left on the lockbox was to install an DC barrel jack power port and a USB-B port on the back. This was done this week:

With this being done, the only things left for the lockbox is cable management and resizing the frame for the door.
Week 7
Lockbox:
One of the things that was left on the lockbox was to install some edge trim for better aesthetics. This was done, although the frame for the door now needs to be resized a bit to let it close:

Fingerprint Reader:
We are now able to upload fingerprint data to the local server after downgrading the application to 5.6 PHP. This was done to ensure the SDK does actually work. Remotely, we were able to configure the fingerprint to work as intended (at PHP 5.6). The code will be upgraded to the latest version of PHP and XAMPP for security reasons.

Arduino:
More research was done integrating the Arduino UNO with AWS. There seems to be an issue with memory of the Arduino UNO it may not be able to handle POST and GET requests; however, we are finding workaround solutions to pass through certificate credentials instead of hard-coding certificate to Arduino to save on memory.
Week 6
Fingerprint Reader
The fingerprint reader is almost fully functional. There seems to be a hiccup when processing the data and writing it to the database. The database is fully accessible everywhere else; therefore it should write to the table for finger data just fine. We submitted a request for support with FlexCode SDK where we purchased the SDK for the fingerprint reader.
GUI
The GUI has been updated to accommodate strength of each medication. The GUI will have summaries for each scheduled medication As of right now, it only displays 1 table; however, we will update this to reflect for each scheduled medication table.

Scale:

The wires have been soldered back onto the load cell and the new scale needs to be tested to make sure it is operational. Using 220 mg pills, the scale was calibrated for 10 pills:

The expected weight was 2.20 grams, so 10 pills was weighing correctly. To test the accuracy after calibration, 5 pills were taken off of the scale and the weight was read:


The expected weight was 1.10 grams, giving the weight from the scale an error of 0.05 grams. Lowering the amount of pills after calibration increased this error until a single pill had an error of 0.09 grams. This is acceptable in this case because the weight is going to be divided by the known individual weight of the pill and then rounded to get a count of the pills. Also there was not a noticeable error when adding more than 10 pills.
Lockbox:
With the new scale built, mounted, and operational, all the other peripherals are able to be mounted onto the lockbox:


To make sure nothing was damaged during mounting, the scale was tested with 5 and 10 pills and the weight was displayed on the LCD mounted on the door:


With everything mounted, all that is left on the lockbox is cable management, installing power ports in the back of the box, and installing some edge trim around the door to give it a much cleaner look. With all of the components installed, testing on the lockbox could be completed:

WEEK 5
GUI

SafeRX has been modified to handle scheduled medications for schedules 1 through 5. These are uploaded to a separate table within the existing database. Furthermore, more UI improvements have been to accommodate NDC's expiration dates and date entry of each medication for each section (i.e. scheduled 1..).
We've implemented branding to Safe RX to make deliver a more professional look and feel. Next week, we will add prescription strength, and make sure the site is secured using self signed certificates.
​
Fingerprint

After extensive research, we were able to implement a fingerprint reader on the local machine that is able to communicate to a database and read and write fingerprints. In the next week, we will implement this fingerprint capture method to the existing system within SafeRX. This was made possible by FlexCode SDK. This software (stored locally) communicates with the local machine and using PHP we are able to read/write the database with fingerprints as needed. The procedure to register the fingerprint is as follows:
1) add the device,
2) create a user
3) register the user's fingerprint.
4) test login
Multiple sample users were created to ensure the fingerprint SDK is able to discern between various fingerprints consecutively.
To integrate this seamlessly with the existing software, we are going to implement an admin page within Safe RX. This admin page allows to add users along with fingerprints. Ultimately, users will not be able to register through the portal; only administrators will be able to add users along with its fingerprint.
The overall picture for this is to restrict user access to the medication and its inventory. To access the medication or edit its inventory, a fingerprint will be required once the user selects dispense.
Lockbox:
The LCD display has now been mounted onto the door of the lockbox. The display was tested to make sure that it was not damaged during mounting:


Scale:
During mounting of the new scale, wires on the load cell were damaged and have to be soldered onto the load cell again. This put mounting all the peripherals behind till next week:

WEEK 4
Solenoid Lock:
Once the power supply for the solenoid arrived, it was time to wire the circuit and test the lock. Adding a digital output pin in the Arduino's code allowed us to be able to control the lock however we wanted. For testing purposes, code was added to unlock the lock for 5 seconds, then lock it again for another 5 seconds, then repeat:

Once uploading the code to the Arduino, the lock performed as intended. It continued to switch from locked to unlocked every 5 seconds:


With the lock done, all the peripherals for inside of the lockbox have been wired and tested:

Lockbox:
The frame of the lockbox was completed last week. This week, the door needed to be cut out and mounted. After a few days of getting rained out in the afternoon, this was completed:


Some sanding will be needed to make it more presentable, but the lockbox is now ready to start mounting the components inside.
GUI

We were able to successfully create a domain name saferx.cloud. Users can now access the site anywhere on the internet. An elastic IP address has been associated to the EC2 instance.
We also did a lot of fingerprint research, and the problem here is the fact we are using cloud based infrastructure; however, we are testing various ways to integrate the fingerprint reader with existing hardware to an open port within the EC2 instance.
Now, all is left is to integrate the secure authentication and upload this database information into AWS to ensure high availability. Originally, DynamoDB was highly preferred due to complex coding demands, we chose to go with MySQL. It still will be highly available and fault tolerant just by different means.
WEEK 3
Temperature/Humidity Sensor:
After coordinating with Will in the Open Lab, we were given access to a soldering iron and soldering materials. It did not take long before the headers were soldered onto the pins of the sensor and it was able to be integrated into our circuit with the scale and LCD. The coding was fairly straight forward thanks to a pre-configured library for the component:

To test the communication between the sensor and LCD, I chose to display the temperature next to the weight from the scale. With limited characters on the LCD, the display was a bit cramped, but it was operational. This is the display without any weight on the scale:

The weight is shown as 0.00 grams and the temperature is at 78.35 F. A weight was then added to the scale to make sure that there wasn't any spacing issues on the display:

The weight is shown as 12.90 grams and the temperature is at 78.25 F. There was enough space on the weight so that if it was to go over 100 grams, there would not be any issues.
Lockbox:
A new lockbox needed to be constructed, since the previous was too large. Thinner plywood was also needed to cut down on the weight of the box. It was decided that it should be around 12"x12"x12". That would be large enough to meet our purposes. Materials were purchased and cut and a new lockbox was made:

The finished dimensions were 12"x12"x13". The plywood used was reduced from 22/32" down to 15/32". The door still needed to be cut out of the front and mounted.

There were multiple Django runtime errors and eventually, we decided to move away from Django web framework due to time constraints within the project. Instead, we used a PHP application. The image above is the preliminary inventory management system in PHP. To start the PHP, application XAMPP was used to host the site as a web server and it was used because it is open source and light weight that can work any server
GUI

XAMPP is now running and open on ports 80 and 443 to serve web traffic as needed. This program configured the database for this site and Tomcat should we need it.

After refining cascading style sheets (css) and the PHP code, the application now is more user friendly and can host inventory. Some sample drugs were added we were hoping to make the website even more user friendly by being able to search the list of all drugs to add it rather than typing it out.
As of right now, users are able to signup and immediately login, Next week we will limit the access of this system and incorporating the fingerprint reader to this.
The search feature is not working at the moment.
WEEK 2
Scale:
Now that the scale was up and running, the next step was to get other peripherals communicating with it and running off of the same microcontroller. The first thing that was worked on was the LCD screen that is going to be showing the count on the door of the lockbox. This count is going to be calculated from the weight on the scale by the inventory management system. Since we aren't integrating the lockbox with the inventory management system yet, the LCD is going to be coded to display the weight on the scale to test how displaying the information is going to work. The program itself was simplified using libraries for the components we are using:
​

This program has the scale getting the average of 5 weights every 5 seconds. This weight is then displayed on the LCD. First it was tried without a weight on the scale:

A weight of 0.00 grams is displayed without anything on the scale. The next step is to test it with a weight on the scale:

With an object placed on the scale, the weight is displayed on the LCD. In this example the bottle with pills in it weighs 46.04 grams. The other peripheral that needed to be tested was the temperature/humidity sensor. Unfortunately, it needed some soldering for the pins and neither of us had access to a soldering iron. Next week, we will coordinate with the college to see if we can get limited access to the Open Lab to be able to solder the component.

An EC2 instance was provisioned on AWS and we ran into the Network Level Authentication (NLA). Normally, the PC would be readily accessible to simply disable it; however, the NLA error was difficult because this was a remote PC we were not able to access it all. We were able to resolve it by creating an IAM role that was attached to the EC2 instance then using the System Service Manager (SSM) with in AWS to troubleshoot the remote desktop connection.

After we were able to access the remote PC, we could now provision the server to use Django (high-level) python framework that will be used to fuel the inventory management system. The next image shows the successful install of Django on the localhost.

In the meantime, the AdaFruit Fingerprint reader could not serve its intended purpose. Originally, this fingerprint reader would be powered through Arduino; however, after careful research, the Digital Personal U.are.U 4500 proved to be the better candidate for this application. An order was placed on May 22nd, 2020 and is expected to arrive Sunday, May 24th. 2020.

WEEK 1
One of the tasks for the first week was to get the scale up and running. It was already built and wired, but the coding needed to be completed to get it operational. This is the wiring diagram for the scale as it is:

A calibration program was completed to set a calibration factor for the scale to be able to measure weights correctly. Instructions were put into the program that would be displayed in the Arduino IDE's serial monitor. The calibration factor could be adjusted using inputs put into the serial monitor.

Once uploading the program to the Arduino, the serial monitor showed the instructions and started displaying a weight in grams every second. Using 220 mg pills as a base weight, a pill was placed on the scale to observe the output. Putting a single pill produced no output from the scale. More pills were added to the scale to see if the load cell was simply not precise enough to observe such a small weight. After placing seven pills, an output was produced. For ease of weight conversion, 10 pills were now used as a calibration weight. The expected output should be 2.20 grams. After adjusting the calibration factor, weights that were around what were expected were being produced.

Not being able to weigh single pills is going to be an issue for our design. In order to be able to accomplish this, a more precise load cell is going to be needed. The load cell being used has a max weight of 5kg. For our purposes, a load cell with a max weight of 200g is going to be needed to be able to measure such small weights. Also for more precise calibration, calibrating weights are going to be needed.


The initial design of the safe was done using pine plywood at 22/32". The interior dimensions were assumed and are as follow: 18 inches high, 18 inches wide and 24 inches deep. Due to the limitations of the cell, this box will be further reduced.

The AWS account and users were set up. The VPC, and its components :Internet gateway, Nat Gateway, Public and Private subnets, along with an route tables to allow traffic to and from the internet.