Raspberry Pi Setup
Install Raspbian Buster on Raspberry Pi 3B+
- Use Raspberry Pi Imager v1.5 on Ubuntu 18.04 Linux
- Download Raspbian/Raspberry Pi OS from https://downloads.raspberrypi.org/raspios_lite_armhf/images/raspios_lite_armhf-2021-03-25/2021-03-04-raspios-buster-armhf-lite.zip)
Preparation of Raspbian Buster
Raspi needs to be connected to the LAN via an Ethernet cable. For the first steps the Raspi is connected via HDMI to a monitor. After enabling SSH it is possible to connect via SSH/terminal from the Ubuntu Laptop to the Raspi.
- Change default password of
pi
user:- Default credentials: username:
pi
, password:raspberry
- Default credentials: username:
passwd
Changed password to comatrix
- (Optionally) Change keyboard setting to
German
and reboot:
sudo dpkg-reconfigure keyboard-configuration
- Configure static IP settings depending on your LAN setup:
sudo nano /etc/network/interfaces
auto eth0
iface eth0 inet static
address 192.168.1.106
netmask 255.255.255.248
gateway 192.168.1.105
dns-nameservers 192.168.1.1
- If eth0 still does not show up in
ifconfig
here is the magic:
sudo ifdown eth0 && sudo ifup eth0
- Activate and start SSH on Raspi:
sudo systemctl start ssh
sudo systemctl enable ssh
- Connect to the Raspi via SSH from ubuntu terminal:
ssh pi@192.168.1.106
- Upgrade of Raspbian:
sudo apt-get update && sudo apt-get upgrade
Enable support for IEEE 802.15.4/LoWPAN devices
- Plug the OpenLabs 802.15.4 radio module directly onto pins 15-26 of the Raspi’s P1 header (in the middle):
OpenLabs 802.15.4 radio module | Module connected to Raspi |
---|---|
Image source: https://openlabs.co/store/Raspberry-Pi-802.15.4-radio | Image source: https://openlabs.co/store/Raspberry-Pi-802.15.4-radio |
- There is an existing overlay for this transceiver shipped with Raspbian, should be in
/boot/overlays/at86rf233-overlay.dtb
or/boot/overlays/at86rf233.dtbo
:
ls /boot/overlays/at86rf233.dtbo
- Enable transceiver by modifying the
/boot/config.txt
file and reboot:
sudo nano /boot/config.txt
# enable OpenLabs 802.15.4 radio module
dtoverlay=at86rf233, speed=3000000
Installation of Linux WPAN tools
Source/Links:
- https://github.com/RIOT-OS/RIOT/wiki/How-to-install-6LoWPAN-Linux-Kernel-on-Raspberry-Pi
- https://github.com/RIOT-Makers/wpan-raspbian/wiki/Create-a-generic-Raspbian-image-with-6LoWPAN-support
- https://github.com/RIOT-Makers/wpan-raspbian/wiki/Spice-up-Raspbian-for-the-IoT
- First install
git
and clone the wpan-tools repo:
sudo apt install git
sudo mkdir /opt/src
sudo chown pi /opt/src
cd /opt/src
git clone https://github.com/linux-wpan/wpan-tools
- Install some required packages before building the wpan-tools:
sudo apt install dh-autoreconf libnl-3-dev libnl-genl-3-dev
- Configure, build and install wpan-tools:
cd /opt/src/wpan-tools
./autogen.sh
./configure CFLAGS='-g -O0' --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib
make
sudo make install
- Verification/test of wpan-tools installation:
iwpan dev
MANUAL WPAN interface configuration
Sources/Links::
- https://linux-wpan.org/documentation.html
- https://www.linuxjournal.com/content/low-power-wireless-6lowpan-ieee802154-and-raspberry-pi
- http://morschi.com/2017/04/05/hands-on-riot-6lowpan/
- Configure the default PAN ID of RIOT-OS/SAMR21-xpro:
0x23
- Configure the default channel ID of RIOT-OS/SAMR21-xpro:
26
ip link set lowpan0 down
ip link set wpan0 down
iwpan phy phy0 set channel 0 26 # same network ID and channel as RIOT default
iwpan dev wpan0 set pan_id 0x23 # same network ID and channel as RIOT default
ip link add link wpan0 name lowpan0 type lowpan
ip link set wpan0 up
ip link set lowpan0 up
- Afterwards the
lowpan0
interface on Raspi has a link-local IPv6 address:
root@raspberrypi:~# ip a
1: lo: [...]
2: eth0: [...]
3: wlan0: [...]
4: wpan0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 123 qdisc pfifo_fast state UNKNOWN group default qlen 300
link/ieee802.15.4 36:3a:07:cc:65:41:2b:31 brd ff:ff:ff:ff:ff:ff:ff:ff
5: lowpan0@wpan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1280 qdisc noqueue state UNKNOWN group default qlen 1000
link/6lowpan 36:3a:07:cc:65:41:2b:31 brd ff:ff:ff:ff:ff:ff:ff:ff
inet6 fe80::343a:7cc:6541:2b31/64 scope link
valid_lft forever preferred_lft forever
NOTE/CAUTION: Every reboot changes the link-local IPv6 address of the lowpan0
interface on the Raspi!
See this section to configure a persistent link-local address.
There are also scripts available to create/delete a lowpan interface (or to create/delete a monitor interface): https://github.com/RIOT-Makers/wpan-raspbian
PERSISTENT wpan0 and lowpan0 configuration
with static long hardware address and static link-local IPv6 address (to avoid a random link-local IPv6 address on each reboot)
Sources/Links:
- https://github.com/RIOT-Makers/wpan-raspbian/wiki/Spice-up-Raspbian-for-the-IoT
- https://github.com/RIOT-Makers/wpan-raspbian
- https://jan.newmarch.name/IoT/LinuxJournal/Routing/
- Clone riot-makers/wpan-raspbian git repo:
cd /opt/src
git clone https://github.com/riot-makers/wpan-raspbian
cd wpan-raspbian
- Copy some helper (shell) scripts to a well-known location:
sudo cp -r usr/local/sbin/* /usr/local/sbin/.
sudo chmod +x /usr/local/sbin/*
- Afterwards copy files for systemd integration:
sudo cp etc/default/lowpan /etc/default/.
sudo cp etc/systemd/system/lowpan.service /etc/systemd/system/.
- Modify channel id and PAN id in
/etc/default/lowpan
as needed:
sudo nano /etc/default/lowpan
CHN="13"
PAN="0xbeef"
# set MAC to "" for random mac/hw address
MAC="02:0:0:0:0:0:0:1"
# set IP6 to "" if not required; note: set a prefix length
#IP6="fdaa:bb:cc:dd::1/64"
# Set ack requests (Only enable if all devices on your PAN support acks)
ACKREQ=0
MAC="02:0:0:0:0:0:0:1"
was taken from https://jan.newmarch.name/IoT/LinuxJournal/Routing/, this results in a
link-local address of fe80::1
for the Raspi.
- Enable
lowpan.service
autostart, start 6LoWPAN service and verification:
sudo systemctl enable lowpan.service
sudo systemctl start lowpan.service
ifconfig
lowpan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1280
inet6 fe80::1 prefixlen 64 scopeid 0x20<link>
unspec 02-00-00-00-00-00-00-01-00-00-00-00-00-00-00-00 txqueuelen 1000 (UNSPEC)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 19 bytes 2114 (2.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wpan0: flags=195<UP,BROADCAST,RUNNING,NOARP> mtu 123
unspec 02-00-00-00-00-00-00-01-00-00-00-00-00-00-00-00 txqueuelen 300 (UNSPEC)
RX packets 72 bytes 2016 (1.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 74 bytes 5320 (5.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0