PillPoint(smart Pill Dispenser) --- HOWEST, CTAI

by AlessiaColumban in Circuits > Raspberry Pi

406 Views, 8 Favorites, 0 Comments

PillPoint(smart Pill Dispenser) --- HOWEST, CTAI

WhatsApp Image 2024-06-11 at 10.47.35.jpeg

Picture a device that not only assists in adhering to medication schedules but also intervenes to prevent erroneous pill consumption through auditory cues. This innovative solution serves as a dependable aid for individuals managing complex medication regimens, including elderly populations, mothers navigating childcare responsibilities, and those contending with chronic health conditions.

By seamlessly integrating into daily routines, this advanced pill dispenser offers a sense of security, ensuring medications are administered timely and accurately. Its proactive approach fosters confidence in health management, positioning it as an indispensable tool in promoting wellness and treatment adherence.

Supplies

WhatsApp Image 2024-06-10 at 13.46.12 (2).jpeg
WhatsApp Image 2024-06-10 at 13.46.12 (1).jpeg
WhatsApp Image 2024-06-10 at 13.46.12.jpeg
  1. Raspberry Pi 5 - 8Gb - Starter Pack (2023)
  2. Full HD 1080P Webcam with Built-in Microphone, USB Web Computer Camera
  3. Dispenser
  4. Project Kit Freenove
  5. Wooden Planks
  6. Paint

Search Pictures for the Dataset

WhatsApp Image 2024-06-10 at 13.54.54.jpeg
WhatsApp Image 2024-06-10 at 13.53.56.jpeg
Pill.jpeg

Searching for pictures of hands, pillboxes, pills

Label Pictures

Captură de ecran din 2024-06-10 la 13.57.57.png
Captură de ecran din 2024-06-10 la 14.00.16.png

In Roboflow label pictures, so that there are at least 1000, using a detection model

For the pillBox, we label every compartment as well as the openings. At the end, we have 18 classes in Roboflow

Download on Computer

Captură de ecran din 2024-06-10 la 14.03.14.png

You can click export as zip file your images labeled

Visual Studio

Captură de ecran din 2024-06-10 la 14.01.47.png

Go to Visual Studio code.

Create an AI folder and an RPi folder in a repository.

AI Part

Captură de ecran din 2024-06-10 la 14.06.40.png

Now you can add the unzipped file with the yolov8 from roboflow to the AI folder

Change the Data.yaml File

Captură de ecran din 2024-06-10 la 14.07.53.png

The path needs to be changed

train: train/images

val: valid/images

test: test/images

Create an Ipynb File

Captură de ecran din 2024-06-10 la 14.12.13.png

In the folder with the model from roboflow, create a file name.ipynb. That is a jupyter Notebook file.

There, you need to check first the paths to the train, test and valid images.

Train the Model

Captură de ecran din 2024-06-10 la 14.13.10.png
Captură de ecran din 2024-06-10 la 14.13.23.png

Create another cell and put this code that is going to train the model.

Create Image in Raspberry Pi

How to produce and test a Raspberry PI image.

You need an SD card that has to be introduces first in the computer.

After that, follow the instructions in the video.

At the end, you introduce the SD card in the raspberry pi and reboot it.

SSH Connection

Captură de ecran din 2024-06-11 la 13.34.22.png

On visual studio code, you click the remote button in the left bar and choose the adding connection. Mine was 192.168.168.167

Connect to RPi

Captură de ecran din 2024-06-11 la 13.37.07.png
Captură de ecran din 2024-06-11 la 13.37.50.png

Make sure the AI folder and RPi folder are in the same repository.

Open a separate window of VS code with the connection to raspberry.

Then press Pull, so that all the changes made in the other window show up in the connection window as well.

Rpi

this folder needs to have another subfolder Classes with 2 files: LCD, Buzzer and RGB LED.

LCD

Captură de ecran din 2024-06-11 la 13.39.12.png
Captură de ecran din 2024-06-11 la 13.39.00.png

The LCD display needs the address, then it

Buzzer

Captură de ecran din 2024-06-11 la 13.38.50.png

I am using the active buzzer from the Freenove Project kit which is at GPIO12. I created the bad notification tone to sound like a melody.

RGB LED

Captură de ecran din 2024-06-14 la 13.51.37.png
Captură de ecran din 2024-06-14 la 13.51.43.png
Captură de ecran din 2024-06-14 la 13.51.47.png

Code for creating the RGB class, which should give the green and red lights accordingly. In the code, I also included the ADC reader.

App.py

Captură de ecran din 2024-06-11 la 13.42.19.png
Captură de ecran din 2024-06-11 la 13.42.27.png
Captură de ecran din 2024-06-11 la 13.42.34.png

In RPi, but outside of Classes, program the WIFI connection between the computer and the raspberry pi, initialise the Buzzer and the LCD. Then run the code.

AI Code

Captură de ecran din 2024-06-14 la 14.12.33.png
Captură de ecran din 2024-06-14 la 14.12.37.png
Captură de ecran din 2024-06-14 la 14.12.42.png
Captură de ecran din 2024-06-14 la 14.12.46.png
Captură de ecran din 2024-06-14 la 14.12.51.png
Captură de ecran din 2024-06-14 la 14.12.53.png

Create another name.py Python file where you code the program so that it detects the position of the pillbox compartments. Then, it detects if it is the right one or the wrong one. If it is the right one, the RGB LED turns green. If it is the wrong one, the RGB LED turns red and the buzzer goes off.

This is connected to the training with YOLOv8 and also to the WIFI, so that it can communicate with the RPi part of the project.

GitHubCodeLink

Captură de ecran din 2024-06-11 la 14.06.15.png