Help coding medical Tablet Counting machine

i would like to design a circuit to count tablets and when it counts a certain number of tablets (i.e 30 tablets) a gate opens to direct the tablets to a nozzle to fill a jar.

the above photo shows the part of the machine, I would like to make.
the following photo is circuit diagram.

when the IR count the specific number of tablets (i.e. 30 tablets) the relay triger the solenoid which move the gate.
is there any one who can help me in coding or suggest a project do the same.
Thankyou

What have you tried? What were the results?

Good questions!

To create a program that counts to 30 and then triggers a solenoid is an easy task. The programming seems to be the easiest part, it's more about the "real" world issues:

  • How and how quick are the tablets moved in front of the IR obstacle detector?
  • How are they seperated to be counted one by one?
  • Is there a requirement to stop moving tablets when 30 has been reached?
  • How long must the gate be opened to allow all tablets to fall?

And wouldn't it be easier to use a scale and the weight of 30 tablets (if they are of the same kind)?

@haleemrayan

  • Presumably the potentiometer is to dial in the required quantity which shows on the lcd?
  • Unless you already bought the LCD, it's easier to use one that works on the I2C bus. Only 2 wires (plus power) to worry about; much easier.

I didn't start the project yet is is still in design phase. It's the first time for me to deal with arduino.

  • the tablets will move very quick but i think, I could decrease its speed little.
  • they just fall in front of the IR sensor like this video King TB4 electronic tablet counter - YouTube
  • no require to stop the moving tablets, the machine has 2 nozzles with a moving gate controlled by a solenoid.
  • the gate just change the nozzle so it will be open until another 30 tablets are counted.

I didn't try any thing yet. I am new to Arduino. I am still in the designing phase to determine which parts to buy. after your advices

thankyou for your advice. I didn't buy any thing yet
I also found this LCD Keypad Shield
Arduino Shield "LCD Keypad Shield" - RAM Electronics (ram-e-shop.com)
Is it Better?

I would use a MOSFET to power the solenoid instead of a relay. The relay coil will need an external power supply. The MOSFET is more reliable and efficient power wise.

I would use a light gate where the pill pass between the emitter and detector instead of a reflective sensor like is pictured.

Use an I2C enabled LCD. It requires only the 2 I2C pins instead of 6 pins. Install the hd44780 library. It is the best LCD library currently available and makes using an I2C display as near plug and play as possible.

thankyou,
can you please give me a link to a suitable light gate

I think that the potentiometer is to adjust LCD contrast.

I agree that the I2C LCD is easier to use, especially with the hd44780 library.

It would not be hard to modify the reflective sensor in the picture to a light gate. Carefully unsolder the emitter from the little PC board. Add short wires to it and solder the other ends back to the board. Then you can place the emitter across from the sensor so that the IR beam is broken by a pill passing by.

Thanks for the additional information. That makes things much clearer.

You might consider to prototype the part where the pills are separated and fall through the pipe to find the optimum position and sensitivity of the light gate. That seems to me to be one of the critical functions, provided that the gate is constructed in a way that it can not get stuck by a moving tablet during switching.

I second also @groundFungus's suggestion to change from reflective measurement to light gate.

The timing of switching the gate and the distance between the position of the sensor and the gate will also have to be measured and have an influence on the maximum tablet/pill speed.

Do you already have more concrete concepts for the mechanical construction?

You're probably right: in my head the lcd had its own pot on the back. But if so, @haleemrayan you could consider using a pot to do as I suggested as well, to make your machine more versatile and not have to edit the code to change the quantity.

That library is the dog's bo!!ocks for sure.

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