Raspberry Pi Raspbian

From My Mnemonic Rhyme
Revision as of 15:45, 26 August 2023 by Weiss (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

einfach ein leeres file namens ssh auf die boot partition kopieren.

  • default user/passs
Distribution   | Username   | Password
---------------|------------|-------------
Debian Squeeze | pi         | raspberry
Arch           | root       | root
QtonPi         | root       | rootme
Raspbian       | pi         | raspberry
OpenElec       | root       | openelec

timesyncd

edit /etc/systemd/timesyncd.conf and uncomment ntp section!

sudo systemctl enable systemd-timesyncd --now
timedatectl
sudo timedatectl set-ntp false
sudo timedatectl set-ntp true
timedatectl show-timesync

Sensors, InfluxDB, MQTT and Grafana

GPIO

sudo apt-get install rpi.gpio
sudo apt install python3-rpi.gpio
sudo apt install wiringpi
import RPi.GPIO as GPIO 
from time import sleep 
GPIO.setwarnings(False) 

pin = 4
 
GPIO.setmode(GPIO.BCM) 
GPIO.setup(pin, GPIO.OUT) 
 
while True: 
    GPIO.output(pin, True) 
    sleep(1) 
    GPIO.output(pin, False) 
    sleep(1) 

analog digital converters ADS1015 / ADS1115

https://piddlerintheroot.com/analog-to-digital-converter/

sudo i2cdetect -y 1

networking

Note: With stretch release networking is configured in /etc/dhcpcd.conf

static eth0:

# Example static IP configuration:                                              
interface eth0                                                                  
static ip_address=10.1.0.101/24                                                 
#static ip6_address=fd51:42f8:caae:d92e::ff/64                                  
static routers=10.1.10.1                                                        
static domain_name_servers=10.1.0.1 8.8.8.8   

default if names

add to cmdline.txt:

net.ifnames=0

wifi

generate config string via

wpa_passphrase ssid pw

add config entry via

/etc/wpa_supplicant/wpa_supplicant.conf
  • copy wpa_supplicant.conf to boot partition!

SSH

To enable SSH-Server create an empty file /boot/ssh or /boot/ssh.txt

webcam

moisture sensor

# sudo pip3 install adafruit-circuitpython-ads1x15
import time
import json
import board
import busio
import adafruit_ads1x15.ads1015 as ADS
from adafruit_ads1x15.analog_in import AnalogIn

max_val = None
min_val = None

# Create the I2C bus
i2c = busio.I2C(board.SCL, board.SDA)

# Create the ADC object using the I2C bus
ads = ADS.ADS1015(i2c)

# Create single-ended input on channel 0
channels = [AnalogIn(ads, ADS.P0), AnalogIn(ads, ADS.P1)]

print("------{:>5}\t{:>5}".format("raw", "v"))
while True:
    for can in cannels:
        print("CHAN 0: "+"{:>5}\t{:>5.3f}".format(chan.value, chan.voltage))
        time.sleep(0.5)

Problem: kein analoger GPIO