Hospital Sample Organizer

by angasailakshmi in Living > Health

24 Views, 0 Favorites, 0 Comments

Hospital Sample Organizer

ChatGPT Image Jul 6, 2026, 03_13_55 PM.png
Screenshot 2026-07-06 144317.png
Hospital Sample Organizer

Hospitals process hundreds of patient samples every day, and manually checking sample labels can sometimes lead to sorting mistakes or delays. This project, Hospital Sample Organizer using OCR, is an AI-based solution that helps reduce these errors by automatically reading printed text on sample labels.

Using PictoBlox's AI Text Recognition (OCR) and Quarky, the system scans the patient ID or sample label through a camera, compares it with the expected ID, and instantly indicates whether the sample is correct. If the label matches, the system turns on a green LED and displays "Correct Sample." If the label does not match, it turns on a red LED, activates a buzzer, and displays "Wrong Sample."

This project demonstrates how Artificial Intelligence and automation can improve efficiency, accuracy, and patient safety in healthcare. It is beginner-friendly, easy to build, and can be further enhanced by connecting it to a hospital database, barcode or QR code scanner, or an automated conveyor system for real-world applications.

Supplies

Screenshot 2026-07-06 144616.png
Screenshot 2026-07-06 144648.png
Screenshot 2026-07-06 144654.png
Screenshot 2026-07-06 144635.png
Screenshot 2026-07-06 144832.png
Screenshot 2026-07-06 144853.png
  1. Pictoblox Software: Download PictoBlox | Windows, MacOS, Linux, Chromebook, Android & iOS
  2. Laptop/PC
  3. Inbuilt or External Camera Setup
  4. Speaker or Headphones
  5. Quarky

Software Setup and Adding Extensions

Screenshot 2026-07-06 144750.png
Screenshot 2026-07-06 144759.png
Screenshot 2026-07-06 144809.png

Open PictoBlox on your computer.

Create a New Project.

Connect your Quarky to the computer using a USB cable.

Select Upload Mode or Stage Mode (Stage Mode is recommended for testing OCR).

Click the Add Extension button.

Add the following extensions:

  1. AI Text Recognition (OCR)
  2. Quarky
  3. Display
  4. RGB LED
  5. Text-to-Speech (Optional)

Allow camera access when prompted so the OCR extension can detect text through the webcam.

Verify that the camera preview is working correctly before proceeding.

Setting Up the Stage and Variables

Stage Setup

  1. Open a new project in PictoBlox.
  2. add a sprite hazel.
  3. Ensure the webcam is enabled and clearly captures the sample label.

Create Variables

Create the following variables:

  1. Detected_Text โ€“ Stores the text recognized by the OCR camera.
  2. Expected_ID โ€“ Stores the patient ID that the system expects to detect.

To create a variable:

  1. Click the Variables category.
  2. Select Make a Variable.
  3. Create Detected_Text.
  4. Create Expected_ID.


Step-by-Step Block Coding Guide

Screenshot 2026-07-06 123254.png

Start the Program

  1. Add the When Green Flag Clicked block.
  2. This block starts the program when the green flag is clicked.

Purpose: Initializes the Hospital Sample Organizer.

Set the Expected Patient ID

  1. Use the set Expected ID to P1025 block.

Purpose: Initializes the variable. After scanning, this value is replaced with the OCR result.

Initialize the Detected Text Variable

  1. Use the set Detected_Text to P1030 block.

Purpose: Initializes the variable. After scanning, this value is replaced with the OCR result.

Continuously Scan the Sample

  1. Add a Forever block.

Purpose: Keeps the program running continuously so that every new sample label is scanned automatically.

Recognize Handwritten Text

  1. Inside the Forever loop, use the Recognize Handwritten Text in Image after 2 seconds block.

Purpose: The camera captures the sample label and OCR extracts the handwritten text after a 2-second delay.

Store the OCR Result

  1. Use the set Detected_Text to Handwritten Text Result block.

Purpose: Saves the recognized text into the Detected_Text variable for comparison.

Display the Detected Text

  1. Add the say Detected_Text block.

Purpose: Displays the recognized patient ID on the screen, helping users verify that OCR has read the label correctly.

Compare the Patient IDs

  1. Add an If-Else block.
  2. Compare Detected_Text = Expected ID.

Purpose: Checks whether the scanned patient ID matches the expected patient ID.

If the Sample is Correct

If both IDs match:

  1. Say "Correct Sample"
  2. Speak "Correct Sample"
  3. Display a Green Tick on the LED Matrix

Purpose: Confirms that the sample belongs to the correct patient and provides both visual and voice feedback.

If the Sample is Incorrect

If the IDs do not match:

  1. Say "Wrong Sample"
  2. Speak "Wrong Sample"
  3. Display a Red Cross on the LED Matrix
  4. Play a 1000 Hz buzzer sound for 200 ms
  5. Wait for 1 second

Purpose: Alerts the user that the scanned sample does not match the expected patient ID.

Repeat the Process

After waiting for one second, the Forever loop starts scanning again.

Purpose: Allows the system to continuously monitor and verify multiple sample labels without restarting the program.

Testing the Project

Testing Procedure

Test Case 1: Correct Sample

  1. Connect Quarky to your computer.
  2. Click the Green Flag to start the program.
  3. Place the sample label with the expected patient ID (e.g., P1025) in front of the camera.
  4. Wait for the OCR to recognize the text.

Expected Output:

  1. โœ… The recognized text is displayed.
  2. ๐ŸŸข Quarky RGB LED turns Green.
  3. ๐Ÿ’ฌ The program says "Correct Sample."
  4. ๐Ÿ”Š Text-to-Speech announces "Correct Sample."
  5. โœ” The LED Matrix displays a Green Tick.
  6. ๐Ÿ”• No buzzer sound is played.

Test Case 2: Wrong Sample

  1. Place a label with a different patient ID (e.g., P1030) in front of the camera.
  2. Wait for the OCR to scan the label.

Expected Output:

  1. โŒ The recognized text is displayed.
  2. ๐Ÿ”ด Quarky RGB LED turns Red.
  3. ๐Ÿ’ฌ The program says "Wrong Sample."
  4. ๐Ÿ”Š Text-to-Speech announces "Wrong Sample."
  5. โœ– The LED Matrix displays a Red Cross.
  6. ๐Ÿ”” The buzzer sounds at 1000 Hz for 200 ms.

Test Case 3: Continuous Scanning

  1. Show different sample labels one after another.
  2. Keep each label in front of the camera for about 2 seconds.

Expected Output:

  1. The camera continuously scans each label.
  2. The RGB LED changes automatically:
  3. ๐ŸŸข Green for a correct sample.
  4. ๐Ÿ”ด Red for a wrong sample.
  5. The system provides voice, LED matrix, and buzzer feedback based on the result.

This clearly demonstrates how Quarky's RGB LED provides an instant visual indication of whether the scanned hospital sample is correct or incorrect.

Applications of Hospital Sample Organizer Using OCR

1. Hospitals ๐Ÿฅ

  1. Verifies patient sample IDs before laboratory testing.
  2. Reduces the risk of sample mix-ups.

2. Diagnostic Laboratories ๐Ÿงช

  1. Automatically identifies and organizes blood, urine, and other medical samples.
  2. Speeds up the sample processing workflow.

3. Blood Banks ๐Ÿฉธ

  1. Confirms blood sample labels before storage or testing.
  2. Helps maintain accurate donor records.

4. Pathology Laboratories ๐Ÿ”ฌ

  1. Matches patient IDs with pathology samples.
  2. Prevents errors during sample analysis.

5. Medical Colleges and Training Institutes ๐ŸŽ“

  1. Demonstrates the use of AI and OCR in healthcare.
  2. Serves as an educational project for students learning automation and medical technology.

6. Automated Sample Collection Centers ๐Ÿ“ฆ

  1. Integrates with smart kiosks or collection counters to verify samples before they are sent to laboratories.



Conclusion

The Hospital Sample Organizer Using OCR is an innovative healthcare project developed using PictoBlox and Quarky. It uses Optical Character Recognition (OCR) to read patient IDs from handwritten sample labels and verifies whether they match the expected ID.

When the sample is correct, the system provides instant confirmation by turning the Quarky RGB LED Green, displaying a Green Tick, and announcing "Correct Sample." If the sample is incorrect, it turns the RGB LED Red, displays a Red Cross, sounds the buzzer, and announces "Wrong Sample."

This project helps reduce manual errors, improves patient safety, and makes the sample verification process faster and more reliable. It demonstrates how Artificial Intelligence (AI) and embedded hardware can be combined to create a practical solution for real-world healthcare applications. With future enhancements such as barcode scanning, cloud database integration, and automated sample sorting, this system has the potential to become an even more efficient tool for hospitals and diagnostic laboratories.