This is a dispenser that fits on HealthA2Z's SleepAid brand diphenhydramine sleeping pills. There is a threaded cap that screws on, a rotating hopper that grabs two pills per rotation, and a locking lid to prevent more than one pill from being dispensed at a time. The design takes inspiration from a gumball machine, and the hopper is designed to perfectly fit one of these specific capsules.
The exact bottle and capsules you need: https://amzn.to/49Tm4Dk