Myriam  Rogahn

Myriam Rogahn

1599020340

Learn NixOS by turning a Raspberry Pi into a Wireless Router

I recently moved, and my new place has a relatively small footprint. (Yes, I moved during the COVID-19 pandemic. And yes, it was crazy.) I quickly realized that was going to need a wireless router of some sort, or more formally, a wireless access point (WAP). Using my Ubuntu laptop’s “wireless hotspot” capability was a nice temporary solution, but it had a few serious drawbacks.

Drawbacks of hotspotting with a laptop

  • The wireless internet goes out whenever I would travel with the laptop,
  • The laptop had to be close to the modem, so that it could be plugged into ethernet, making my laptop not even portable within the apartment,
  • The SSID was my laptop’s hostname,
  • The WPA password would be set to a random string whenever the hotspot was started, and so
  • Whenever I moved my laptop I would also need to reset the credentials on all of my wireless devices!

Additionally, some of my coworkers are Nix true believers. While I had read the NixOS docs, I had never actually taken it for a spin. Consider this my first few steps down the /etc/nixos path, because, while I lacked a WiFi router, I did have an errant Raspberry Pi 3B+ lying around…

Too Long; Didn’t Read

Be sure to fill out the SSID and WPA passphrase in the file below.

/etc/nixos/configuration.nix

{ config, pkgs, lib, ... }:
{
  ## NixOS wants to enable GRUB by default
  boot.loader.grub.enable = false;
  ## Enables the generation of /boot/extlinux/extlinux.conf
  boot.loader.generic-extlinux-compatible.enable = true;

  ## use an older kernel, so that we can actually boot
  boot.kernelPackages = pkgs.linuxPackages_4_19;

  ## Needed for the virtual console to work on the RPi 3, as the default of 16M
  ## doesn't seem to be enough. If X.org behaves weirdly (I only saw the cursor)
  ## then try increasing this to 256M.
  boot.kernelParams = ["cma=32M"];

  ## File systems configuration for using the installer's partition layout
  fileSystems = {
    "/" = {
      device = "/dev/disk/by-label/NIXOS_SD";
      fsType = "ext4";
    };
  };

  ## Recommended swap file is optional
  swapDevices = [ { device = "/swapfile"; size = 1024; } ];

  ## packages
  environment.systemPackages = with pkgs; [ hostapd dnsmasq bridge-utils ];

  ## add wireless service
  hardware.enableRedistributableFirmware = true;
  networking.wireless.enable = true;

  ## set up wireless access point
  networking.networkmanager.unmanaged = [ "interface-name:wlan*" ]
    ++ lib.optional config.services.hostapd.enable "interface-name:${config.services.hostapd.interface}";
  services.hostapd = {
    enable = true;
    interface = "wlan0";
    hwMode = "g";
    ssid = "<YOUR NETWORK NAME HERE>";
    wpaPassphrase = "<YOUR PASSWORD HERE>";
  };

  ## set up wireless static IP address
  networking.interfaces.wlan0.ip4 = lib.mkOverride 0 [ ];
  networking.interfaces.wlan0.ipv4.addresses =
    lib.optionals config.services.hostapd.enable [{ address = "192.168.0.1"; prefixLength = 24; }];

  ## set up wireless DNS
  services.dnsmasq = lib.optionalAttrs config.services.hostapd.enable {
    enable = true;
    extraConfig = ''
      interface=wlan0
      bind-interfaces
      dhcp-range=192.168.0.10,192.168.0.254,24h
    '';
  };
  networking.firewall.allowedUDPPorts = lib.optionals config.services.hostapd.enable [53 67];
  services.haveged.enable = config.services.hostapd.enable;

  ## Finally, bridge ethernet and wifi
  networking.bridges.br0.interfaces = [ "eth0" "wlan0" ];
}

#nixos #raspberry pi #wireless router #python

What is GEEK

Buddha Community

Myriam  Rogahn

Myriam Rogahn

1599020340

Learn NixOS by turning a Raspberry Pi into a Wireless Router

I recently moved, and my new place has a relatively small footprint. (Yes, I moved during the COVID-19 pandemic. And yes, it was crazy.) I quickly realized that was going to need a wireless router of some sort, or more formally, a wireless access point (WAP). Using my Ubuntu laptop’s “wireless hotspot” capability was a nice temporary solution, but it had a few serious drawbacks.

Drawbacks of hotspotting with a laptop

  • The wireless internet goes out whenever I would travel with the laptop,
  • The laptop had to be close to the modem, so that it could be plugged into ethernet, making my laptop not even portable within the apartment,
  • The SSID was my laptop’s hostname,
  • The WPA password would be set to a random string whenever the hotspot was started, and so
  • Whenever I moved my laptop I would also need to reset the credentials on all of my wireless devices!

Additionally, some of my coworkers are Nix true believers. While I had read the NixOS docs, I had never actually taken it for a spin. Consider this my first few steps down the /etc/nixos path, because, while I lacked a WiFi router, I did have an errant Raspberry Pi 3B+ lying around…

Too Long; Didn’t Read

Be sure to fill out the SSID and WPA passphrase in the file below.

/etc/nixos/configuration.nix

{ config, pkgs, lib, ... }:
{
  ## NixOS wants to enable GRUB by default
  boot.loader.grub.enable = false;
  ## Enables the generation of /boot/extlinux/extlinux.conf
  boot.loader.generic-extlinux-compatible.enable = true;

  ## use an older kernel, so that we can actually boot
  boot.kernelPackages = pkgs.linuxPackages_4_19;

  ## Needed for the virtual console to work on the RPi 3, as the default of 16M
  ## doesn't seem to be enough. If X.org behaves weirdly (I only saw the cursor)
  ## then try increasing this to 256M.
  boot.kernelParams = ["cma=32M"];

  ## File systems configuration for using the installer's partition layout
  fileSystems = {
    "/" = {
      device = "/dev/disk/by-label/NIXOS_SD";
      fsType = "ext4";
    };
  };

  ## Recommended swap file is optional
  swapDevices = [ { device = "/swapfile"; size = 1024; } ];

  ## packages
  environment.systemPackages = with pkgs; [ hostapd dnsmasq bridge-utils ];

  ## add wireless service
  hardware.enableRedistributableFirmware = true;
  networking.wireless.enable = true;

  ## set up wireless access point
  networking.networkmanager.unmanaged = [ "interface-name:wlan*" ]
    ++ lib.optional config.services.hostapd.enable "interface-name:${config.services.hostapd.interface}";
  services.hostapd = {
    enable = true;
    interface = "wlan0";
    hwMode = "g";
    ssid = "<YOUR NETWORK NAME HERE>";
    wpaPassphrase = "<YOUR PASSWORD HERE>";
  };

  ## set up wireless static IP address
  networking.interfaces.wlan0.ip4 = lib.mkOverride 0 [ ];
  networking.interfaces.wlan0.ipv4.addresses =
    lib.optionals config.services.hostapd.enable [{ address = "192.168.0.1"; prefixLength = 24; }];

  ## set up wireless DNS
  services.dnsmasq = lib.optionalAttrs config.services.hostapd.enable {
    enable = true;
    extraConfig = ''
      interface=wlan0
      bind-interfaces
      dhcp-range=192.168.0.10,192.168.0.254,24h
    '';
  };
  networking.firewall.allowedUDPPorts = lib.optionals config.services.hostapd.enable [53 67];
  services.haveged.enable = config.services.hostapd.enable;

  ## Finally, bridge ethernet and wifi
  networking.bridges.br0.interfaces = [ "eth0" "wlan0" ];
}

#nixos #raspberry pi #wireless router #python

Tools and Images to Build a Raspberry Pi n8n server

n8n-pi

Tools and Images to Build a Raspberry Pi n8n server

Introduction

The purpose of this project is to create a Raspberry Pi image preconfigured with n8n so that it runs out of the box.

What is n8n?

n8n is a no-code/low code environment used to connect and automate different systems and services. It is programmed using a series of connected nodes that receive, transform, and then transmit date from and to other nodes. Each node represents a service or system allowing these different entities to interact. All of this is done using a WebUI.

Why n8n-pi?

Whevever a new technology is released, two common barriers often prevent potential users from trying out the technology:

  1. System costs
  2. Installation & configuration challenges

The n8n-pi project eliminates these two roadblocks by preconfiguring a working system that runs on easily available, low cost hardware. For as little as $40 and a few minutes, they can have a full n8n system up and running.

Thanks!

This project would not be possible if it was not for the help of the following:

Documentation

All documentation for this project can be found at http://n8n-pi.tephlon.xyz.

Download Details:

Author: TephlonDude

GitHub: https://github.com/TephlonDude/n8n-pi

#pi #raspberry pi #raspberry #raspberry-pi

TensorFlow Lite Object Detection using Raspberry Pi and Pi Camera

I have not created the Object Detection model, I have just merely cloned Google’s Tensor Flow Lite model and followed their Raspberry Pi Tutorial which they talked about in the Readme! You don’t need to use this article if you understand everything from the Readme. I merely talk about what I did!

Prerequisites:

  • I have used a Raspberry Pi 3 Model B and PI Camera Board (3D printed a case for camera board). **I had this connected before starting and did not include this in the 90 minutes **(plenty of YouTube videos showing how to do this depending on what Pi model you have. I used a video like this a while ago!)

  • I have used my Apple Macbook which is Linux at heart and so is the Raspberry Pi. By using Apple you don’t need to install any applications to interact with the Raspberry Pi, but on Windows you do (I will explain where to go in the article if you use windows)

#raspberry-pi #object-detection #raspberry-pi-camera #tensorflow-lite #tensorflow #tensorflow lite object detection using raspberry pi and pi camera

The Raspberry Pi 400 - A full computer in a keyboard!

The Raspberry Pi 400 has arrived in the studio, and in this video I’ll give it a review. I’ll show an unboxing of the Personal Computer Kit from Canakit, which is a great way to get started on the Pi 400. Then I’ll show off the hardware, as well as the out-of-box experience.

#raspberry pi #pi #raspberry-pi

Jerad  Bailey

Jerad Bailey

1598891580

Google Reveals "What is being Transferred” in Transfer Learning

Recently, researchers from Google proposed the solution of a very fundamental question in the machine learning community — What is being transferred in Transfer Learning? They explained various tools and analyses to address the fundamental question.

The ability to transfer the domain knowledge of one machine in which it is trained on to another where the data is usually scarce is one of the desired capabilities for machines. Researchers around the globe have been using transfer learning in various deep learning applications, including object detection, image classification, medical imaging tasks, among others.

#developers corner #learn transfer learning #machine learning #transfer learning #transfer learning methods #transfer learning resources