使用バージョン
「2024-03-12-raspios-bookworm-armhf-lite.img」を使用
ユーザー登録
ユーザー「raspi」パスワード「raspi」
SSH serverを設定
$ sudo raspi-config
3 Interface Options Configure connections to peripherals
I1 SSH Enable/disable remote command line access using SSH
Would you like the SSH server to be enabled?
Yes
参考 https://qiita.com/m4saka/items/e79f8a4b4e24dcd99406
キーバインドを変更
$ sudo vi /etc/default/keyboard
#XKBOPTIONS="lv3:ralt_switch"
XKBOPTIONS="lv3:ralt_switch,ctrl:swapcaps"
再起動が必要
参考 https://raspibb.blogspot.com/2015/04/caps-lockctrl.html
Model/OSの状態を参照
$ cat /proc/device-tree/model
Raspberry Pi 3 Model B Plus Rev 1.3
$ uname -a
Linux raspberrypi 6.6.20+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.20-1+rpt1 (2024-03-07) aarch64 GNU/Linux
$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
参考 https://qiita.com/fudekun/items/f3dc680f1655eaf84d09
システムを更新
sudo apt update
sudo apt -y upgrade
スクリーンセーバーを停止
$ sudo raspi-config
2 Display Options Configure display settings
D2 Screen Blanking Enable/disable screen blanking
Would you like to enable screen blanking?
No
再起動が必要
参考 https://log.mkuriki.com/raspi-stop-screensaver/
ロケールを設定
$ sudo raspi-config
5 Localisation Options Configure language and regional settings
L1 Locale Configure language and regional settings
[*] ja_JP.UTF-8 UTF-8
Default locale for the system environment: ja_JP.UTF-8
タイムゾーンを設定
$ sudo raspi-config
5 Localisation Options Configure language and regional settings
L2 Timezone Configure time zone
Asia
Tokyo
参考 https://qiita.com/kanamekun/items/1698b8990622d587e556
WLANカントリーコードを設定
$ sudo raspi-config
5 Localisation Options Configure language and regional settings
L4 WLAN Country Set legal wireless channels for your country
JP Japan
無線デバイスのブロック解除を確認
$ sudo rfkill
ID TYPE DEVICE SOFT HARD
0 bluetooth hci0 unblocked unblocked
1 wlan phy0 unblocked unblocked
~/.bash_aliases
alias l='ls -lF'
alias la='ls -lFa'
alias lt='ls -lFt'
alias lsf='ls -F'
alias lsrc='ls -l *.c *.h *.cpp'
alias d='dirs'
alias da='date'
alias h='history'
alias pd='pushd'
alias pd2='pushd +2'
alias pd3='pushd +3'
alias pd4='pushd +4'
alias md='mkdir'
alias j='jobs'
~/.vimrc
set ts=4
set nowrapscan
開発環境を設定
$ sudo apt -y install git
$ git config --global user.name "Taro Nihon"
$ git config --global user.email "taro@foo.co.jp"
$ git config --global credential.helper store
$ git clone https://git-codecommit.us-east-2.amazonaws.com/v1/repos/Foo
4GWANとWifiAPを設定
リンク https://qiita.com/carpenders/items/ae6b242db06f7839692f
WifiAPとEthernetを設定
nmcliコマンド有り https://qiita.com/carpenders/items/179ac990467b0ca6eb89
nmcliコマンド無し https://qiita.com/carpenders/items/6e2a023d5ad3df33ef59
ルーティングを設定 https://qiita.com/carpenders/items/8f8dd70d416ab32fcfb0
ArduinoIDEでM5Stack
リンク https://qiita.com/carpenders/items/6bc277cdeef521f8182f
PlatformIOでM5Stack
リンク https://qiita.com/carpenders/items/27c229b1c48ef2bf2eeb
Gmailの送信サーバーを使う
リンク https://qiita.com/carpenders/items/67a667ddfdebe8c49036
NTPクライアントに設定
$ sudo vi /etc/systemd/timesyncd.conf
以下を末尾に追加
NTP=ntp.jst.mfeed.ad.jp ntp.nict.jp
FallbackNTP=time.google.com
$ sudo timedatectl set-ntp true
$ sudo systemctl daemon-reload
$ sudo systemctl restart systemd-timesyncd
参考 https://gris-et-blanc.net/raspi/152/
ネットワーク通信を調査
sudo apt -y install tcpdump
インターフェースを指定する場合
$ sudo tcpdump -i eth0
$ sudo tcpdump -i wlan0
表示形式を16進に指定
$ sudo tcpdump -i wlan0 -x
RaspberryPiでttyポートを使う
リンク https://qiita.com/carpenders/items/26b8fbc2d9eabc94ed30
forkとexec
tmpfsとramdiskを使う
リンク https://qiita.com/carpenders/items/77753cdd2393ed7ee31c
GPIOを使う
GPIO25の場合、以下ではエラーになる
$ echo 25 > /sys/class/gpio/export
-bash: echo: write error: Invalid argument
なので以下を実行
$ cat /sys/kernel/debug/gpio | grep GPIO25
gpio-537 (GPIO25 )
$ echo 537 > /sys/class/gpio/export
$ cat /sys/kernel/debug/gpio | grep GPIO25
gpio-537 (GPIO25 |sysfs ) out lo
$ echo 1 > /sys/class/gpio/gpio537/value
$ cat /sys/kernel/debug/gpio | grep GPIO25
gpio-537 (GPIO25 |sysfs ) out hi
$ echo 0 > /sys/class/gpio/gpio537/value
$ cat /sys/kernel/debug/gpio | grep GPIO25
gpio-537 (GPIO25 |sysfs ) out lo
$ echo 537 > /sys/class/gpio/unexport
$ cat /sys/kernel/debug/gpio | grep GPIO25
gpio-537 (GPIO25 )
参考
https://forum.odroid.com/viewtopic.php?t=38349
https://www.radical-dreamer.com/programming/raspberry-pi-gpio-clang/
slee-Pi3
sleepi3-monitor
設定項目の説明 https://github.com/mechatrax/sleepi3-monitor
$ sudo vi /etc/sleepi3-monitor/monitor.yml
sleepi3-utils
設定項目の説明 https://github.com/mechatrax/sleepi3-utils
$ sudo vi /etc/default/sleepi3
リンク
https://github.com/mechatrax/slee-pi3
https://mechatrax.com/blog/what-is-possible-with-sleepi3/
https://qiita.com/miyoshii/items/37f100647b7489354dfa
pigpio
Pi-Protectのi2cデバイスを走査
$ ls -l /dev/i2c*
crw-rw---- 1 root i2c 89, 1 Apr 10 17:25 /dev/i2c-1
crw-rw---- 1 root i2c 89, 20 Apr 10 17:25 /dev/i2c-20
crw-rw---- 1 root i2c 89, 21 Apr 10 17:25 /dev/i2c-21
$ i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- 6e UU
70: -- -- -- -- -- -- -- --
シングルユーザーモード起動
cmdline.txtの行末に"init=/bin/sh"を追記
$ umount /
$ mount -o remount,rw /dev/mmcblk0p2 /
systemd
サービスを再読み込み
$ sudo systemctl daemon-reload
サービスを開始
$ sudo systemctl start imi
サービスを停止
$ sudo systemctl stop imi
自動起動を有効に
$ sudo systemctl enable imi
自動起動を無効に
$ sudo systemctl disable imi
サービスステータスを表示
$ sudo systemctl status
リンク
https://tomosoft.jp/design/?p=11697
RTC
link
https://qiita.com/vascodagama/items/6fae12853e861614635a
tcp TIME_WAIT
link
https://alexei-karamazov.hatenadiary.org/entry/20130709/1373378999
https://ez-net.jp/article/FB/beofK19H/z5CwHgjxeJRA/
https://ryuichi1208.hateblo.jp/entry/2019/10/31/202728
python + QT
C:\Users\masumi>pip install PySide2
Collecting PySide2
Downloading PySide2-5.15.2.1-5.15.2-cp35.cp36.cp37.cp38.cp39.cp310-none-win_amd64.whl (137.4 MB)
| | 137.4 MB 6.4 MB/s
Collecting shiboken2==5.15.2.1
Downloading shiboken2-5.15.2.1-5.15.2-cp35.cp36.cp37.cp38.cp39.cp310-none-win_amd64.whl (2.3 MB)
| | 2.3 MB 6.4 MB/s
Installing collected packages: shiboken2, PySide2
Successfully installed PySide2-5.15.2.1 shiboken2-5.15.2.1
WARNING: You are using pip version 21.2.3; however, version 24.0 is available.
You should consider upgrading via the 'C:\Users\masumi\AppData\Local\Programs\Python\Python39\python.exe -m pip install --upgrade pip' command.
C:\Users\masumi>pip install pyqtgraph
Collecting pyqtgraph
Downloading pyqtgraph-0.13.6-py3-none-any.whl (1.9 MB)
| | 1.9 MB 6.8 MB/s
Collecting numpy>=1.22.0
Downloading numpy-1.26.4-cp39-cp39-win_amd64.whl (15.8 MB)
| | 15.8 MB 6.4 MB/s
Installing collected packages: numpy, pyqtgraph
Successfully installed numpy-1.26.4 pyqtgraph-0.13.6
WARNING: You are using pip version 21.2.3; however, version 24.0 is available.
You should consider upgrading via the 'C:\Users\masumi\AppData\Local\Programs\Python\Python39\python.exe -m pip install --upgrade pip' command.
C:\Users\masumi>pip install schedule
Collecting schedule
Downloading schedule-1.2.1-py2.py3-none-any.whl (11 kB)
Installing collected packages: schedule
Successfully installed schedule-1.2.1
WARNING: You are using pip version 21.2.3; however, version 24.0 is available.
You should consider upgrading via the 'C:\Users\masumi\AppData\Local\Programs\Python\Python39\python.exe -m pip install --upgrade pip' command.
C:\Users\masumi>
Makefile .d
Makeifle ヘッダーファイルとソース・ファイルの依存関係
link
https://zenn.dev/sitorasu/articles/0cbfb05863b265
https://auewe.hatenablog.com/entry/2017/02/08/195625
Raspi + VSCode
リンク
https://www.mgo-tec.com/blog-entry-raspi4-vscode-ssh01.html
raspi-config コマンドライン
リンク
https://github.com/raspberrypi/documentation/blob/develop/documentation/asciidoc/computers/configuration/raspi-config.adoc
https://qiita.com/mt08/items/d27085ac469a34526f72
sudo cat >> file
link
https://zenn.dev/dkmats/articles/a127aafd5be633
wifi クライアント
link
https://qiita.com/hayat00/items/34d550de4ad38e455529
https://raspida.com/wifi4raspbian#wi-fi%E3%81%AE%E8%A8%AD%E5%AE%9A-cui%E7%B7%A8
https://dev.classmethod.jp/articles/raspberrypi-remote-connect/
https://www.raspberrypirulo.net/entry/wirelesslan#CUI%E3%81%A7%E3%81%AE%E8%A8%AD%E5%AE%9A%E6%96%B9%E6%B3%95
https://qiita.com/nishiwakki/items/5889892de9d6a983b960
https://signal-flag-z.blogspot.com/2019/05/raspberrypi-dhcpcd-networkmanager.html
https://qiita.com/monamu/items/7ff0aad37055822fc068