Catalog / NanoPi Cheat Sheet

NanoPi Cheat Sheet

A comprehensive cheat sheet covering NanoPi single-board computers, their specifications, setup, and common operations.

NanoPi Overview

NanoPi Models

NanoPi NEO

Ultra-small, low-power, ideal for IoT applications.

NanoPi NEO2

Improved performance over NEO, still compact.

NanoPi M4

Higher performance, suitable for media and desktop use.

NanoPi R2S

Dual Gigabit Ethernet ports, designed for routing applications.

NanoPi 4

Powerful board with good memory and speed, for desktop and server purposes.

Key Features

CPU

ARM Cortex-A53, Cortex-A72, or similar architectures, depending on the model.

Memory

256MB to 4GB DDR3/DDR4 RAM, depending on the model.

Storage

MicroSD card slot for OS and data storage. Some models have eMMC.

Connectivity

USB, Ethernet (depending on the model), WiFi/Bluetooth (some models).

GPIO

Headers for connecting sensors, actuators, and other peripherals.

Operating Systems

Most NanoPi boards support various Linux distributions, including:

  • Armbian
  • Ubuntu Core
  • DietPi
  • FriendlyCore

Initial Setup

Flashing the OS

  1. Download the desired OS image for your NanoPi model.

  2. Use a tool like dd (Linux) or Rufus (Windows) to flash the image to a MicroSD card.

    Example (Linux):

sudo dd bs=4M if=image.img of=/dev/sdX conv=fsync

    Replace `/dev/sdX` with the correct device for your SD card.

First Boot

  1. Insert the MicroSD card into the NanoPi.
  2. Connect a monitor (if applicable), keyboard, and mouse.
  3. Connect the power supply.
  4. The NanoPi should boot automatically. If not, check your power supply and connections.

Accessing the NanoPi

Via SSH

Most distributions enable SSH by default. Find the NanoPi’s IP address and connect using:

ssh user@nanopi_ip

Default username/password combinations vary by distribution.

Via Serial Console

Connect a USB-to-TTL serial adapter to the NanoPi’s serial pins. Use a terminal program like minicom or PuTTY to connect.

Example (minicom):

minicom -D /dev/ttyUSB0 -b 115200

Common Operations

System Updates

Update the package lists and upgrade installed packages.

Ubuntu/Debian:

sudo apt update
sudo apt upgrade

Arch Linux:

sudo pacman -Syu

Networking

Checking IP Address

Use ifconfig or ip addr to display network interface information and IP addresses.

ifconfig
ip addr

Configuring Static IP

Edit the network configuration file (e.g., /etc/network/interfaces on Debian/Ubuntu, /etc/systemd/network/ on systemd-based systems) to set a static IP address.

Example (/etc/network/interfaces):

auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4

GPIO Control

Using `gpio` command

Many distributions include a gpio command-line utility for controlling GPIO pins. Install it if necessary.

Example (Armbian):

sudo apt install wiringpi
gpio readall

Using Python (RPi.GPIO)

The RPi.GPIO library (although named for Raspberry Pi) can often be used on NanoPi boards. Install it and use it to control GPIO pins from Python.

sudo pip install RPi.GPIO

Example:

import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.OUT)
GPIO.output(17, GPIO.HIGH)

Troubleshooting

Common Issues

  1. No Boot:
    • Check the MicroSD card is properly inserted and flashed with a valid OS image.
    • Verify the power supply is adequate.
  2. Network Connectivity Issues:
    • Ensure the Ethernet cable is connected properly.
    • Check the network configuration.
    • Verify the NanoPi is obtaining an IP address.
  3. GPIO Problems:
    • Double-check wiring connections.
    • Ensure the correct GPIO pin numbering scheme is being used (BCM vs. physical).

Debugging Tips

Serial Console Output

Connect to the serial console to view boot messages and debug information. This is often the best way to diagnose boot problems.

LED Indicators

Check the LEDs on the NanoPi board. They often provide status information, such as power, network activity, and SD card access.

Checking Logs

Check system logs for errors, such as /var/log/syslog or use journalctl.

journalctl -xe

Resources

  1. FriendlyElec Wiki: The official documentation source for NanoPi boards.
  2. Armbian Forums: A good place to find support and information about Armbian on NanoPi.
  3. Online Communities: Check forums and communities dedicated to embedded systems and single-board computers.