As engineering students, we often build projects that solve a problem on paper. This time, I wanted to build something that could actually demonstrate how embedded systems, sensors, and automation can come together in healthcare.
That is how our AI-Enabled Smart Auto Injector for Depth Detection began. It was designed as a proof-of-concept prototype that automatically detects depth using an ultrasonic sensor and controls the injection mechanism accordingly. The goal was not to build a clinical device. It was to explore whether a low-cost embedded system could perform adaptive injection in a controlled environment.
Why this project?
Traditional injectors work with fixed movement and fixed speed. That means they do not adapt to different situations or target depths. I found this limitation interesting because modern medical devices are becoming increasingly intelligent. Instead of performing the same action every time, they sense, process, and respond.
I wanted to recreate that same concept using affordable hardware that students can easily access.
The result was a prototype that follows a simple but powerful pipeline: Sense → Compute → Actuate. An ultrasonic sensor measures depth, an ESP32 processes the information, and a stepper motor drives the syringe with controlled movement.
Choosing the hardware
One thing I enjoyed about this project was selecting components that were inexpensive but still capable of demonstrating the idea. The major components included:
- ESP32 microcontroller
- HC-SR04 ultrasonic sensor
- NEMA17 stepper motor
- A4988 stepper motor driver
- Lead screw mechanism
- 0.96" OLED display
The lead screw converts the motor's rotation into smooth linear motion, allowing the syringe plunger to move precisely. The OLED continuously displays the measured depth and injection parameters, making it easy to verify what the system is doing in real time.
The software side
Most people see the hardware first, but I honestly spent much more time debugging the firmware than assembling the components.
The ESP32 continuously reads data from the ultrasonic sensor and waits until it receives stable measurements. Once the readings become consistent, the system locks onto the detected depth.
From there, the program calculates the injection speed, controls the stepper motor, performs the injection, retracts the syringe, and finally resets itself for the next cycle. Everything happens automatically without requiring manual intervention.
The biggest challenge
Sensor readings are rarely perfect.
The ultrasonic sensor would occasionally produce noisy measurements, which could trigger unwanted behaviour. Instead of accepting every reading immediately, I implemented a simple stability check.
The system takes multiple samples, compares them, and only proceeds if the readings remain within an acceptable range. This small change made the prototype much more reliable. Sometimes the simplest logic makes the biggest difference.
Testing the prototype
After integrating the hardware and software, I tested the prototype using foam materials to simulate different target depths. The testing process involved:
- Verifying sensor accuracy
- Calibrating the stepper motor movement
- Checking the complete sensing-to-injection workflow
- Fine-tuning the motor driver for smoother operation
- Ensuring that only one injection occurs for each detection event
Watching the system successfully complete an entire cycle, from detecting depth to retracting the syringe, was probably the most satisfying part of the project.
What I learned
This project taught me far more than just programming an ESP32.
I learned how mechanical systems and software have to work together. Even a perfectly written program cannot compensate for poor mechanical alignment, and accurate hardware is only useful if the software processes the data correctly.
More importantly, I realized that building biomedical devices requires thinking beyond code. Safety, repeatability, reliability, and validation become just as important as making something work.
Where this can go next
Although this is only a prototype, it opens up several exciting possibilities.
Future versions could include pressure sensing, force feedback, computer vision, AI-based tissue recognition, or integration with hospital monitoring systems. Instead of adapting only to depth, the injector could eventually adapt to tissue type, resistance, or drug properties.
Final thoughts
This project started as a mini project requirement, but it became much more than that. It gave me hands-on experience with embedded systems, motor control, sensing, debugging, and biomedical device design, all in a single build.
There are still many improvements to make, and that is exactly what makes engineering exciting. Every working prototype answers one question while creating ten new ones. And honestly, that is the best part of building.
