Tag Archives: Raspberry

Steuerung von Lüfter und Trockner im Keller

Nach einigen früheren Projekten auf Basis des Raspberry Pi Zero kommt hier nun ein viertes mit dem Temperatur und Luftfeuchte im Keller und der Aussenluft bestimmt wird. Es funktioniert auf Basis des häufig verwendeten SHTC3 Sensors.

 

 

Da die physikalische I2C Adresse des SHTC3 nicht geändert werden kann, brauchen wir zusätzlich ein Mux Board, das mit einer Lötbrücke auf dem ADR0 Jumper die Adresse von 0x70 auf 0x71 ändert.

#!/usr/bin/env python3

import csv
import board
import busio
import adafruit_shtc3
from adafruit_tca9548a import TCA9548A

def main():
  # Initialize the iic bus
  i2c = busio.I2C(board.SCL, board.SDA)

  # Initialize the TCA9548A multiplexer
  mux = TCA9548A(i2c, address=0x71)

  # Initialize the SHTC3 sensor on MUX channel 0
  shtc3_channel_0 = adafruit_shtc3.SHTC3(mux[0])

  # Initialize the SHTC3 sensor on MUX channel 1
  shtc3_channel_1 = adafruit_shtc3.SHTC3(mux[1])

  with open("/home/admin/www/taupunkt.log","a+") as out_file:
    tsv_writer = csv.writer(out_file, delimiter='\t')
    temperature0, relative_humidity0 = read_shtc3(shtc3_channel_0)
    temperature1, relative_humidity1 = read_shtc3(shtc3_channel_1)
    dt = time.strftime('%Y-%m-%d %H:%M:%S')
    tsv_writer.writerow([dt,
      temperature0,relative_humidity0,
      temperature1,relative_humidity1])

if __name__ == '__main__':
main()

Damit kann nun nach Bedarf ein Lüfter angesteuert werden, mit unter 40€ Bauteilen statt mit 570€ Fertiglösung. Als smarte Steckdosen gibt es zB die Edimax Smartplug SP1101W auf der ein Webserver läuft der curl Befehle annimmt.


CC-BY-NC

Glad to help

Raspberry Pis are small single-board computers. As I have two of these devices already up and logging solar power production on my roof they could do even more: They are not only supporting a green environment but can also help people from countries with repressive governments by installation of another software package.

Snowflake is a system to defeat internet censorship. People who are censored can use Snowflake to access the internet. Their connection goes through Snowflake proxies, which are run by volunteers.

https://www.wjst.de/blog/wp-content/uploads/2022/09/FdWznhmXgAMwDgO-1.png

Setup takes only 2 minutes – full instructions are at kuketz-blog.de

# sudo apt-get install git
# sudo apt-get install golang
git clone https://git.torproject.org/pluggable-transports/snowflake.git
cd snowflake/proxy
go build
nohup /home/pi/snowflake/proxy/proxy > /home/pi/www/snowflake.log 2>&1 &;

and this is the result

2022/09/25 17:44:19 In the last 1h0m0s, there were 16 connections. Traffic Relayed ↑ 33 MB, @ 5 MB.
2022/09/25 18:44:19 In the last 1h0m0s, there were 27 connections. Traffic Relayed ↑ 170 MB, @ 48 MB.
2022/09/25 19:44:19 In the last 1h0m0s, there were 11 connections. Traffic Relayed ↑ 61 MB, @ 28 MB.
2022/09/25 20:44:19 In the last 1h0m0s, there were 19 connections. Traffic Relayed ↑ 90 MB, @ 27 MB.
2022/09/25 21:44:19 In the last 1h0m0s, there were 10 connections. Traffic Relayed ↑ 41 MB, @ 12 MB.
...

CC-BY-NC