User Tools

Site Tools


programming:raspberry_pi_notes

Login prompt when connecting USB null modem cable

File: /etc/udev/rules.d/99-ttyusb.rules

 KERNEL=="ttyUSB0", ACTION=="add",\
   PROGRAM="/bin/systemctl start usb-serial-ttyUSB0.service"

File: /etc/systemd/system/usb-serial-ttyUSB0.service

 [Unit]
 BindTo=/dev/ttyUSB0
 After=/dev/ttyUSB0.device
 
 [Service]
 Type=oneshot
 TimeoutStartSec=300
 ExecStart=/sbin/getty -L ttyUSB0 115200 vt100

Note: journalctl reports an error when unplugging the USB device. But it doesn't seem to be a problem.

Disable WIFI and Blutooth

to disable onboard WiFi and BT on Pi3 add the following to file: /boot/config.txt

 dtoverlay=pi3-disable-wifi
 dtoverlay=pi3-disable-bt

For pi4 you can use

 dtoverlay=disable-wifi
 dtoverlay=disable-bt

Disable IPv6

to disable IPv6 add the following to file: /boot/config.txt

 ipv6.disable=1

Reduce write IO to SD card

Albeit there are different approaches to this I typically start by disabling logging to disk.

First disable rsyslogd

 systemctl disable rsyslog

Then instruct journalctl to store it's log in volatile memory (ram)

Edit file: /etc/systemd/journald.conf and change the line

 #Storage=auto

to

 Storage=volatile

Reboot for changes to take effect.

Check CPU temperature

 vcgencmd measure_temp

Static IP address

Edit the file: /etc/dhcpcd/dhcpcd.conf

 # Example static IP configuration:
 interface eth0
 static ip_address=192.168.0.10/24
 static ip6_address=fd51:42f8:caae:d92e::ff/64
 static routers=192.168.0.1
 static domain_name_servers=192.168.0.1 8.8.8.8 fd51:42f8:caae:d92e::1

ipv6 stuff is not necessary and can be omitted.

Static IP can also be setup in /etc/network/inerfaces.d/eth0 as described in Network and IPtables Ubuntu section. Then /etc/dhcpcd.conf needs the line

denyinterfaces eth0

Enable Power Button

to enable a power button connected between GND and GPIO3 add the following to file: /boot/config.txt

dtoverlay=gpio.shutdown
programming/raspberry_pi_notes.txt ยท Last modified: 2022/06/10 19:19 by 127.0.0.1