Smart Room Sensors
- Thermo Sensor
- DHT11, DHT22 Thermo Data
- Smart Meter
- Smart Meter Data
- 1 CT Sensor - Arduino - Save Local
- Read one CT Sensor Data
- Save to local CSV file
- 6 CT Sensor - Arduino - Save DB
- CT Sensor Data
- Save to Remote database
- CT Sensor - RPICT8
- CT Sensor Data from RPICT8
A detailed description of the CT-Arduino is in the Arduino/README.md file.
- python 3.7
Update .env
setting file
cp env.sample .env
# update .env file
Installing General Packages
pip3 install requests python-dotenv loguru
Read data from Smart Meter via modbus.
# minimalmodbus for modbus communication
pip3 install minimalmodbus
Set Modbus USB Port.
MODBUS_PORT=/dev/ttyUSB0
How to know PORT name from Pi:
ls /dev/tty*
python3 meter.py
Read data from DHT Sensor.
Customize Adafruit_DHT
package: make DHT11 data accuracy to one decimal place.
- PIN: PIN Number
- DHT_TYPE: DHT Sensor Type
- DHT11: DHT11
- DHT22: AM2302 or DHT22
DHT_PIN=27
DHT_TYPE=AM2302
python3 thermo_sensor.py
由於 SCT013-100 是透過類比訊號回傳電流資訊(細節見Arduino Readme),樹莓派無法直接讀取類比訊號,因此需透過 ADC (Analog-to-digital converter) 將類比訊號數位化。 以下有多種收集資料的方式。
RPi read meter data from CT sensor via Arduino and save to local CSV file.
pip3 install pyserial
Set Arduino USB Port.
ARDUINO_PORT=/dev/ttyUSB0
How to know PORT name from Pi:
ls /dev/tty*
python3 read_arduino_one.py
Read data from CT sensor from Arduino via serial signal.
CT Sensor --Aanlog Signal-> Arduino --Serial Signal--> Raspberry pi --HTTP-> Data Center
pip3 install pyserial
Set Arduino USB Port.
ARDUINO_PORT=/dev/ttyUSB0
How to know PORT name from Pi:
ls /dev/tty*
python3 read_arduino.py
Read data from CT sensor via RPICT8 with serial signal.
Docs: Notion
CT Sensor --Aanlog Signal-> RPICT8 --Serial Signal--> Raspberry pi --HTTP-> Data Center
pip3 install pyserial
Set RPICT8_PORT USB Port.
RPICT8_PORT=/dev/ttyUSB0
How to know PORT name from Pi:
ls /dev/tty*
python3 read_RPICT8.py
upload_data
: upload data to data center via HTTP POST request. Note:upload_data
will REBOOT Pi when internet error