Coder Social home page Coder Social logo

icy's Introduction

Icy

System for reading measurements with Bosch BME280 sensors, sending them to central MQTT server and displaying recorded measurements on a webpage.

It is meant to be installed on raspberry pi running raspbian.

This repository contains client program for pi and esp8622 microcontroller and server program for pi. Clients collect measurements, server stores them on a database and serves them on a webpage.

Compiling for Raspberry Pi

How to compile icy-server and icy-client to pi.

Use cross for cross compiling to raspberry pi. Using just cargo --target=armv7-unknown-linux-gnueabihf would be possible if there were none C dependencies, but Diesel depends on libpq.

  1. Install cross: cargo install cross
  2. Download cross source: git clone https://github.com/rust-embedded/cross.git
  3. Modify armv7-unknown-linux-gnueabihf Dockerfile, see for changes.
    • Run git apply cross-changes.patch in cross repo to copy changes. Changes:
    • Change Ubuntu to Debian Stretch
    • Enable Debian multiarch for armhf arch.
    • Install armhf version of libpq-dev.
  4. Build the modifed Dockerfile ./build-docker-image.sh armv7-unknown-linux-gnueabihf
  5. Compile with cross: cross build --target armv7-unknown-linux-gnueabihf --release

Creating a deb package

cargo-deb is used for creating a .deb file.

  1. Install cargo-deb: cargo install cargo-deb
  2. Create a .deb file from binary built with cross cargo deb --no-build --target armv7-unknown-linux-gnueabihf
  3. Copy target to pi. scp target/armv7-unknown-linux-gnueabihf/debian/<name>.deb <address>:.
  4. Install dpkg -i <name>.deb
  5. Modify configure file on pi. /usr/local/etc/icy-client/icy-client.toml or /usr/local/etc/icy-server/icy-server.toml

Setup Postgresql

apt install postgresql
sudo -u postgres psql

Create application user and database.

create database measurements;
create user measurements;
alter user measurements with password 'pass';
grant all privileges on database measurements to measurements;

Run migrations

Install diesel cli: https://github.com/diesel-rs/diesel/tree/master/diesel_cli

Change to icy-server directory.

Locally:

diesel migration run --database-url postgresql://measurements:pass@localhost/measurements

On remote server:

ssh -L 9000:localhost:5432 example.com
# Open a new shell
diesel migration run --database-url postgresql://measurements:pass@localhost:9000/measurements

Setup Mosquitto

apt install mosquitto

Configure user for server and clients with mosquitto_passwd.

icy's People

Contributors

usarekoski avatar

Stargazers

MA Jianjun avatar

Watchers

James Cloos avatar  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.