Created
July 30, 2018 17:46
-
-
Save slickplaid/f4139138570ce3fcafb8e377fd3f3f5c to your computer and use it in GitHub Desktop.
Raspberry PI Temperature Sensor BME280 Installation Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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