Two sensors have been used for this project. One of them is used to detect when a cigarette is inserted and the other one detects when the ball goes into the basket. IR sensors were chosen for the two tasks. The choosen sensors have a lens to protect from ambient light, so they are reliable in every condition. The IR sensor consist of an emitter and a receiver. The emitter is a LED that emits infrared light, and the receiver acts like a BJT activated by the infrared light at the base.
A 10k resistor was connected between Vcc and the collector pin of the receiver, and the emitter pin connected to the ground. The voltage at the collector pin changes depending on the amount of IR light reflected by the object in front of the sensor ; the closer the object the higher the amount of light reflected.
The figure below shows the placement of the sensors. The one at the top is used to detect when a cigarette is inserted while the bottom one is used to detect when the ball goes through the basket.
To protect and support the sensors, two structures were implemented. Both were 3D printed and are secured in place with screws connected to the basket wall.
An LCD screen is attached and is used to display several things. It shows a total cigarette counter and instructions to play depending on the phase of the game. During the throwing phase, a bar can be seen by the player to choose the correct timing to score. It also features some messages aimed at exhorting the player to smoke less. An example can be seen on the figure below.