Hari Hendaryanto

I work at pt. citra sari makmur, vsat and internet service provider since 1997. I started to seriously write this blog since 7 years ago. mostly on technical issues.

Feb 282023

just short tutorial, no need to write too much, let’s go!!

first download openwrt sdk reffering to openwrt firmware/version you want direwolf to build.
i’m using NanoPI R2S so i downloaded openwrt-sdk-22.03.3-rockchip-armv8_gcc-11.2.0_musl.Linux-x86_64.xz

wget https://downloads.openwrt.org/releases/22.03.3/targets/rockchip/armv8/openwrt-sdk-22.03.3-rockchip-armv8_gcc-11.2.0_musl.Linux-x86_64.tar.xz
tar -xf https://downloads.openwrt.org/releases/22.03.3/targets/rockchip/armv8/openwrt-sdk-22.03.3-rockchip-armv8_gcc-11.2.0_musl.Linux-x86_64.tar.xz
cd openwrt-sdk-22.03.3-rockchip-armv8_gcc-11.2.0_musl.Linux-x86_64
mkdir -p mypackages/direwolf

that’s it you have direwolf installer for openwrt now!! is that simple.
no, i’m kidding. few more long steps to go 😀

update sdk tree

./scripts/feeds update -a
./scripts/feeds install -a
make menuconfig

select Global Build settings

  • Select all target specific packages by default
  • Select all kernel module packages by default
  • Select all userspace packages by default

save and exit

create Makefile for direwolf

cd mypackages/direwolf
vi Makefile
# Copyright (C) 2018 Alianiqu Alianiqu@example.net
# Copyright (C) 2020 Luceoria
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
# modified by YD0BCX
include $(TOPDIR)/rules.mk




include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/cmake.mk

ifneq ($(CONFIG_CCACHE),)


define Package/direwolf
DEPENDS:=+libpthread +alsa-lib +alsa-utils +libgps +libhamlib +libudev +kmod-usb-hid
TITLE:=Hamradio APRS iGate / Digipeater

define Package/direwolf/description
Dire Wolf is a software "soundcard" AX.25 packet modem/TNC and APRS encoder/decoder.
It can be used stand-alone to observe APRS traffic, as a tracker, digipeater, APRStt gateway,
or Internet Gateway (IGate).

define Build/direwolf/Configure
$(call Build/Configure/Default --prefix=/usr)

define Build/direwolf/Compile
$(call Build/Compile/Default)

define Package/direwolf/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/direwolf    $(1)/usr/bin/direwolf
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/decode_aprs $(1)/usr/bin/decode_aprs
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/text2tt     $(1)/usr/bin/text2tt
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/tt2text     $(1)/usr/bin/tt2text
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ll2utm      $(1)/usr/bin/ll2utm
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/utm2ll      $(1)/usr/bin/utm2ll
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/aclients    $(1)/usr/bin/aclients
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/log2gpx     $(1)/usr/bin/log2gpx
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/gen_packets $(1)/usr/bin/gen_packets
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/atest       $(1)/usr/bin/atest
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ttcalc      $(1)/usr/bin/ttcalc
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/kissutil    $(1)/usr/bin/kissutil
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/cm108       $(1)/usr/bin/cm108
$(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/dwespeak.sh $(1)/usr/bin/dwspeak.sh
$(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/telemetry-toolkit/telem-* $(1)/usr/bin/
$(INSTALL_DIR)  $(1)/usr/share/direwolf
$(INSTALL_DATA) $(PKG_BUILD_DIR)/data/tocalls.txt     $(1)/usr/share/direwolf/tocalls.txt
$(INSTALL_DATA) $(PKG_BUILD_DIR)/data/symbols-new.txt $(1)/usr/share/direwolf/symbols-new.txt
$(INSTALL_DATA) $(PKG_BUILD_DIR)/data/symbolsX.txt    $(1)/usr/share/direwolf/symbolsX.txt

$(eval $(call BuildPackage,direwolf))

save and exit

add mypackages to feeds.conf.default

adjust to your openwrt SDK full path. example:

src-git base https://git.openwrt.org/openwrt/openwrt.git;v22.03.3
src-git-full packages https://git.openwrt.org/feed/packages.git^2048c5bbf6c482e45b080eef4c1c531936f7f41b
src-git-full luci https://git.openwrt.org/project/luci.git^396f4048bd1f4cae7cb6f085d360081d81ad2d9a
src-git-full routing https://git.openwrt.org/feed/routing.git^1a87333f268bcf0a11e3a665a357cb0d4ec2d680
src-git-full telephony https://git.openwrt.org/feed/telephony.git^49abbb97e113ce7a35fe632acf6a8fff48dba5ec
src-link mypackages /home/hari/openwrt-sdk-22.03.3-rockchip-armv8_gcc-11.2.0_musl.Linux-x86_64/mypackages

save and exit

now let’s prep direwolf itelsf
from current directory

cd ../../dl/
git clone https://www.github.com/wb2osz/direwolf direwolf-1.7.0
cd direwolf-1.7.0
git checkout dev

i don’t want to build direwolf with avahi.

now edit CMakeLists.txt
vi CMakeLists.txt

sreach for AVAHI keyword

comment the section like this
#  find_package(Avahi)
#  endif()

now on the same file search for misc (there’re 2 lines)
this misc section only for adding strlcpy and strlcat, openwrt toolchains already has those functions.

comment the lines like this


edit cm108.c as i encounter error when compiling.

vi src/cm108.c

replace around line 678, from

SAFE_STRCPY (things[num_things].devpath, udev_device_get_devpath(dev));


SAFE_STRCPY (things[num_things].devpath, udev_device_get_syspath(dev));

save and exit

cd ../
let's compress direwolf1-7.0 directory to direwolf-1.7.0.tar.gz
tar -czf direwolf-1.7.0.tar.gz direwolf-1.7.0

create md5 hash

md5sum direwolf-1.7.0.tar.gz
hari@APRS:~/openwrt-sdk-22.03.3-rockchip-armv8_gcc-11.2.0_musl.Linux-x86_64/dl$ md5sum direwolf-1.7.0.tar.gz
7b3a781fb4fdbf5af12642228630c98b  direwolf-1.7.0.tar.gz

copy the result and put to direwolf Make file like this

vi ../mypackages/direwolf/Makefile

save and exit

update feeds.conf.default

./scripts/feeds update mypackages
./scripts/feeds install -a -p mypackages

now we’re ready to go!
compile time, take few days to compile for slow machine like mine.
no, i’m joking.

getback to top level sdk directory

cd ..

make -j $(($(nproc)+1)) package/direwolf/{clean,compile} V=sc

copy direwolf ipk toyour openwrt device(in mycase /tmp directeory) and install some module/packages.
the rest will automatically install by direworlf dependencies.

opkg update
opkg install kmod-usb-audio kmod-hid
opkg install /tmp/direwolf*.ipk

have fun

this build intented to device with more than 64M or more. beacause direwolf needs lot of dependencies.
do it on your own risk.

Nov 272022

Straight to the codes.
We’re going to get PMS7003 values and print them to serial monitor.

compile and download these codes to arduino nano

#include ""PMS.h""
#include <Wire.h>  
PMS pms(Serial);
PMS::DATA data;
void setup()

void loop()
  if (pms.read(data))
    Serial.print("PM 1.0 (ug/m3): ");

    Serial.print(", PM 2.5 (ug/m3): ");

    Serial.print(", PM 10.0 (ug/m3): ");

open serial monitor on Arduino IDE, set the baudrate to 9600 bps, you’ll see the beautifull data coming from PMS7003.
that’s it, pretty simple wight?

Hey!! i want those values grabbed to my raspi zero for my weather station
easy, i can connect PMS7003 sensor serial pin to my raspi UART. but wait, there’s logic level difference between my arduino nano pin I/O and PMS7003.
so, i think the safest way is using usb connect to raspi usb. in my case when i plugged nano to raspi, it will immediately recognized by raspi.

pi@raspberrypi:~ $ lsusb 
Bus 001 Device 006: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC
Bus 001 Device 004: ID 1546:01a7 U-Blox AG [u-blox 7]
Bus 001 Device 003: ID 0d8c:013c C-Media Electronics, Inc. CM108 Audio Controller
Bus 001 Device 002: ID 2109:2813 VIA Labs, Inc. VL813 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

take a look at

[Bus 001 Device 006: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC]

in my case nano will be on ttyUSB0

pi@raspberrypi:~ $ grep -i 'tty' /var/log/syslog*
/var/log/syslog.1:Nov 20 19:17:23 raspberrypi kernel: [434783.042818] usb 1-1.4: FTDI USB Serial Device converter now attached to ttyUSB0
/var/log/syslog.1:Nov 20 19:18:42 raspberrypi kernel: [434861.956242] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
/var/log/syslog.1:Nov 20 19:19:13 raspberrypi kernel: [434892.390729] usb 1-1.4: FTDI USB Serial Device converter now attached to ttyUSB0

pi@raspberrypi:~ $ ls -l /dev/ttyUSB*
crw-rw---- 1 root dialout 188, 0 Nov 20 19:22 /dev/ttyUSB0

let’s get on the python script

#!/usr/bin/env python3
import serial
import time
import sys

#Serial takes two parameters: serial device and baudrate
nano = serial.Serial('/dev/ttyUSB0', 9600)

while True:
    data = nano.readline()
    strs = data.decode().strip())

run it, python tne_code_abobe.py

PM 1.0 (ug/m3): 27, PM 2.5 (ug/m3): 40, PM 10.0 (ug/m3): 49
PM 1.0 (ug/m3): 27, PM 2.5 (ug/m3): 40, PM 10.0 (ug/m3): 50
PM 1.0 (ug/m3): 27, PM 2.5 (ug/m3): 40, PM 10.0 (ug/m3): 50
PM 1.0 (ug/m3): 27, PM 2.5 (ug/m3): 39, PM 10.0 (ug/m3): 50
PM 1.0 (ug/m3): 27, PM 2.5 (ug/m3): 39, PM 10.0 (ug/m3): 50

that’s it 🙂