🛠 Building a NAS and Home Automation Hub with BPI-CM5

Banana Pi BPI-CM5: Amlogic A311D2 Compute Module with Raspberry Pi CM4 Compatibility · intermediaire · Transformez votre Banana Pi BPI-CM5 en serveur de fichiers et centre de contrôle domotique grâce à ses interfaces réseau et USB.

Objectives

This tutorial aims to configure the Banana Pi BPI-CM5 as a lightweight Network Attached Storage (NAS) server and a home automation hub. By leveraging the Gigabit Ethernet connectivity for transfer speeds and USB 3.0 ports for external drives, we will create a reliable solution for data backup and running lightweight services. The focus is on resource optimization using the hybrid Cortex-A73 and A53 core architecture.

Required Hardware

Steps

  1. System Preparation: Install Ubuntu or Debian on the module via the USB OTG interface or an SD card if supported by your carrier board. Ensure the network is functional with ip a.
  2. Disk Identification: Connect your USB drive. Identify it using lsblk. Note the device name (e.g., /dev/sda1).
  3. Formatting and Mounting: If the drive is new, format it as ext4: sudo mkfs.ext4 /dev/sda1. Create a mount point: sudo mkdir -p /mnt/nas. Mount it: sudo mount /dev/sda1 /mnt/nas.
  4. Automatic Mounting: Edit /etc/fstab to mount the drive at startup. Add the line: /dev/sda1 /mnt/nas ext4 defaults 0 2. Test with sudo mount -a.
  5. Samba Installation: To share files, install Samba: sudo apt update && sudo apt install samba -y. Create a Samba user: sudo smbpasswd -a pi.
  6. Share Configuration: Edit /etc/samba/smb.conf. Add a section: [Share] path = /mnt/nas browseable = yes writable = yes guest ok = no valid users = pi.
  7. Service Start: Restart Samba: sudo systemctl restart smbd. Enable it on boot: sudo systemctl enable smbd.
  8. Home Assistant Installation: For home automation, install Docker: curl -fsSL https://get.docker.com | sh. Add the user to the docker group: sudo usermod -aG docker $USER. Log out and log back in.
  9. Launch Home Assistant: Run the standard Docker command for Home Assistant in container mode, mapping the configuration volume to /mnt/nas/homeassistant to persist data.

Verification

Access the Samba interface from another computer (Windows/Linux/Mac) via the BPI-CM5's IP address. Verify that you can write and read files. For Home Assistant, open a web browser and go to http://<PI_IP>:8123. You should see the initial setup screen. Check CPU load with htop to ensure services do not saturate the cores.

Further Reading

Explore using the MIPI-CSI interfaces to add a local surveillance camera processed directly by the 16MP ISP. You can also configure automatic cloud backups via rclone or use the HDMI receiver ports for advanced multimedia applications.

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials