Skip to content

NCKU-CCS/smart-room-sensor

Repository files navigation

smart room - sensor

Smart Room Sensors

A detailed description of the CT-Arduino is in the Arduino/README.md file.

Getting Started

Prerequisites

  • python 3.7

Config

Update .env setting file

cp env.sample .env
# update .env file

General Packages

Installing General Packages

pip3 install requests python-dotenv loguru

Services

Read data from Smart Meter via modbus.

Packages

# minimalmodbus for modbus communication
pip3 install minimalmodbus

env example

Set Modbus USB Port.

MODBUS_PORT=/dev/ttyUSB0

How to know PORT name from Pi:

ls /dev/tty*

Running

python3 meter.py

Read data from DHT Sensor.

Packages

Customize Adafruit_DHT package: make DHT11 data accuracy to one decimal place.

env example

  • PIN: PIN Number
  • DHT_TYPE: DHT Sensor Type
    • DHT11: DHT11
    • DHT22: AM2302 or DHT22
DHT_PIN=27
DHT_TYPE=AM2302

Running

python3 thermo_sensor.py

CT Sensor

由於 SCT013-100 是透過類比訊號回傳電流資訊(細節見Arduino Readme),樹莓派無法直接讀取類比訊號,因此需透過 ADC (Analog-to-digital converter) 將類比訊號數位化。 以下有多種收集資料的方式。

RPi read meter data from CT sensor via Arduino and save to local CSV file.

Packages

pip3 install pyserial

env example

Set Arduino USB Port.

ARDUINO_PORT=/dev/ttyUSB0

How to know PORT name from Pi:

ls /dev/tty*

Running

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

Packages

pip3 install pyserial

env example

Set Arduino USB Port.

ARDUINO_PORT=/dev/ttyUSB0

How to know PORT name from Pi:

ls /dev/tty*

Running

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

Packages

pip3 install pyserial

env example

Set RPICT8_PORT USB Port.

RPICT8_PORT=/dev/ttyUSB0

How to know PORT name from Pi:

ls /dev/tty*

Running

python3 read_RPICT8.py

Save Data

save_data.py

  • upload_data : upload data to data center via HTTP POST request. Note: upload_data will REBOOT Pi when internet error

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published