Raspberry Pi Raspbian: Difference between revisions
Jump to navigation
Jump to search
(→GPIO) |
No edit summary |
||
Line 58: | Line 58: | ||
sleep(1) | sleep(1) | ||
</pre> | </pre> | ||
= analog digital converters ADS1015 / ADS1115 = | |||
https://piddlerintheroot.com/analog-to-digital-converter/ | |||
<pre> | |||
sudo i2cdetect -y 1 | |||
</pre> | |||
=networking= | =networking= | ||
Note: With stretch release networking is configured in /etc/dhcpcd.conf | Note: With stretch release networking is configured in /etc/dhcpcd.conf | ||
Line 97: | Line 99: | ||
=moisture sensor= | =moisture sensor= | ||
<pre> | |||
# 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) | |||
</pre> | |||
* https://piddlerintheroot.com/capacitive-soil-moisture-sensor-v2-0/ | |||
* https://tutorials-raspberrypi.de/raspberry-pi-giessomat-kapazitiver-erdfeuchtigkeitssensor/ | * https://tutorials-raspberrypi.de/raspberry-pi-giessomat-kapazitiver-erdfeuchtigkeitssensor/ | ||
* https://how2electronics.com/interface-capacitive-soil-moisture-sensor-arduino/ | * https://how2electronics.com/interface-capacitive-soil-moisture-sensor-arduino/ |
Latest revision as of 15:45, 26 August 2023
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
- https://www.raspberrypi.org/documentation/usage/gpio/
- https://www.instructables.com/id/Controlling-Any-Device-Using-a-Raspberry-Pi-and-a-/
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
- https://tutorials-raspberrypi.de/raspberry-pi-ueberwachungskamera-livestream-einrichten/
- https://siytek.com/raspberry-pi-rtsp-to-home-assistant/
- https://www.raspberrypi-spy.co.uk/2017/04/detection-area-masking-in-motioneyeos-raspberry-pi/
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)
- https://piddlerintheroot.com/capacitive-soil-moisture-sensor-v2-0/
- https://tutorials-raspberrypi.de/raspberry-pi-giessomat-kapazitiver-erdfeuchtigkeitssensor/
- https://how2electronics.com/interface-capacitive-soil-moisture-sensor-arduino/
- https://maker.pro/raspberry-pi/tutorial/interfacing-soil-moisture-sensor-with-raspberry-pi
Problem: kein analoger GPIO
- normalerweise wird ein MCP3008 Wandler benötigt
- https://iot4beginners.com/analog-inputs-for-raspberry-pi-using-the-mcp3008/
- Es geht aber auch via RC Schaltung:
- https://www.raspberrypi-spy.co.uk/2012/08/reading-analogue-sensors-with-one-gpio-pin/
- https://www.gadgetexplained.com/2016/05/4-ways-to-get-raspberry-pi-to-read.html