I am working on a pet project using arduino where I need to keep track on number of objects in a bottle.It requires counting the number of objects(size of a regular pill and approximately of the same weight). My approach to this was asking the user to drop one object into the bottle and weigh it, then ask the user to drop the remaining objects into the bottle. So I can find the number of objects using the formula (total weight)/(weight of single pill).Whenever the weight of the objects in the bottle changes the formula is used and number of objects still in the bottle are found out, as you can see this is not very user friendly so I was looking if anyone can help me out with a better solution.
EDIT:If not by using weight is there any way to count the number of objects by using IR sensors etc., cause I have seen the load cells to measure small cells are quite expensive.