Having added a pressure sensor to my Espiresso Machine, I needed an analogue input to be able to read the output voltage from the sensor. Unfortunately, the Raspberry Pi doesn’t have analogue inputs, so an external ADC is required. I settled on the Adafruit ADS1015 which has 4 inputs, 12-bit resolution, includes a programmable gain amplifier, and also uses an I2C interface:
There’s some useful information on how to set up I2C on the Pi on the Adafruit site. Having done that, there is sample code available to read the sensor from Python or C. With this, it was pretty easy to get readings from the sensor, and it seems to perform well.
The pressure sensor uses a 5V supply, and has a ratiometric output which ranges from 0.5V to 4.5V, proportional to input pressure. It has a 0-300 psi range (20.68 bar). The absolute maximum analogue input for the ADS1015 is VDD+0.3V. If we are running the ADS1015 from 3.3V for compatibility with the Pi I2C voltage levels, this limits the analogue input voltage 3.6V maximum.
Theoretically, the Ulka EP5 pump can develop up to 15 bar pressure, although this is limited by the OPV in the machine to 9~10 bar. If we assume the maximum pressure is 10 bar, and the response is linear, this would result in a maximum output voltage of:
4V x (10/20.68) + 0.5V = 2.4V
So it seems that for normal use, the output voltage should be below the maximum analogue input voltage limit of 3.6V. Even if we assume peak pressure of 15 bar is possible, that would be a maximum output voltage of:
4V x (15/20.68) + 0.5V = 3.4V
Based on these calculations the current plan is to interface the pressure sensor directly to the ADS1015.
The next step was to interface the board to the Pi in the Espiresso. Unfortunately, the SCL and SDA pins on my Pi are already used as inputs to read the two front panel buttons on the machine (using one GPIO per button). Also, almost all the other GPIOs are in use, so there was no free GPIO available to relocate the buttons.
To make the SCL and SDA lines available for the ADC, I decided to use a resistor ladder to read the buttons. This will make it possible to use a single analogue input to read all the buttons.
I’m also planning to use an opto-coupler to signal the Pi when the brew (pump) switch is switched on. Since that has an open collector NPN output, I plan to connect that to the resistor ladder also, so that it can be treated as another button input.
The pressure sensor and button input will only use 2 of the 4 analogue inputs, so there will be some inputs spare for future use.
One thought on “Analogue Input Board for the Pressure Sensor (Espiresso)”