Skip to content

Instantly share code, notes, and snippets.

@slickplaid
Created July 30, 2018 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slickplaid/f4139138570ce3fcafb8e377fd3f3f5c to your computer and use it in GitHub Desktop.
Save slickplaid/f4139138570ce3fcafb8e377fd3f3f5c to your computer and use it in GitHub Desktop.
Raspberry PI Temperature Sensor BME280 Installation Script
#!/usr/bin/env bash
# raspi zero w
# 2->VIN
# 3->SDI
# 5->SCK
# 6->GND
# be in home
cd
# export variables
echo "export NODE_NAME=\"horus2\"" >> ~/.bashrc
echo "export HTTP_PORT=\"8000\"" >> ~/.bashrc
# load the new vars
source ~/.bashrc
# update the system
sudo apt-get update
sudo apt-get upgrade -y
# get the tools
sudo apt-get install \
build-essential \
python-pip \
python-dev \
python-smbus \
git \
python-boto \
python-rrdtool \
rrdtool \
curl \
wget \
vim
# pip tendo for singleton support
pip install tendo
# get the repos
git clone https://github.com/adafruit/Adafruit_Python_GPIO.git
git clone https://github.com/adafruit/Adafruit_Python_BME280.git
git clone https://github.com/avirtuos/pi_zero.git
# Install the GPIO handler
sudo python ./Adafruit_Python_GPIO/setup.py install
# test things out
python ./Adafruit_Python_BME280/Adafruit_BME280_Example.py
# add cron job
(crontab -l ; echo "@reboot (sleep 25;/home/pi/pi_zero/bme280/pi_collectd.py)&") | sort - | uniq - | crontab -
# make sure it has a dir to write to
mkdir -p ~/data
# run it
~/pi_zero/bme280/pi_collectd.py &
sleep 100
curl localhost:8000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment