Touch free water dispenser with a Raspberry Pi
In this quick project, we’ll be using Monk Makes’ RaspiRobot board (v2) and a peristaltic pump, to build a sort of touch free water or drink dispenser. Our main component here, the RaspiRobot board, is a brilliant motor shield you can buy for the Raspberry Pi, which plugs in neatly onto the GPIO header and enables you to control motors effortlessly. Thanks to the simplicity of the Python language and a great module by Monk Makes, writing code to control motors is as simple as typing
rr.forward(). The peristaltic pump is another great component for electronics project, which we touched on in our last tutorial on making an automated solution pH adjuster for science labs. These pumps can be bought cheaply on Amazon and in maker stores such as Adafruit, for as little as £10.
What you’ll need
- Raspberry Pi (any model should do, including Pi 2)
- RaspiRobot board v2 (Monk Makes)
- 6V DC Peristaltic pump
- HC-SR-04 ultrasonic rangefinder (link)
- 7.4 V DC battery (recommended) / 9 V DC battery / 6x AA batteries with compartment
Putting it all together
Simply install the RaspiRobot board onto your Raspberry Pi, aligning the pins correctly. The side of the board where the power and motor terminals is should be on the same side of the GPIO header where PIN #1 is, that is towards of the bottom of the Raspberry Pi where typically the micro-SD card slot and power port is. Next, install the ultrasonic sensor on to the RaspiRobot board with it’s sensors facing outwards as in the image at the top (the GND pin should align with the GND pin slot on the board).
Power and motor connections
Whilst making sure the USB power cord isn’t connected to the Pi, hook up your power source to the RaspiRobot board’s power terminals. Never connect both the USB and battery power source at the same time. The diagram below should guide you on how to connect the wires from the negative and positive terminals of the battery source. A 7.4 V DC battery is recommended as these can be found in DSLR batteries, and are of course rechargeable. 9 V DC batteries have a lower capacity, where as 6x AA batteries have greater capacity and are widely and cheaply available. The only downside to AA batteries is finding a compartment to plug them into, from which you can have negative and positive power leads to hook up to the RaspiRobot board. If you try to run this set up of USB power, the 5V over USB will not be sufficient to drive the motor in the pump.
For more detail: Touch free water dispenser with a Raspberry Pi