Raspberry Pi - Relay Control

raspberry pi v1 with relay board and buck converters for inputs

Part 1: General setup

  • run raspbian-ua-netinst on SD card (default install - server packages of debian buster)
  • SSH in as root…
> /etc/motd
echo rpi-sound-relay > /etc/hostname
sed -i s/pi/rpi-sound-relay/g /etc/hosts
apt-get update && apt-get --no-install-recommends install aptitude

systemctl disable ssh.service && systemctl enable ssh.socket

ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime
echo "America/Chicago" > /etc/timezone
dpkg-reconfigure -f noninteractive tzdata
sed -i -e 's/^# en_US.UTF-8/en_US.UTF-8/' /etc/locale.gen
dpkg-reconfigure -f noninteractive locales

aptitude full-upgrade

aptitude install netcat-traditional screen rsync psmisc file patch ethtool strace tcpdump vim bzip2 xz-utils
aptitude --without-recommends install dnsutils

aptitude install watchdog
sed -i -e 's/^#watchdog-device/watchdog-device/g' /etc/watchdog.conf
sed -i -e 's/^#max-load-1\t/max-load-1\t/g' /etc/watchdog.conf
echo "# Raspberry Pi doesn't work with the default timeout of 60; set it to 10 instead" >> /etc/watchdog.conf
echo $'watchdog-timeout\t= 10' >> /etc/watchdog.conf

adduser tdobes
adduser tdobes adm
adduser tdobes systemd-journal

aptitude install ifplugd
sed -i -e 's/^INTERFACES=""/INTERFACES="eth0"/g' /etc/default/ifplugd
sed -i -e 's/^allow-hotplug eth0/#allow-hotplug eth0/g' /etc/network/interfaces
systemctl restart ifplugd

# Clean-up and optimization

systemctl disable rsyslog.service
systemctl disable rsync.service
systemctl disable sshswitch.service
systemctl stop rsyslog.service
rm /var/log/auth.log* /var/log/daemon.log* /var/log/debug /var/log/kern.log* /var/log/messages /var/log/user.log* /var/log/syslog

Part 2: Relays

aptitude install python3-pigpio
mkdir -p /etc/systemd/system/pigpiod.service.d
echo '[Service]' > /etc/systemd/system/pigpiod.service.d/restart.conf
echo 'Restart=always' >> /etc/systemd/system/pigpiod.service.d/restart.conf
echo 'RestartSec=2' >> /etc/systemd/system/pigpiod.service.d/restart.conf

systemctl enable pigpiod && systemctl start pigpiod
computer/raspberry_pi_relay_control.txt · Last modified: 2019/08/07 01:48 by tdobes
Recent changes RSS feed Driven by DokuWiki Valid XHTML 1.0 Valid CSS