Code Monkey home page Code Monkey logo

co2-mini's Introduction

co2-mini

Read data from a CO2 monitor device "CO2-mini" via USB and monitor the data.

Architecture

flowchart LR
    C[CO2-mini]

    subgraph "Local machine"
        N[Node.js program]
        subgraph "Docker"
            G[Grafana]
            I[InfluxDB]
        end
    end

    N -- "Listen data (USB)" --> C
    N -- "Send data (HTTP)" --> I
    G -- "Visualize (HTTP)" --> I
Loading

Setup

  1. Create external network.

    docker network create external
    

    TODO: This network setting is for test in local environment.

  2. Move to monitor directory.

  3. Create myInfluxDBVolume and myGrafanaVolume directory.

  4. Create .env file.

    DOCKER_INFLUXDB_INIT_USERNAME=<InfluxDB admin user name>
    DOCKER_INFLUXDB_INIT_PASSWORD=<InfluxDB admin password>
    DOCKER_INFLUXDB_INIT_ORG=<InfluxDB initial organization>
    DOCKER_INFLUXDB_INIT_BUCKET=<InfluxDB initial bucket>
    GF_SECURITY_ADMIN_PASSWORD=<Grafana admin password>
    
  5. Run docker compose --env-file=../.env up -d.

  6. Open localhost:8086 (InfluxDB) via browser.

  7. Generate API Token for the bucket.

  8. Open localhost:8080 (Grafana) via browser.

  9. Setup InfluxDB integration.

    • Query languabe
      • Flux
    • HTTP
    • Auth
      • (None)
    • InfluxDB Details
      • Set the information
  10. Move to "sensor" directory.

  11. Set environment variables.

    $ENV:INFLUXDB_BASE_URL = "http://localhost:8086"
    $ENV:INFLUXDB_TOKEN = "<InfluxDB user token>"
    $ENV:INFLUXDB_ORG = "<InfluxDB organization>"
    $ENV:INFLUXDB_BUCKET = "<InfluxDB bucket>"
    
  12. Run npx tsc ./src

  13. Run node ./dist/main.js

  14. Open localhost:8080 (Grafana) via browser.

  15. Check the data.

co2-mini's People

Contributors

akihisa1210 avatar

Stargazers

Okada Genya avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.