This demonstration uses a non-invasive current sensor, Telegraf, InfluxDB OSS, and a Raspberry Pi to collect data from a coffee machine and analyze that data in several different ways in real time. We visualize data, like voltage and amperage, in a dashboard at the edge. Some data aggregations are useful for predicting supply levels, like when our demo will run out of cups. The instance of InfluxDB OSS takes the relevant data aggregations and uses the Edge Data Replication feature to automatically replicate them to an instance of InfluxDB Cloud. The Cloud dashboard triggers Twilio to send alerts to the right team members to bring more supplies when we only have 10 cups remaining. This approach provides two different user groups with two different analyses from the same set of raw data.
Here is a list of hardware required for creating this project:
- Non-invasive AC Current Sensor
- I2C IIC Analog-to-Digital ADC PGA Converter
- Raspberry PI 4+ (4GB Recommend).
- Breadboard and Jumper Wires Kit .
- (USA ONLY) Klein Tools 69409 Line Splitter
You can find an amazon.com BOM here. (USA) You can find an amazon.co.uk BOM here. (UK) Note you cannot purchase a Klein Tool Line Splitter in the UK. You will need to modify to an extention leed to seperate the Hot, Nutrual and Ground wire. ONLY DO THIS IF YOU ARE CONFIDENT WORKING WITH ELECTONICS
This section will take you through the project installation and configuration. Please make sure to have completed your hardware setup beforehand.
Before continuing with the installation process make sure you have carried out the following steps:
- Create an InfluxDB Cloud Account (Optional)
- Install the Coffee Monitor InfluxDB Cloud Template (Optional)
- Install the 64bit ARM OS onto your Raspberry PI
- Enable the I2C on your Raspberry PI. (How to here)
These next steps will be carried out via a terminal on your Raspberry PI. This can be carried our directly or via SSH:
- Clone the repository:
git clone https://github.com/InfluxCommunity/Coffee-Machine-Monitor
- Run the installation script. Root privilege is required for installing docker.
sudo chmod +x ./Coffee-Machine-Monitor/install-script.sh
./Coffee-Machine-Monitor/install-script.sh
- Create a secrets file within
Coffee-Machine-Monitor
.
touch ./Coffee-Machine-Monitor/.secrets
- Open the secrets file and add the following details:
export INFLUXDB_CLOUD_TOKEN=
export INFLUXDB_CLOUD_ORG_ID=
export INFLUXDB_CLOUD_HOST=
export INFLUXDB_CLOUD_BUCKET_ID=
- (Optional) Run the following configuration script to setup dashboards, tasks and Edge Data Replication. This step is recommended unless you plan to create your own dashboards and tasks.
sudo chmod +x ./Coffee-Machine-Monitor/setup-script.sh
./Coffee-Machine-Monitor/setup-script.sh
After setup you will be able to access the InfluxDB dashboard with the following URL: http://<IP-OF_PI>:8086
Login credentials: influxdb:influxdb
If you ran the setup-script you will find a prebuilt dashboard called Coffee Machine Power Monitor
Turn on you coffee machine, brew a coffee and observe the amperage reading. If you installed the cloud template you will also be able to view an estimate on the number of cups of coffee brewed.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.