The Cocktail Machine consists of an image processing computer with a camera (R Pi 3), peristaltic pumps, and a weight scale. Computer program takes camera shots, and upon detection of something that is considered NSFW (not safe for work) activates the pumps. The pump draws the liquid from the bottle behind the machine into the glass placed in front of it. The glass sits upon the scale that measures the weight of the glass content.
Image recognition
The program that detects nudity is TensorFlow based adaptation of the Yahoo's open sourced NSFW imagery detector. It also uses OpenCV for image handling and processing. The program is written in Python.
Pumps
I've put three 12V peristaltic aquarium pumps for each of three cocktail ingredients (rum, coke and lime juice). The PVC tubes going through the pumps have one end inserted in the bottle of corresponding beverage, and the other end tied to the nozzle that drops the liquid in the glass. The nozzle, placed inside of the machine is not visible from the outside. The pumps are MOSFET-driven by the RPi GPIOs.
Scale
The amount of the cocktail is determined by the digital scale the glass is placed upon. The scale consists of a 1kg load cell (resistor strain gauge) in combination with a 24-bit ADC module HX711. The ADC module is controlled via RPi's SPI interface.
Lightshow
The only interface with a user is an RGB LED ring (NeoPixel by Adafruit) on the front panel of the machine. Before detection, the light show is in "searching" mode where the white light pixels circle around the ring. Upon NSFW detection, the light changes into the "breathing" green, what signals user to put an iced-filled cup or glass on the glass stand within the 5 seconds. When the liquid starts pouring in, the percentage of prepared cocktail is displayed as a number of bright blue pixels on the ring. Once the cocktail is ready, the machine goes to the halt mode for 1 minute, indicated by yellow breathing lights. After this break, machine starts new detection cycle again.