- AHT10: measures humidity in % and temperature in Celcius. Not use anymore.
- AHT21: measures humidity in % and temperature in Celcius.
- CCS811(board name is CJMCU-811): measures equivalent CO2 in ppm and Total Volatile Organic Compound in ppb. Not use anymore.
- Notice: nWAKE should be LOW
- BME680: measure temperature, humidity, pressure, air quarity.
- MCP9808: measure temperature
- SSD1306: 128x64 pixel OLED display
sudo apt install i2c-tools
then, try
i2cdetect -y 0
#### Trouble shooter
If there is error,
Error: Could not open file `/dev/i2c-3': Permission denied
Run as root?
add your user to i2c
group,
sudo usermod -aG i2c your_username
and reboot.
Used python packages:
pyi2c
: to communicate with I2C devices. This includessmbus2
influxdb_client
: to save measurement data to InfluxDB server
Install python packages
pip install -r requirements.txt
or
pip3 install pyi2c influxdb_client
In shell, type this to add new environment variable.
export INFLUXDB_TOKEN=your_token_here
Or, create a script file, such as env.sh
#!/bin/bash
# env.sh
export INFLUXDB_TOKEN=your_token_here
and type in the shell
source env.sh
python3 i2c.py
Run in background
nohup 2>&1 python3 i2c.py &
# nohup python3 i2c.py > logs/i2c.out &
Edit /etc/rc.local
and add below lines
# -----------------------------------------
# i2c
cd __current_directory_path__
sudo -u __username__ ./startup.sh
# -----------------------------------------
To check rc.local, run
sudo systemctl status rc-local
- django
pip3 install django
./runserver.sh
python3 manage.py migrate --fake monitor zero
find . -path "*/migrations/*.py" -not -name "__init__.py" -delete
find . -path "*/migrations/*.pyc" -delete
python3 manage.py makemigrations
python3 manage.py migrate --fake-initial