The Controller contains the programmable hardware and interfacing for all transducers. This includes, mini circuit breakers, power supplies, relays and the Pi.
This is all housed in a waterproof steel (400mm x 200mm) enclosure fitted with DIN rail connections
Raspberry Pi2
The brains of the box is a Raspberry Pi2. This provides the programmatic flexibility to allow all stages of the beer making process to be tightly monitored and controlled.
The software is written in Javascript running a NodeJS server.
The Pi2 has been expanded with the addition of two HATs. One to expand the number of GPIOs and another to drive the FrontPanel LEDs.
Pi Pinout
The Pi2 has 26 GPIO pins, numbered from 2 to 27. The motorized valves are numbered 0 to 7,
GPIO Expander (datasheet)
Although the Pi2 has 26 available GPIO pins, this was still not enough, a minimum of 36 IOs were required. To provide these, an I2C expander board which provides an extra 32 GPIO pins is attached on top of the PI.
Signal | Bank | Port | Pin | Bit | Dir | Wire Colour |
---|---|---|---|---|---|---|
Flow 7 | 0x21 | 0x13 | 0x80 | 31 | In | Blue + Black |
Flow 6 | 0x21 | 0x13 | 0x40 | 30 | In | White |
Flow 5 | 0x21 | 0x13 | 0x20 | 29 | In | Gray + Blue |
Flow 4 | 0x21 | 0x13 | 0x10 | 28 | In | Black |
Flow 3 | 0x21 | 0x13 | 0x8 | 27 | In | Green |
Flow 2 | 0x21 | 0x13 | 0x4 | 26 | In | Yellow + Green |
Flow 1 | 0x21 | 0x13 | 0x2 | 25 | In | Blue |
Flow 0 | 0x21 | 0x13 | 0x1 | 24 | In | Purple |
Watchdog LED | 0x21 | 0x12 | 0x40 | 22 | Out | 0 = On |
Watchdog Halt | 0x21 | 0x12 | 0x80 | 23 | In | |
Heater | 0x21 | 0x12 | 0x20 | 21 | Out | 1 = On |
Spare | 0x21 | 0x12 | 0x10 | 20 | Orange + Blue | |
Spare | 0x21 | 0x12 | 0x8 | 19 | Red + Black | |
Spare | 0x21 | 0x12 | 0x4 | 18 | Brown | |
Spare | 0x21 | 0x12 | 0x2 | 17 | Yellow | |
Spare | 0x21 | 0x12 | 0x1 | 16 | Green + Blue | |
Relay ? | 0x20 | 0x13 | 0x80 | 15 | Out | |
Relay ? | 0x20 | 0x13 | 0x40 | 14 | Out | |
Relay ? | 0x20 | 0x13 | 0x20 | 13 | Out | |
Pump 0 | 0x20 | 0x13 | 0x10 | 12 | Out | 0 = On |
Valve 6 | 0x20 | 0x13 | 0x8 | 11 | Out | 0 = Open Red + Brown |
Valve 4 | 0x20 | 0x13 | 0x4 | 10 | Out | 0 = Open Green + Brown |
Valve 2 | 0x20 | 0x13 | 0x2 | 9 | Out | 0 = Open Red + Pink |
Valve 0 | 0x20 | 0x13 | 0x1 | 8 | Out | 0 = Open Red + Blue |
Valve 1 | 0x20 | 0x12 | 0x80 | 7 | Out | 0 = Open Orange |
Valve 3 | 0x20 | 0x12 | 0x40 | 6 | Out | 0 = Open Green |
Valve 5 | 0x20 | 0x12 | 0x20 | 5 | Out | 0 = Open Yellow + Red |
Valve 7 | 0x20 | 0x12 | 0x10 | 4 | Out | 0 = Open Pink |
Pump 1 | 0x20 | 0x12 | 0x8 | 3 | Out | |
Relay ? | 0x20 | 0x12 | 0x4 | 2 | Out | |
Relay ? | 0x20 | 0x12 | 0x2 | 1 | Out | |
Relay ? | 0x20 | 0x12 | 0x1 | 0 | Out |
LED Driver (Protopal protyping board )
The LED Driver board attaches to the Raspberry Pi via the GPIO expander board. It’s purpose is to drive bi-colour LEDs on the Front Panel and feed the Pi GPIO pins from the valve status signals. (Pi gpio spec)
Each of the 8 valves has an open and closed signal which connects to a GPIO pin drives a LED. This requires the board to have 16 inputs and 16 outputs.
The status signals from the valves are either open circuit or grounded. When open circuit, current is allowed to flow and illuminate the LED. The voltage is also pulled up to 3.3V for GPIO input.
The asymmetry in the green and red resistor values are necessary because the relative current required to produce the same brightness is different.
Power Supplies (datasheet)
To drive the motorized valves and power the Raspberry Pi, 12V (and 5V supplies are required.
These were DIN rail mounted in the control box. System current requirements meant two 5V (1.5A) supplies were paralleled up.
Circuit Breakers
The 3KW heating element and extractor fan are protected by 16A and 3A Mini Circuit breakers respectively.
Solid State Relay (datasheet)
- Single Pole Single Throw – Normally Open.
- 20 A.
- DIN Rail mounted with cage clamp.
A Solid State Relay is used to modulate power to the 3KW heating element. It has zero crossing detection to only switch the AC output when the voltage is zero.
It is driven by a single bit from the GPIO Expander.
Relay Board
The 8 motorized valves, 2 pumps and extractor fan are switched from a 16 Channel Relay Board which requires 12V and 5V supplies.
The input signals are 5V and are driven from the GPIO Expander.
Front Panel
The front panel consists of LEDs and switches. The purpose of which is to provide manual override of the valves etc. This is a safety feature in case the software crashes and leaves the system in an erroneous and potentially dangerous state. It also allows the system to be commissioned before fully working software is available.
Valves
For each of the 8 valves there is an associated 3 way switch and a bi-colour LED. The switch positions are, Automatic, Manual On and Manual Off.
The LED indicates the 3 states of the valve. i.e.
- Green = Open.
- Red = Closed.
- Amber = Opening/Closing.
Heater
The 3KW heater is switched from a 5V signal from the Raspberry Pi I2C board that switches a Solid State Relay. The SSR has zero detect crossing to allow safe modulation of the power to the element in order to provide temperature control.
A 3 way switch is provided to manually override this signal from the front panel. An associated green LED is provided to indicate the heater state.
Pumps
Each of the two pumps are controlled from an I2C pin that is used to switch a relay. The relay switches 12V to the pump.
Each pump has an associated 3 way switch to manually control it. A corresponding green LED is lit to indicate that the pump is on.
Watch Dog
A watch dog feature is provide to indicate that system software is alive and well. A green LED with a 3K3 resistor driven from a I2C output pin is on the front panel. It is periodically switched on and off while the system is running. As long as the LED is flashing, all is well.
Halt
One problem with the Raspberry Pi is that removing power can corrupt the SD card if the system is not halted first.
To gracefully switch off the system, there is a push button switch on the front panel that is connected to a GPIO pin with a 33K pullup to 5V. When the button is pressed , the Raspberry Pi shuts itself down. Power can then be removed safely, without fear of any corruption.