dasl- / pifi

10 stars 1 forks source link

pifi

:toc: :toclevels: 5 :toc-placement!:

image::https://lh3.googleusercontent.com/50Q5aQS7kWFsroNjzMIAM1pqVv42ulz_HItEhe2L8xTaOFm2AilcrGnE-fDCPQp0yWgW7cwHRb4f-xewnBwltcw0uFNSf3Cr0rMYlcJwHqVRCap3w8IQ9M4Udi9wRc-mVDdev1I8Z1JBOG5AVuqcpQL0BAIBUWdLRRDBOrXLuQQfYntW8PVBvr-2BXv88lZlFz9a98cHZDFcW3UobFMXGKrZEOd7sEE4KwrNQNgNni3hd3RgLs3CQui1WWuphBTj1ddxzoNUOCPpue26bYFjQI7KKeAtExC5gzQTYki1wMvaugi7My8W9DhBoENevYFDAXuJ2FuiEFPkTMy47ZFDx6QmSwBIuDtG55FqVjlnKj4HoJl8z8peLmV2ZVBte_6BA5geY5U9XT8Euhd93t3XrMs0O7N4VdcbA7SGetj7OKzlw1Fbj3K7wl0mSvEuomQAnSjVwIxnT9V9WuEe0Dy1h7dQ1EtqMJdcmCVf9pvzxMUiUIW3I1K82uS1liqHHd_aLaijgTdSYhus0pgKOIexfpGxEfghjXF6Ye8Va4xyggpkZ9qIQxr5aTkkVeabTrtnBA-CC8g3YmJcIGIjlxd5CY_I3OzzQ6OjdFl4DF-dP6Wu1MjafiTT_LH2wifY4iyigNCLZ322vk2_vJTymZkjIBnCR7HvgDIdSbIMw6CBuzW-42C-n6qulXQ7nyYc0YNt4GXGti4iacyy48hFgpuzBljU=w1125-h625-no["PiFi", link=https://photos.app.goo.gl/hCSq6Vcvd1VbCVPs8]

toc::[]

Setting up from Scratch

Install Raspian Lite

https://www.raspberrypi.org/documentation/installation/installing-images/mac.md

  1. diskutil list
  2. sd_disk_num=<disk# from diskutil>
  3. diskutil unmountDisk /dev/disk$sd_disk_num
  4. download Raspberry Pi OS Lite image from https://www.raspberrypi.org/software/operating-systems/
  5. sudo dd bs=1m if=path_of_your_image.img of=/dev/rdisk$sd_disk_num; sync
  6. sudo diskutil eject /dev/rdisk$sd_disk_num

Set up Wifi

https://raspberrypi.stackexchange.com/a/57023[`/boot/wpa_supplicant.conf`]:

country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
  ssid="MyWiFiNetwork"
  psk="MyPassword"
  key_mgmt=WPA-PSK
}

Note: after this repo has been cloned, wifi may be set up via link:utils/wifi_config[utils/wifi_config]:

sudo ./utils/wifi_config --network-name <name> --password <password>

Enable ssh, Connect

  1. create a file /boot/ssh to enable SSH on the raspberry pi
  2. plug in raspberry pi
  3. find its IP: sudo arp-scan --interface=en0 --localnet or sudo nmap -sS -p 22 192.168.1.0/24
  4. ssh in ssh <USER>@<IP_ADDRESS>; enter password

Setup Raspberry Pi

  1. sudo raspi-config -- change password -- enable SPI (interfacing options)
  2. sudo apt-get update
  3. sudo apt-get upgrade -y
  4. sudo apt-get install git

Setup Git

  1. ssh-keygen -t rsa -b 4096 -C “your@email.com”
  2. eval "$(ssh-agent -s)"
  3. ssh-add ~/.ssh/id_rsa
  4. more ~/.ssh/id_rsa.pub (copy to git)
    1. https://help.github.com/en/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account
    2. https://github.com/settings/keys

Checkout Repo

  1. git clone git@github.com:dasl-/pifi.git
  2. cd pifi

Install

. Create a config file: https://github.com/dasl-/pifi/blob/main/default_config.json[`config.json]. The config file should set all of the required config parameters. ../install/install_dependencies.sh ../install/install.sh .. This may result in an https://gist.github.com/dasl-/25a6db0322f7b61ba0b3b7f3436fb975[out of memory error]. If that happens, simply re-run the install script. It should succeed the second time. . optional reboot to confirm services come up automatically and cleanly from a reboot:sudo shutdown -r now` . Check for https://github.com/dasl-/pifi/blob/main/docs/issues_weve_seen_before.adoc#cpu-throttling[CPU throttling]

Vanity domain name (optional):

. After running https://github.com/dasl-/pifi/blob/f4b16dfa625211d5aa9666b420e60834bb05e93e/install/install.sh#L72-L78[`./install/install.sh], you can SSH onto the pi or hit the pifi webpage viapifi.local(i.e.:ssh @pifi.localand http://pifi.local ). Note: using http://pifi.local will not work on https://partnerissuetracker.corp.google.com/issues/140786115[android devices]. . Optionally reserve an IP address for the pifi on your router (if it supports this) . Note if you choose 192.168.1.166 for the reserved IP, then the domain name http://pifi.club/ will resolve to your pi on your wifi network :) .. FreshTomato router firmware has a settingEnable DNS Rebind protection`, which is enabled by default. When this is enabled, it will prevent upstream DNS servers from resolving queries to any non-routable IP (e.g., 192.168.1.X). So you need to disable this feature for the vanity URL to work.

Connect GPIO Pins

(pinout: https://pinout.xyz/)

Hacking on the code:

See link:docs/development_setup.md[development_setup]

Issues we've seen before

See link:docs/issues_weve_seen_before.adoc[issues we've seen before]

Branch rename

On 2022-04-30, we renamed the branch from master to main. Run these commands to update your local checkout:

git branch -m master main
git fetch origin
git branch -u origin/main main
git remote set-head origin -a