Coder Social home page Coder Social logo

blockpenn-python's Introduction

Blockpenn-python

Python code for the RPi sensors.

See our Documentation Website.

Installation

Tested with Ubuntu 22.04 LTS Server 64 bit.

  1. Complete deploying the docker image of blockpenn on the RPi.
  2. Set up the environment.
  3. (Optional) Use test_pcb.py to test the different components on the PCB. This will let you know if there are any issues with a specific component (e.g. sensor, OLED).
  4. Run sensor_start_w_sps_v2.py manually to test the setup.
  5. Set up crontab to auto start the script in reboot.

sensor_start_w_sps_v2

This is the Python code with all sensors (Air quality, CO2, Humidity & Temp) and OLED display. This code is designed for the V2 of the SensorBoard.

Environment setup

This part covers how to set up the environment.

Setting up the environment (Manual)

This is only needed if you didn't run the script to set up the environment. General:

sudo python3 -m venv .
source ./bin/activate
sudo apt install python3-pip
sudo pip3 install influxdb
sudo python3 -m pip install simple-term-menu
sudo apt install python3-lgpio
sudo apt-get install libgpiod2
sudo apt install -y python3-rpi.gpio
sudo apt install -y python3-pil
git clone https://github.com/adafruit/Adafruit_Python_SSD1306.git
cd Adafruit_Python_SSD1306
sudo pip3 install Adafruit_SSD1306
sudo python3 setup.py install
cd ..
sudo pip3 install adafruit-circuitpython-shtc3
sudo pip3 install sps30
sudo pip3 install smbus2

Setting up the environment (Script)

Note: currently not working

There are two ways to set up the environment:

  1. Using a script (recommended)
  2. Manually
sudo sh setup_pkg.sh
sh setup_env.sh

Then run:

cd Adafruit_Python_SSD1306
sudo pip3 install Adafruit_SSD1306
sudo python3 setup.py install
cd ..
sudo pip3 install adafruit-circuitpython-shtc3
sudo pip3 install smbus2
sudo pip3 install influxdb

Set up crontab to auto start the script in reboot

Open crontab:

sudo crontab -e

Pick your preferred editor and add the following line to the crontab file:

@reboot sh /home/ubuntu/blockpenn-python/run_sensor_script.sh >> /var/log/sensor_script.log 2>&1

Test by rebooting.

Links

Documentation Website

Our awesome documentation website was created using docsify

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.