Low-cost and reliable sensor for detecting pills in containers – suggestions?

Hello,

We are working on a project in which we want to detect whether there are pills in specific containers or not—that’s our minimum requirement. Ideally, we’d also like to determine the exact number of pills in the container. We envision a container that can be held between your fingers or in your hand (approximately 4×4×4 cm), but any other container from which you can comfortably remove pills would also be acceptable.

We’re aiming for an inexpensive and reliable solution—ultimately, the cost of a single sensor should fall within the 10–20 PLN range.

What have we already tested?

  • Ultrasonic sensor – a resolution of around 1 mm turned out to be insufficient to clearly determine the presence of a pill.
  • IR camera + AI – works well, but the price skyrockets when dealing with multiple containers (issues with the USB bus, hardware costs, and optics).
  • Weight measurement – we’re concerned that small debris (e.g., crumbs) could cause false readings and require frequent cleaning.
  • IR LEDs from above + photoresistors underneath – would require building a matrix of photoresistors under each container, which again increases complexity and cost.
  • Magnetic sensors, reed switches – mainly detect motion, so they offer little insight into the number of pills.
  • Hall sensors – can detect changes in the magnetic field, but won’t tell us how many pills are in the container (only that the field has changed).
  • 3D grid – there was also a concept to build an inexpensive (if possible) 3D grid of the container’s bottom at a certain interval, with a resolution of around 0.5 mm, and then process that data in software.

We’re looking for ideas and suggestions on what else could be implemented to achieve a reliable, low-cost sensor solution that’s also easy to maintain. Does anyone have experience with similar projects? What solutions would you propose? Are there any less obvious measurement methods or clever combinations of sensors?

Thank you in advance for any insights, and we look forward to discussing this further!

What is the weight of the container?
What is the weight of 100 pills?

Depending on the answers a low range load cell + HX711 could be an option?

inexpensive and reliable

These requirements are often in contradiction....

2 Likes

Is this just a one off project or are you trying to develop a commercial product ?

It will be many containers for each day, weight will be few grams. I am thinking about somethink based on this:

few pills on each day

I think some (IR) light emitter / receiver setup fits best to your budget

That helps, could the pills have some "place holder" instead of lying there randomly? Like putting them in a row...

Hmm, great though. :thinking: We don’t now in advance how many pills will be, so I wasn’t thinking about organize them.

Weight will be the most reliable, ignore tiny errors, you are looking for increments of whatever wt one pill is.

3 Likes

Count the pills added and subtract the pills removed!

Might be a good idea to think that through before making decisions on other project details.

1 Like

Do we know exactly what the pill container weighs?

That is good point, I just start wondering if it is even more complex issue then technical part.

Not now, after some kind of PoC we will know/decide.

It is even so complex as being impossible if people are involved. They can neither be controlled or be relied on.

True true, where will huge effort to test it well, with all imagined corner cases.

Hmm, intresting, leading this way it would be king of internal distrubution system of paths in and out, covered by one device enclouse. :thinking:

Make blister packs where the only way to get a pill is to remove the blister.

1 Like

How are the pills loaded?

Perhaps turn it on its head and have a way of organising tablets - eg have them in a tube , so length of tablets gives you an answer .
Some companies are now supplying medication in daily ‘sets’ .
Worth a look around to see what is done in manufacture - how do they count ?
There may be other simile's in say ball bearings ?
You might need to try several prototypes


This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.