{"id":16655510,"url":"https://github.com/aaronrenner/internet_monitor_system_rpi0","last_synced_at":"2025-08-05T12:24:59.649Z","repository":{"id":138358107,"uuid":"249477272","full_name":"aaronrenner/internet_monitor_system_rpi0","owner":"aaronrenner","description":null,"archived":false,"fork":false,"pushed_at":"2020-03-26T03:05:29.000Z","size":3095,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-12T18:45:07.936Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aaronrenner.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"open_collective":"nerves-project"}},"created_at":"2020-03-23T15:59:54.000Z","updated_at":"2022-12-07T21:27:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"b97f4c46-89c0-4d5c-bfea-e2189af92fc1","html_url":"https://github.com/aaronrenner/internet_monitor_system_rpi0","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/aaronrenner/internet_monitor_system_rpi0","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaronrenner%2Finternet_monitor_system_rpi0","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaronrenner%2Finternet_monitor_system_rpi0/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaronrenner%2Finternet_monitor_system_rpi0/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaronrenner%2Finternet_monitor_system_rpi0/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aaronrenner","download_url":"https://codeload.github.com/aaronrenner/internet_monitor_system_rpi0/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaronrenner%2Finternet_monitor_system_rpi0/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265311989,"owners_count":23745176,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T09:53:16.337Z","updated_at":"2025-07-14T15:33:13.034Z","avatar_url":"https://github.com/aaronrenner.png","language":"Elixir","funding_links":["https://opencollective.com/nerves-project"],"categories":[],"sub_categories":[],"readme":"# Raspberry Pi Model Zero\n\n[![CircleCI](https://circleci.com/gh/nerves-project/nerves_system_rpi0.svg?style=svg)](https://circleci.com/gh/nerves-project/nerves_system_rpi0)\n[![Hex version](https://img.shields.io/hexpm/v/nerves_system_rpi0.svg \"Hex version\")](https://hex.pm/packages/nerves_system_rpi0)\n\nThis is the base Nerves System configuration for the Raspberry Pi Zero and\nRaspberry Pi Zero W.\n\nIf you are *not* interested in [Gadget Mode](http://www.linux-usb.org/gadget/)\nthen check out\n[nerves_system_rpi](https://github.com/nerves-project/nerves_system_rpi).  That\nsystem configures the USB port in host mode by default and is probably more\nappropriate for your setup.\n\n![Fritzing Raspberry Pi Zero image](assets/images/raspberry-pi-model-zero.png)\n\u003cbr\u003e\u003csup\u003e[Image credit](#fritzing)\u003c/sup\u003e\n\n| Feature              | Description                     |\n| -------------------- | ------------------------------- |\n| CPU                  | 1 GHz ARM1176JZF-S              |\n| Memory               | 512 MB                          |\n| Storage              | MicroSD                         |\n| Linux kernel         | 4.19 w/ Raspberry Pi patches    |\n| IEx terminal         | UART `ttyAMA0` Can be changed to HDMI |\n| GPIO, I2C, SPI       | Yes - [Elixir Circuits](https://github.com/elixir-circuits) |\n| ADC                  | No                              |\n| PWM                  | Yes, but no Elixir support      |\n| UART                 | 1 available - `ttyAMA0`         |\n| Camera               | Yes - via rpi-userland          |\n| Ethernet             | No                              |\n| WiFi                 | Supported on the Pi Zero W      |\n| Bluetooth            | Not supported yet               |\n| Audio                | HDMI/Stereo out                 |\n\n## Using\n\nThe most common way of using this Nerves System is create a project with `mix\nnerves.new` and to export `MIX_TARGET=rpi0`. See the [Getting started\nguide](https://hexdocs.pm/nerves/getting-started.html#creating-a-new-nerves-app)\nfor more information.\n\nIf you need custom modifications to this system for your device, clone this\nrepository and update as described in [Making custom\nsystems](https://hexdocs.pm/nerves/systems.html#customizing-your-own-nerves-system)\n\nIf you're new to Nerves, check out the\n[nerves_init_gadget](https://github.com/nerves-project/nerves_init_gadget)\nproject for creating a starter project for the Raspberry Pi Zero or Zero W. It\nwill get you started with the basics like bringing up the virtual Ethernet\ninterface, initializing the writable application data partition, and enabling\nssh-based firmware updates.\n\n## USB OTG support\n\nOne of the goals of this system is to make it possible to do most development\nvia one USB cable. That cable, when plugged into the USB OTG port, powers the\nRaspberry Pi Zero and provides local networking. Via the network connection, one\ncan access an IEx prompt via ssh, transfer files via sftp, run firmware updates,\nuse Erlang distribution and anything else that works over IP.\n\nIMPORTANT: The Raspberry Pi Zero has two USB ports. The OTG one is the \"middle\"\none. The other one is power-only.\n\nWhen you connect the USB OTG port to your laptop, it should \"just\" work if\nyou're using OSX or Linux. If you're on Windows and want to access networking\nnatively (not through a Linux VM), you will need to install\n[`linux.inf`](https://elixir.bootlin.com/linux/v4.19.102/source/Documentation/usb/linux.inf).\nThis file is unsigned and will fail to install unless you disable signed driver\nenforcement. The basic idea is to go to settings, go to the advanced boot\nsettings and navigate the menus to boot with it off. There are examples on the\nweb.\n\n## Console and kernel message configuration\n\nIf you're debugging networking or the boot process, you'll want to use the\nRaspberry Pi's UART pins on the GPIO connector (the HDMI output can be made to\nwork, but won't be a good development experience).\n\nYou will need to use a USB-to-UART adapter and connect it to the UART pins on\nthe Raspberry Pi's GPIO header. Make sure to use a USB-to-UART adapter with 3.3V\nlogic levels. This is most of them and to make things confusing, most adapters\ncan supply 5V. Just don't connect the 5V wire.\n\n## Supported WiFi devices\n\nThe base image includes drivers for the onboard Raspberry Pi Zero W wifi module\n(`brcmfmac` driver). Due to the USB port being placed in gadget mode, this\nsystem does not support USB WiFi adapters.\n\n## Audio\n\nThe Raspberry Pi has many options for audio output. This system supports the\nHDMI and stereo audio jack output. The Linux ALSA drivers are used for audio\noutput.\n\nTo try it out, run:\n\n```elixir\ncmd(\"espeak -ven+f5 -k5 -w /tmp/out.wav Hello\")\ncmd(\"aplay -q /tmp/out.wav\")\n```\n\nThe general Raspberry Pi audio documentation mostly applies to Nerves. For\nexample, to force audio out the HDMI port, run:\n\n```elixir\ncmd(\"amixer cset numid=3 2\")\n```\n\nChange the last argument to `amixer` to `1` to output to the stereo output jack.\n\n## Provisioning devices\n\nThis system supports storing provisioning information in a small key-value store\noutside of any filesystem. Provisioning is an optional step and reasonable\ndefaults are provided if this is missing.\n\nProvisioning information can be queried using the Nerves.Runtime KV store's\n[`Nerves.Runtime.KV.get/1`](https://hexdocs.pm/nerves_runtime/Nerves.Runtime.KV.html#get/1)\nfunction.\n\nKeys used by this system are:\n\nKey                    | Example Value     | Description\n:--------------------- | :---------------- | :----------\n`nerves_serial_number` | `\"12345678\"`      | By default, this string is used to create unique hostnames and Erlang node names. If unset, it defaults to part of the Raspberry Pi's device ID.\n\nThe normal procedure would be to set these keys once in manufacturing or before\ndeployment and then leave them alone.\n\nFor example, to provision a serial number on a running device, run the following\nand reboot:\n\n```elixir\niex\u003e cmd(\"fw_setenv nerves_serial_number 12345678\")\n```\n\nThis system supports setting the serial number offline. To do this, set the\n`NERVES_SERIAL_NUMBER` environment variable when burning the firmware. If you're\nprogramming MicroSD cards using `fwup`, the commandline is:\n\n```sh\nsudo NERVES_SERIAL_NUMBER=12345678 fwup path_to_firmware.fw\n```\n\nSerial numbers are stored on the MicroSD card so if the MicroSD card is\nreplaced, the serial number will need to be reprogrammed. The numbers are stored\nin a U-boot environment block. This is a special region that is separate from\nthe application partition so reformatting the application partition will not\nlose the serial number or any other data stored in this block.\n\nAdditional key value pairs can be provisioned by overriding the default\nprovisioning.conf file location by setting the environment variable\n`NERVES_PROVISIONING=/path/to/provisioning.conf`. The default provisioning.conf\nwill set the `nerves_serial_number`, if you override the location to this file,\nyou will be responsible for setting this yourself.\n\n## Linux kernel and RPi firmware/userland\n\nThere's a subtle coupling between the `nerves_system_br` version and the Linux\nkernel version used here. `nerves_system_br` provides the versions of\n`rpi-userland` and `rpi-firmware` that get installed. I prefer to match them to\nthe Linux kernel to avoid any issues. Unfortunately, none of these are tagged by\nthe Raspberry Pi Foundation so I either attempt to match what's in Raspbian or\ntake versions of the repositories that have similar commit times.\n\n## Installation\n\nIf you're new to Nerves, check out the\n[nerves_init_gadget](https://github.com/fhunleth/nerves_init_gadget) project for\ncreating a starter project for the Raspberry Pi Zero or Zero W. It will get you\nstarted with the basics like bringing up the virtual Ethernet interface,\ninitializing the application partition, and enabling ssh-based firmware updates.\n\n## Linux kernel configuration notes\n\nThe Linux kernel compiled for Nerves is a stripped down version of the default\nRaspberry Pi Linux kernel. This is done to remove unnecessary features, select\nsome Nerves-specific features, and to save space. To reproduce the kernel\nconfiguration found here, do the following (this is somewhat tedious):\n\n1. Start with `arch/arm/configs/bcmrpi_defconfig`. This is the kernel\n   configuration used in the official Raspberry Pi images.\n1. Turn off all filesystems except for `ext4`, `squashfs`, `tmpfs`, `proc`,\n   `sysfs`, and `vfat`. Squashfs only needs ZLIB support.\n1. `vfat` needs to default to `utf8`. Enable native language support for\n   `ascii`, `utf-8`, `ISO 8859-1`, codepage 437, and codepage 850.\n1. Disable all network drivers and wireless LAN drivers except for Broadcom\n   FullMAC WLAN.\n1. Disable PPP and SLIP\n1. Disable the WiFi drivers in the Staging drivers menus\n1. Disable TV, AM/FM, Media USB adapters, DVB Frontends and Remote controller\n   support in the Multimedia support menus.\n1. Go to `Device Drivers-\u003eSound card support`. Disable `USB sound devices` in\n   ALSA. Disable `Open Sound System`.\n1. Go to `Device Drivers-\u003eGraphics support`. Disable `DisplayLink`\n1. Disable everything in `HID support` (NOTE: revisit for Bluetooth)\n1. Disable everything in input device support (can't plug it in anyway)\n1. In the `Device Drivers \u003e USB support` menu, enable gadget mode and disable\n   all host mode. It should be possible to completely disable USB host mode if\n   all of the USB drivers in previous steps were disabled. See `DesignWare USB2\n   Core Support-\u003eDWC Mode Selection` and select `CDC Composite Device (Ethernet\n   and ACM)`. If you want dual mode USB host/gadget support, you'll need to\n   reenable a few things. There have been unresolved issues in the past with dual\n   mode support. It's possible that they are fixed, but be sure to test. They were\n   noticed on non-Mac platforms.\n1. In `Kernel Features`, select `Preemptible Kernel (Low-Latency Desktop)`,\n    disable the memory allocator for compressed pages.\n1. In `Userspace binary formats`, disable support for MISC binaries.\n1. In `Networking support`, disable Amateur Radio support, CAN bus subsystem,\n    IrDA subsystem, Bluetooth, WiMAX, Plan 9, and NFC. (TBD - this may be too\n    harsh, please open issues if you're using any of these and it's the only\n    reason for you to create a custom system.)\n1. In `Networking options`, disable IPsec, SCTP, Asynchronous Transfer Mode,\n    802.1d Ethernet Bridging, L2TP, VLAN, Appletalk, 6LoWPAN, 802.15.4, DNS\n    Resolver, B.A.T.M.A.N, Open vSwitch, MPLS, and the Packet Generator in Network\n    testing.\n1. In `Networking support-\u003eWireless`, enable \"use statically compiled regulatory\n    rules database\". Build in `cfg80211` and `mac80211`. Turn off `mac80211` mesh\n    networking and LED triggers. Turn off `cfg80211` wireless extensions\n    compatibility.\n1. In `Kernel hacking`, disable KGDB, and Magic SysRq key.\n1. In Device Drivers, disable MTD support. In Block devices, disable everything\n    but Loopback and RAM block device. Disable SCSI device support. Disable RAID\n    and LVM.\n1. In `Enable the block layer`, deselect everything but the PC BIOS partition\n    type (i.e., no Mac partition support, etc.).\n1. In `Enable loadable module support`, select \"Trim unused exported kernel\n    symbols\". NOTE: If you're having trouble with an out-of-tree kernel module\n    build, try deselecting this!!\n1. In `General Setup`, turn off `initramfs/initfd` support, Kernel .config\n   support, OProfile.\n1. In `Device Drivers -\u003e I2C -\u003e Hardware Bus Support` compile the module into\n   the kernel and disable everything but `BCM2708 BSC` support.\n1. In `Device Drivers -\u003e SPI` compile in the BCM2835 SPI controller and User\n   mode SPI device driver support.\n1. In `Device Drivers -\u003e Dallas's 1-wire support`, disable everything but the\n    GPIO 1-Wire master and the thermometer slave. (NOTE: Why is the thermometer\n    compiled in? This seems historical.)\n1. Disable `Hardware Monitoring support`, `Sonics Silicon Backplane support`\n1. In `Device Drivers -\u003e Character devices -\u003e Serial drivers`, disable 8250 and\n    SC16IS7xx support. Disable the RAW driver.\n1. In `Networking support-\u003eNetwork options`, disable `IP: kernel level\n    autoconfiguration`\n1. In `Networking support-\u003eNetwork options-\u003eTCP: advanced congestion control`\n    disable everything except for `CUBIC TCP`.\n1. Disable `Real Time Clock`.\n1. Disable everything in `Cryptographic API` and `Library routines` that can be\n    disabled. Sometimes you need to make multiple passes.\n1. Disable EEPROM 93CX6 support, PPS support, all GPIO expanders, Speakup core,\n    Media staging drivers, STMicroelectronics STMPE, anything \"Wolfson\".\n1. Disable most ALSA for SoC audio support and codecs. NOTE: We probably should\n    support a few, but I have no clue which ones are most relevant and there are\n    tons of device drivers in the list.\n1. Disable IIO and UIO.\n1. Disable NXP PCA9685 PWM driver\n\n## Additional config\n\nFrom `mix nerves.system.shell`,\n\nConfigure base OS packages with `make menuconfig`.\n\n1. `Target Packages`: Select `Show packages that are also provided by busybox`\n1. `Target Packages-\u003eShell and utilities`: Enable `bash`\n\nConfigure busybox with `make busybox-menuconfig`.\n\n1. In `Networking Utilites`, select `ping`.\n\n[Image credit](#fritzing): This image is from the [Fritzing](http://fritzing.org/home/) parts library.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faaronrenner%2Finternet_monitor_system_rpi0","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faaronrenner%2Finternet_monitor_system_rpi0","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faaronrenner%2Finternet_monitor_system_rpi0/lists"}