An open API service indexing awesome lists of open source software.

https://github.com/kaltsoon/kilke

🧪 IOT platform for reading and visualising sensor data
https://github.com/kaltsoon/kilke

docker iot javascript

Last synced: 5 months ago
JSON representation

🧪 IOT platform for reading and visualising sensor data

Awesome Lists containing this project

README

          

# 🧪 Kilke

> _"A small metal object that jingles."_
>
> — A definition for the Finnish word "kilke".

Kilke is an IOT platform for reading and visualising sensor data and to automatically control certain laboratory devices (e.g. pumps) based on the sensor outputs. The platform was developed for a research project which purpose was to extract valuable minerals from mining wastewater. Its architecture consists of five components, which can be found in the `packages` directory.

```mermaid
flowchart LR
api[API]
client[Client]
sr[System Reader]
sio[System IO]
pc[Pump Controller]
pg[(PostgreSQL)]
api --> pg
client --> api
sr --> api
sr --> sio
pc --> api
pc --> sio
```

## Setup

1. Install [Docker](https://www.docker.com/)
2. Run `docker-compose up`
3. Once `db` and `api` services are running, run the migrations by running `docker-compose exec api yarn migrate:latest`
4. _(Optional)_ Create a system by calling the API with the following request:

```bash
curl -d '{"name": "System"}' -H "Content-Type: application/json" -X POST http://localhost:5000/api/v1/systems
```

After the setup is done, the client should be available at .

### Package configuration

You can override each package's configuration in the `.env` file within package's directory (e.g. `packages/api/.env`). Note that some of these changes (such as ports) require altering the `Dockerfile`s and `docker-compose.yml` file as well.

## System configuration

System configuration format:

```javascript
{
sensors: {
[string]: { // key for the sensor
title: string,
subtitle: string,
decimals: number, // how many decimals are used to display measurements
reactorTitle: string, // title showed in the reactor view
unit: {
unit: string, // unit short name, such as "RPM"
title: string, // unit long name, such as "Temperature"
},
calibration: {
x1: number,
x2: number,
y1: number,
y2: number,
},
},
},
pumps: {
[string]: { // key for the pump
title: string,
subtitle: string,
},
},
binarySensors: {
[string]: {
title: string,
subtitle: string,
reactorTitle: string,
},
},
visualization: {
tabs: Array<{
title: string,
sensors: Array, // array of sensor keys
}>,
},
reactor: {
pumps: Array, // pump keys
sensors: Array, // sensor keys
binarySensors: Array, // binary sensor keys
}
}
```

## Inspecting logs

Run `docker-compose logs ` where `` is the target service. E.g. `docker-compose logs system-reader`

## Database connection

Once containers are running after running `docker-compose up`, you can access the database container by running `docker-compose exec db /bin/bash`. Once connected to the database container you can access the database from terminal by running the command:

```
psql -U postgres -d kilke
```

## License

[MIT](./LICENSE)