Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 50 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,58 +5,83 @@

Do you use a paper based tally sheet to count your team's coffee consumption? Throw it away and use `coffeebuddy`!

## Usage
## Setup

Coffebuddy uses [pdm](https://pdm-project.org/en/latest/) to manage its python dependencies.

1. Install dependencies
Coffeebuddy is designed as a server-clients infrastructure.
I'm using a RaspberryPi 4 as server and multiple RaspberryPis 3 as consumer endpoints.
The endpoints are equipped with a smartcard reader and a touch screen for interaction.

```sh
pdm sync
```
### Server

If `pyscard` fails building you might need to install dependencies. For Debian based distributions this would be
#### Hardware (recommendation)

```sh
sudo apt install swig libpcsclite-dev
```
- RaspberryPi 4
- External SSD to store database

2. Connect a pcsc smart card reader.
I use a [uTrust 4701f](https://support.identiv.com/4701f/).
Drivers for Ubuntu can be installed for example by
#### Software

```sh
sudo apt install pcscd pcsc-tools
```
The server runs postgresql and uses certificated based authentication on client side.
Details are described in [Setting up postgresql database](./doc/postgresql.md).

### Client

#### Hardware (recommendation)

- RaspberryPi 3
- 7" touchscreen with 1024x600 pixel resolution
- Identiv uTrust 1401f PCSC cardreader
- 3D printed housing (see [doc/housing.md](./doc/housing.md)) including:
- a PIR for presence detection (see [coffeebuddy/pir.py](./coffeebuddy/pir.py))
- a multicolor LED for status indication (see [coffeebuddy/illumination.py](./coffeebuddy/illumination.py))

#### Software

1. Install cardreader dependencies
If using a PCSC cardreader and a Debian based distributions:

```sh
sudo apt install swig libpcsclite-dev pcscd pcsc-tools
```

2. Install Python dependencies

```sh
pip install --user pdm

pdm sync
```

3. Start `production` environment

```sh
./bin/run.py
```

or `development` environment
##### Debugging

```sh
FLASK_ENV=development ./bin/run.py
```
The `development` environment can be run using

```sh
FLASK_DEBUG=1 ./bin/run.py
```

## Tests

Run tests with `pytest -v tests`


## Application
## Troubleshooting

The final application uses a Raspberry Pi attached to a 7" touchscreen. Thus, the HTML an CSS is optimized for a display with a resolution of 1024x600.

### Configuration for Raspberry Pi
### Proper configuration for Clients

#### Misc

At least I had to adjust the following settings:

* Fix screen resolution
- Fix screen resolution

```conf
hdmi_group=2
Expand All @@ -65,7 +90,7 @@ At least I had to adjust the following settings:
hdmi_drive=2
```

* If display has to be rotated by 180° adjust `/etc/X11/xorg.conf.d/40-libinput.conf`
- If display has to be rotated by 180° adjust `/etc/X11/xorg.conf.d/40-libinput.conf`

```conf
Section "InputClass"
Expand All @@ -77,7 +102,7 @@ At least I had to adjust the following settings:
EndSection
```

* Disable translation option in chrome
- Disable translation option in chrome

#### Card reader

Expand Down
2 changes: 1 addition & 1 deletion bin/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
raise
app.socketio.run(
app,
use_reloader=False,
use_reloader=app.debug,
host=app.config["HOST"] if "HOST" in app.config else "",
ssl_context="adhoc" if app.config["SSL"] else None,
allow_unsafe_werkzeug=True,
Expand Down