In this project a decanting machine, which is usually used by Sommeliers to handle quite heavy and valuable bottles of wine, was automated by adding sensors to monitor the pouring process, a stepper motor to move the machine and a Raspberry Pi as the central controlling unit.


Basically the user has to fasten a bottle onto the machine and put a glass into the glass holder. Afterwards the machine turns into a ready-state and waits for the command to start process. During the pouring process the machine tilts the bottle down, until a sensor registers that the wine is flowing into the glass or the minimal position is reached. Then the machine stops and remains in position until a sensor signals the Raspberry Pi that the desired liquid level is almost reached. This is the cue for the machine to lift the bottle until either the wine stopped flowing, or the initial position is reached.


Various sensors are installed in this application to provide the Raspberry Pi with the information it requires to control the stepper motor as well as to inform the user about the current status of the operation. In this application there are in almost all cases two different sensor types to perform the same task. This redundancy ensures the availability of the machine. In case one sensor fails, the other one or two take over.

  • Two micro-switches are installed to verify that a glass and bottle are present.
  • Two light barriers are added to define the initial and the minimal position of the machine.
  • Two capacitive sensors register the flow of wine. One detects when the wine starts to flow and the other one informs the Raspberry Pi when the desired liquid level in the glass is reached.
  • One load cell weighs the bottle. So the Raspberry Pi knows whether or not a bottle is present and what the remaining liquid level is.
  • Strain gauges measure the weight in the glass, thus tells the Raspberry Pi when the desired liquid level is reached. Also, they can be used to verify the presence of a glass.
  • An additional circuit is added to tell the Raspberry Pi whether or not the emergency brake is activated. Since the Raspberry Pi has its own power source it is not affected.

Stepper motor

For this application a stepper motor and driver combination was chosen which could easily communicate with the Raspberry Pi. The driver basically requires two signals:

  • One signal to define the turning direction of the stepper
  • One PWM signal to set the stepper into motion; the frequency determines the velocity of the stepper

Expansion boards

Two expansion boards are used in this project:

  • Quick2Wire Interface Board plus the I2C Analogue Board
  • PiFace


The Analogue Board contains the 8-Bit ADC PCF8591 and communicates via the I²C Bus with the Raspberry Pi. The ADC is used to analyse the information from the strain gauges, which through a DMS Converter is sent as an analogous signal between 0 and 5V to the Raspberry Pi.

Furthermore, the serial port of the Raspberry Pi is used via the Quick2Wire Interface Board to communicate with the measurement amplifier of the load cell. An additional logic level converter from Adafruit is installed between the load cell and the Interface Board to transform the signal from a 3.3V reference to a 5V reference and vice versa.


The PiFace was initially intended for the control of the stepper, since it contains two relays that allow an easy manipulation of circuits with up to 20V. During the development of the project it turned out though that the relays are not required. Nevertheless the PiFace proved to be quite useful to handle all the remaining sensors and the stepper motor as well required more GPIOs than are available on the Interface Board. The PiFace offers 8 digital inputs and additional 8 digital outputs and communicates with the Raspberry Pi via SPI. It functions as a protection against higher voltages for the Raspberry Pi as well. Another advantage of this board is that it can be supplied from an external source. Thus, it is possible to use the Quick2Wire board parallel to the PiFace.