2025年9月17日水曜日

WSL Ubuntu Radioconda

まずは

WSL を有効に

つぎにUbuntu



BIOSの設定

  1. BIOS画面に入る。
    • PCメーカー別
      • 富士通 : F2キー
      • NEC : F2キー
      • 東芝 : F2キー または ESCキー を押しながら起動し、メーカーロゴが表示されたら F1キー を押下する
      • Lenovo(IBM) : F1キー
      • HP(Compaq) : F10キー
      • Dell : F2キー または Ctrl + Alt + Enter
      • 日立 : F2キー
      • Panasonic : F2キー
      • Sharp : F2キー
      • ASUS : F2キー
      • ソニー : F2キー
      • 自作PCまたはパソコンショップで購入したPCなど : Delete
    • マザーボードメーカー別
      • ASUS : Delete
      • Intel : F2キー
      • Giga-byte : Delete
      • ESC : Delete
      • ASROCK : F2キー
      • MSI : Delete
    • OS起動後からBIOSに入る
      1. スタートボタンを押下する
      2. 設定ボタンを押下する
      3. 更新とセキュリティを押下する
      4. 回復 > PCの起動をカスタマイズする > 今すぐPCを再起動する を押下する
      5. オプションの選択 > トラブルシューティング > 詳細オプション > UEFI ファームウェアの設定 を押下する
  2. Virtualization Technology を Enabled に変更する。

Windows の機能の有効化または無効化の設定

  1. Windows の機能の有効化または無効化 を開く。
    01.png
  2. Hyper-V , Linux 用 Windows サブシステム または Windows Subsystem for Linux , 仮想マシンプラットフォーム を有効にする。
    02.png
    03.png
  3. OK を押下する。
  4. PCを再起動する。

以下コマンドでも設定ができる。

コマンド
# 「Linux 用 Windows サブシステム」 または 「Windows Subsystem for Linux」 を有効
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

# 「仮想マシン プラットフォーム」 を有効
> dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
実行結果
> dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

展開イメージのサービスと管理ツール
バージョン: 10.0.19041.844

イメージのバージョン: 10.0.19044.1826

機能を有効にしています
[==========================100.0%==========================]
操作は正常に完了しました。
> dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

展開イメージのサービスと管理ツール
バージョン: 10.0.19041.844

イメージのバージョン: 10.0.19044.1826

機能を有効にしています
[==========================100.0%==========================]
操作は正常に完了しました。

wsl2インストール

1.WSLバージョンを2に設定する

コマンド
wsl --set-default-version 2
実行結果
> wsl --set-default-version 2
WSL 2 との主な違いについては、https://aka.ms/wsl2 を参照してください
この操作を正しく終了しました。

2.使用可能な Linux ディストリビューションを一覧表示する

コマンド
wsl --list --online
実行結果
> wsl --list --online
インストールできる有効なディストリビューションの一覧を次に示します。
'wsl --install -d <Distro>' を使用してインストールします。

NAME            FRIENDLY NAME
Ubuntu          Ubuntu
Debian          Debian GNU/Linux
kali-linux      Kali Linux Rolling
openSUSE-42     openSUSE Leap 42
SLES-12         SUSE Linux Enterprise Server v12
Ubuntu-16.04    Ubuntu 16.04 LTS
Ubuntu-18.04    Ubuntu 18.04 LTS
Ubuntu-20.04    Ubuntu 20.04 LTS

3.Linux ディストリビューションをインストール

コマンド
wsl --install -d Ubuntu
実行結果
> wsl --install -d Ubuntu
ダウンロード中: Ubuntu
インストール中: Ubuntu
Ubuntu はインストールされました。
Ubuntu を起動しています...

4.ubuntu を起動する。
- 初回起動時は ユーザ名 と パスワード を入力する。
06.png

実行結果
Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: 【ユーザ名】
New password:【パスワード】
Retype new password:【パスワード】
passwd: password updated successfully
Installation successful!
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

Welcome to Ubuntu 20.04 LTS (GNU/Linux 5.10.102.1-microsoft-standard-WSL2 x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Mon Jul 25 22:56:43 JST 2022

  System load:  0.19               Processes:             8
  Usage of /:   0.4% of 250.98GB   Users logged in:       0
  Memory usage: 0%                 IPv4 address for eth0: 172.20.70.116
  Swap usage:   0%

0 updates can be installed immediately.
0 of these updates are security updates.


The list of available updates is more than a week old.
To check for new updates run: sudo apt update


This message is shown once once a day. To disable it please create the
/home/【ユーザ名】/.hushlogin file.
【ユーザ名】@【PC名】:~$

5.実行結果のように起動できれば成功。

エラー時の対処

  • ubuntu 起動時に以下のエラーが発生した場合

99.png

1.WSLを更新する。

コマンド
wsl --update

2.WSLを再起動する。

コマンド
wsl --shutdown


参照

https://dsp-lab.net/2023/10/11/post-590/


radiocondaを用いてUbuntu 22.04でGNU Radioをインストール

2023/11/10 4:52 PM

GNU Radioを用いて開発や研究を行う方にとっては,2023年10月現在,radiocondaによるGNU Radioのインストールが最も便利だと思われる.https://github.com/ryanvolz/radioconda からLinux用(x86_64 (amd64)アーキテクチャ用)のインストーラをダウンロードして,以下のように実行する.検証に使用したパソコンは,Ubuntu 22.04.3 LTSを新規にインストールした状態である(GNU Radioのバイナリパッケージは,一切インストールしていない).

$ bash ./radioconda-2023.07.26-Linux-x86_64.sh

画面に膨大なインストールログが表示される.ログの末尾には,対象とするソフトウェア無線環境ごとに必要な設定も記載されている(GitHubにも,設定に関するほぼ同等の内容の記載はある).

radioconda は,GNU Radioを含む主要なオープンソースのソフトウェア無線パッケージ集である.Anaconda, Inc.謹製の conda package manager(およびconda互換のより高速なソフトウェア mamba)がバンドルされている.radiocondaを用いることで,各種のソフトウェア無線機に対応したGNU Radio環境を,Ubuntuユーザの(主として)ホームディレクトリ以下に容易に構築できる.1台のUbuntuマシンに複数バージョンのGNU Radio環境を共存させたい,という要求にも応えられそうだ.とりあえずradiocondaをインストールすれば,対応しているソフトウェア無線機の使用を開始できる,という状況となることを目指して提供されているようで,とてもありがたい.

GNU Radioをインストールする際には,上記のradiocondaのインストールで準備された base conda environment で直接行うのではなく,ユーザが命名するGNU Radio用の「環境」内で行うことが強く推奨されている.GNU Radio Wikiでの説明は以下の通り.

It’s almost never a good idea to install additional packages to your base conda environment because their dependencies may interfere with conda’s own dependencies. We recommend creating an environment specifically for GNU Radio and related packages. From a console with the base conda environment activated, run
$ conda create -n gnuradio
to create an empty environment called “gnuradio".

上記のやり方は,condaを用いて必要なライブラリを備えたPythonの開発環境を準備する際の考え方と同じなので,Pythonで開発をされる方や機械学習/深層学習界隈の方にとっては,おなじみかと思います.

Enter the environment by activating it with the command: というドキュメントの記載に従って以下のコマンドを実行し,先ほど作成した conda での「gnuradio 環境」をactivateする.ここでの「gnuradio」は,利用者が先ほど作成(命名)した環境の名称を表す単なる文字列である.

$ conda activate gnuradio

続いて,Before installing the GNU Radio packages, we need to ensure that the environment is set up to look for packages from conda-forge: というGNU Radio Wikiの記載に従って下記を実行する((gnuradio) sdr2023@dsp:~$までは単なるプロンプト).

(gnuradio) sdr2023@dsp:~$ conda config --env --add channels conda-forge
(gnuradio) sdr2023@dsp:~$ conda config --env --set channel_priority strict

GNU Radioをインストールする準備ができたので,以下によりインストールを実行する.下記のコマンドラインでの「gnuradio」は,主要なソフトウェア無線機向けのGNU Radioと関連ツール一式が含まれるradioconda(conda-forge)でのパッケージ名である.対象デバイス等は,GitHubに記載がある.

(gnuradio) sdr2023@dsp:~$ conda install gnuradio

以上でインストールは完了する.コマンドプロンプトの前にある(gnuradio)という文字列は,「gnuradio環境」でのコマンドプロンプトであることを示す単なる目印である.USRPを使いたいので,下記を実行しておく.

(gnuradio) sdr2023@dsp:~$ uhd_images_downloader

また,ADALM-PLUTO(IIO(Pluto SDR))も使いたいので,GitHubの記載に基づき下記を実行しておく.

(gnuradio) sdr2023@dsp:~$ sudo ln -s $CONDA_PREFIX/lib/udev/rules.d/90-libiio.rules /etc/udev/rules.d/90-radioconda-libiio.rules
(gnuradio) sdr2023@dsp:~$ sudo udevadm control --reload
(gnuradio) sdr2023@dsp:~$ sudo udevadm trigger

我々のところでは,以上のように作業を行ってきたUbuntuマシンのログインユーザは,専らGNU Radioを使用するためのユーザと想定している.ホームディレクトリの.bashrcの末尾に以下を書いておいた.mambaは,condaと書いても同じである.

mamba activate gnuradio

作業はこれで終わりで,以下のようにGNU Radio Companionを起動できる.2023年10月11日の状況では,GNU Radio 3.10.7.0がインストールされた.インストールされたUHDは,UHD 4.5.0.HEAD-releaseという最新版であった.

(gnuradio) sdr2023@dsp:~$ gnuradio-companion

radioconda環境でインストールしたGNU Radio Companion
(gnuradio) sdr2023@dsp:~$ uhd_config_info --print-all
UHD 4.5.0.HEAD-release
Build date: Wed, 04 Oct 2023 05:55:34
C compiler: GNU 12.3.0
C++ compiler: GNU 12.3.0
C flags: -DBOOST_ERROR_CODE_HEADER_ONLY -DBOOST_ASIO_DISABLE_STD_STRING_VIEW -DBOOST_ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW -DHAVE_CONFIG_H -DUHD_LOG_MIN_LEVEL=1 -DUHD_LOG_CONSOLE_LEVEL=2 -DUHD_LOG_FILE_LEVEL=2 -DUHD_LOG_CONSOLE_COLOR-march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/sdr2023/radioconda/envs/gnuradio/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/uhd_1696398762321/work=/usr/local/src/conda/uhd-4.5.0.0 -fdebug-prefix-map=/home/sdr2023/radioconda/envs/gnuradio=/usr/local/src/conda-prefix
C++ flags: -DBOOST_ERROR_CODE_HEADER_ONLY -DBOOST_ASIO_DISABLE_STD_STRING_VIEW -DBOOST_ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW -DHAVE_CONFIG_H -DUHD_LOG_MIN_LEVEL=1 -DUHD_LOG_CONSOLE_LEVEL=2 -DUHD_LOG_FILE_LEVEL=2 -DUHD_LOG_CONSOLE_COLOR-fvisibility-inlines-hidden -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/sdr2023/radioconda/envs/gnuradio/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/uhd_1696398762321/work=/usr/local/src/conda/uhd-4.5.0.0 -fdebug-prefix-map=/home/sdr2023/radioconda/envs/gnuradio=/usr/local/src/conda-prefix -fvisibility=hidden -fvisibility-inlines-hidden
Enabled components: LibUHD, LibUHD - C API, LibUHD - Python API, Examples, Utils, USB, B100, B200, USRP1, USRP2, X300, MPMD, N300, N320, E320, X400, OctoClock
Install prefix: /home/conda/feedstock_root/build_artifacts/uhd_1696398762321/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho
Boost version: 1.82
Libusb version: 1.0.27
Library path: /home/sdr2023/radioconda/envs/gnuradio/lib
Package path: /home/sdr2023/radioconda/envs/gnuradio
Images directory: /home/sdr2023/radioconda/envs/gnuradio/share/uhd/images
ABI version string: 4.5.0

conda および mambaは,Python開発環境での複雑なライブラリ問題に対処している有用なツールで,広く使われている.これを活用して,GNU Radio環境(GNU Radioから使用できる主要なソフトウェア無線機に対応可能な状態)や関連のツールをインストールする手段を提供しているradiocondaは,とても役に立つ.GNU Radio界隈とって非常に有用な存在だと感じている.長くGNU Radioを使っていくと,バージョンの混在がどうしても発生してしまう(以前に作成したGRCブロックが,最新版では動かないなどの理由から).この種の問題にはPyBOMBSで対処してきたが,これからはradiocondaが役に立つのではないか.先の記事で示したUbuntu PPA Installationではなく,radioconda環境でインストールしたGNU Radioを使っていきたいと思った.



参照

https://github.com/radioconda/radioconda-installer


radioconda

This repository holds cross-platform installers for a collection of open source software radio packages bundled with the conda package manager, including

  • Digital RF
  • GNU Radio (including an increasing list of out-of-tree modules)
  • gqrx
  • inspectrum

and support for the following SDR devices and device libraries:

DeviceLibrary
ADALM-PLUTOlibiio (setup)
Airspy R2/Mini/HF+airspy/airspyhf (setup)
BladeRFbladeRF (setup)
Ettus USRPsUHD (setup)
Funcube Dongle Pro/Pro+SoapyFCDPP / gr-funcube
HackRFHackRF (setup)
LimeSDRLime Suite (setup)
Mirics MSi001 + MSi2500 SDR deviceslibmirisdr (setup)
Red PitayaSoapyRedPitaya
RFSpace/NetSDR/CloudSDRSoapyNetSDR
RTL-SDRrtl-sdr (setup)
Sound Card / Audio devicesSoapyAudio

The complete list of packages can be found here. You can suggest additional software to include by filing an issue. If you've built additional software from source on top of radioconda, document your results in an issue to help others (and help me in packaging it!).

Once installed, you will have a fully functional conda distribution/environment, meaning that you can use the conda or mamba commands to install additional packages (if available through conda-forge) or upgrade to the latest versions. Think of radioconda as an alternative to Anaconda or Miniforge, but specialized for software radio.

NOTE: Radioconda is built from packages maintained by the conda-forge project. If you have questions or issues that are specific to the conda installation of a particular package, please report them at the corresponding feedstock repository.

Download

Radioconda installers are available here: https://github.com/radioconda/radioconda-installer/releases.

OSArchitectureInstaller TypeDownload
Linuxx86_64 (amd64)Command-lineradioconda-Linux-x86_64.sh
Linuxaarch64 (arm64)Command-lineradioconda-Linux-aarch64.sh
Linuxppc64le (POWER8/9)Command-lineradioconda-Linux-ppc64le.sh
macOSx86_64 (Intel)Command-lineradioconda-MacOSX-x86_64.sh
macOSx86_64 (Intel)Graphicalradioconda-MacOSX-x86_64.pkg
macOSarm64 (Apple Silicon)Command-lineradioconda-MacOSX-arm64.sh
macOSarm64 (Apple Silicon)Graphicalradioconda-MacOSX-arm64.pkg
Windowsx86_64 (amd64)Graphicalradioconda-Windows-x86_64.exe

Install

For a command line install, download the installer and run:

bash radioconda-*-Linux-x86_64.sh   # or similar for other installers for unix platforms

For a graphical install, download the installer and double-click it.

If you already have conda/mamba, you can skip the installer and create a new environment with all of the radioconda packages by running:

conda create -n radioconda -c conda-forge -c ryanvolz --only-deps radioconda

See below for additional installation steps for particular software radio devices.

Non-interactive install

For non-interactive usage, look at the options by running the following:

bash radioconda-*-Linux-x86_64.sh -h   # or similar for other installers for unix platforms

or if you are on Windows, run:

start /wait "" build/radioconda-<VERSION>-Windows-x86_64.exe /InstallationType=JustMe /RegisterPython=0 /S /D=%UserProfile%\radioconda

Use

You will mostly use radioconda through the command line, although on Windows some applications will install shortcuts to the Start menu.

Windows

Launch "radioconda Prompt" from the Start menu (you can find it under the "radioconda" directory). From this command line, you can run mamba to install/upgrade packages or run any of the applications installed with radioconda. Some applications can also be launched through shortcuts added to the Start menu.

Linux and macOS

Launch your favorite terminal. Depending on the options you chose while installing, you may or may not already have the radioconda "base" environment activated automatically (you will see "(base)" on your command line prompt). To otherwise activate the radioconda "base" environment, run:

conda activate base

If this fails because the conda command is not found, you can activate the environment manually by running

sh <PATH_TO_RADIOCONDA>/bin/activate

From an activated environment, you will be able to run mamba to install/upgrade packages or run any of the applications installed with radioconda.

Installing packages

To install a particular package:

mamba install <pkg-name>

Upgrade

Once you have radioconda installed, you can stay up to date for all packages with:

mamba upgrade --all

Upgrade to latest release

To install the latest release in particular, run

(on Windows):

mamba install --file https://github.com/radioconda/radioconda-installer/releases/latest/download/radioconda-win-64.lock

(on Linux/macOS):

mamba install --file https://github.com/radioconda/radioconda-installer/releases/latest/download/radioconda-$(conda info | sed -n -e 's/^.*platform : //p').lock

Install a particular release

To install a particular release version, substitute the desired version number and run

(on Windows):

mamba install --file https://github.com/radioconda/radioconda-installer/releases/download/20NN.NN.NN/radioconda-win-64.lock

(on Linux/macOS):

mamba install --file https://github.com/radioconda/radioconda-installer/releases/download/20NN.NN.NN/radioconda-$(conda info | sed -n -e 's/^.*platform : //p').lock

Install from radioconda metapackage

If you're starting with a fresh environment or are comfortable dealing with package conflicts, you can install the latest release using the radioconda metapackage from the ryanvolz channel:

mamba install -c conda-forge -c ryanvolz --only-deps radioconda

(It is necessary to specify the conda-forge channel first, even if it is your default channel, so that the ryanvolz channel does not take priority.)

To install a particular release version, substitute the desired version number and run

mamba install -c conda-forge -c ryanvolz --only-deps radioconda=20NN.NN.NN

Additional Installation for Device Support

To use particular software radio devices, it might be necessary to install additional drivers or firmware. Find your device below and follow the instructions. (Help add to this section by filing an issue if the instructions don't work or you have additional instructions to add!)

RTL-SDR

Windows users

Install the WinUSB driver with Zadig, selecting the device that is called "Bulk-In, Interface (Interface 0)".

Linux users

Blacklist the DVB-T modules that would otherwise claim the device:

sudo ln -s $CONDA_PREFIX/etc/modprobe.d/rtl-sdr-blacklist.conf /etc/modprobe.d/radioconda-rtl-sdr-blacklist.conf
sudo modprobe -r $(cat $CONDA_PREFIX/etc/modprobe.d/rtl-sdr-blacklist.conf | sed -n -e 's/^blacklist //p')

Install a udev rule by creating a link into your radioconda installation:

sudo ln -s $CONDA_PREFIX/lib/udev/rules.d/rtl-sdr.rules /etc/udev/rules.d/radioconda-rtl-sdr.rules
sudo udevadm control --reload
sudo udevadm trigger

IIO (Pluto SDR)

Windows users

Install the latest USB drivers by download and installing this file.

Linux users

Install a udev rule by creating a link into your radioconda installation:

sudo ln -s $CONDA_PREFIX/lib/udev/rules.d/90-libiio.rules /etc/udev/rules.d/90-radioconda-libiio.rules
sudo udevadm control --reload
sudo udevadm trigger
All users

Once you can talk to the hardware (by following the instructions below), you may want to perform the post-install steps detailed on the Pluto users wiki.

Airspy (R2, Mini, HF+)

Windows users

The WinUSB driver for your device will most likely be installed automatically, and in that case there is no additional setup. If for some reason the driver is not installed and the device is not recognized, install the WinUSB driver with Zadig, selecting your Airspy device.

Linux users

Install a udev rule by creating a link into your radioconda installation:

# run the next line only for the Airspy R2 or Mini
sudo ln -s $CONDA_PREFIX/lib/udev/rules.d/52-airspy.rules /etc/udev/rules.d/52-radioconda-airspy.rules
# run the next line only for the Airspy HF+
sudo ln -s $CONDA_PREFIX/lib/udev/rules.d/52-airspyhf.rules /etc/udev/rules.d/52-radioconda-airspyhf.rules
sudo udevadm control --reload
sudo udevadm trigger

Then, make sure your user account belongs to the plugdev group in order to be able to access your device:

sudo usermod -a -G plugdev <user>

You may have to restart for this change to take effect.

HackRF

Windows users

Install the WinUSB driver with Zadig, selecting your HackRF device.

Linux users

Install a udev rule by creating a link into your radioconda installation:

sudo ln -s $CONDA_PREFIX/lib/udev/rules.d/53-hackrf.rules /etc/udev/rules.d/53-radioconda-hackrf.rules
sudo udevadm control --reload
sudo udevadm trigger

Then, make sure your user account belongs to the plugdev group in order to be able to access your device:

sudo usermod -a -G plugdev <user>

You may have to restart for this change to take effect.

BladeRF

Windows users

Install the WinUSB driver with Zadig, selecting your BladeRF device.

Linux users

Install a udev rule by creating a link into your radioconda installation:

sudo ln -s $CONDA_PREFIX/lib/udev/rules.d/88-nuand-bladerf1.rules /etc/udev/rules.d/88-radioconda-nuand-bladerf1.rules
sudo ln -s $CONDA_PREFIX/lib/udev/rules.d/88-nuand-bladerf2.rules /etc/udev/rules.d/88-radioconda-nuand-bladerf2.rules
sudo ln -s $CONDA_PREFIX/lib/udev/rules.d/88-nuand-bootloader.rules /etc/udev/rules.d/88-radioconda-nuand-bootloader.rules
sudo udevadm control --reload
sudo udevadm trigger

Then, make sure your user account belongs to the plugdev group in order to be able to access your device:

sudo usermod -a -G plugdev <user>

You may have to restart for this change to take effect.

LimeSDR

Windows users

The conda-forge package uses libusb to communicate over USB with your LimeSDR device, instead of the standard CyUSB library which is not open source. If you have used your LimeSDR with another software package, you will have to switch USB drivers to one compatible with WinUSB/libusb.

Install the WinUSB driver with Zadig, selecting your Lime device.

Linux users

Install a udev rule by creating a link into your radioconda installation:

sudo ln -s $CONDA_PREFIX/lib/udev/rules.d/64-limesuite.rules /etc/udev/rules.d/64-radioconda-limesuite.rules
sudo udevadm control --reload
sudo udevadm trigger

UHD (Ettus USRP)

All devices

Download the firmware files by activating your conda prompt and running

uhd_images_downloader

USB devices (e.g. B series)

Windows users

You probably have to install a USB driver for the device. Follow the instructions from the Ettus site, or install the WinUSB driver with Zadig (your device will have a USB ID that starts with 2500 or 3923).

Linux users

Install a udev rule by creating a link into your radioconda installation:

sudo ln -s $CONDA_PREFIX/lib/uhd/utils/uhd-usrp.rules /etc/udev/rules.d/radioconda-uhd-usrp.rules
sudo udevadm control --reload
sudo udevadm trigger

MiriSDR

Windows users

Install the WinUSB driver with Zadig, selecting your MiriSDR device.

Linux users

Install a udev rule by creating a link into your radioconda installation:

sudo ln -s $CONDA_PREFIX/lib/udev/rules.d/mirisdr.rules /etc/udev/rules.d/radioconda-mirisdr.rules
sudo udevadm control --reload
sudo udevadm trigger

Installing the WinUSB driver with Zadig

Many USB devices use libusb and need a WinUSB driver installed on Windows. Follow this procedure to install the driver for your device:

  1. Download and run Zadig

  2. Select your device

    • It may be auto-selected since it is missing a driver
    • It may not have a sensible name, but you can verify the USB ID
  3. Ensure the target driver (middle of the interface) reads "WinUSB"

  4. Click "Install Driver" or "Replace Driver"

Developers

Build radioconda

Usage

Each installer package is built from a specification directory in installer_specs using conda constructor. An installer can be built manually using the build_installer.py script. The specification directories set the exact versions of the included packages so that constructor will produce a predictable result that can be tracked by git for each release. In turn, the specification directories are created/updated by re-rendering the radioconda environment specification file using the rerender.py script.

So, the procedure to create a new installer package is:

  1. Update the environment specification file radioconda.yaml, if desired.
  2. Re-render the constructor specification directories by running rerender.py.
  3. Commit the changes to produced by steps 1 and 2 to the git repository.
  4. Build the installer package for a particular platform by running build_installer.py.

Release

To release a new version of radioconda and build installer packages using GitHub's CI:

  1. Update the repository following steps 1-3 above.
  2. Make a new pre-release on GitHub with a name equal to the version.
  3. Wait until all artifacts are uploaded by CI
  4. Mark the pre-release as a release

NOTE: using a pre-release is important to make sure the "latest" links work.



https://qiita.com/aochan50034/items/effbc1aca64cd3bfceda  参照 


Anaconda3をインストールする

1.公式サイトからインストーラのダウンロード

 公式サイト (https://www.anaconda.com/download/success) に行って、Linux用のインストーラをダウンロードします。この記事を書いている、2024.6.14時点では「Python 3.11 64-Bit (x86) Installer(997.2M)」がそれにあたります。

2.bashを用いてインストーラを実行

 先程ダウンロードしたインストーラをターミナル上で実行します。以下はインストーラがDownloadフォルダ直下にあるという想定ですので、適宜パスは書き換えてください。またインストーラの名称も変わっている可能性があるので、その際はインストーラ名を自分がダウンロードしたものと一致させてください。

$bash /mnt/c/Users/(user_name)/Downloads/Anaconda3-2024.02-1-Linux-x86_64.sh

しばらく待つとインストールが開始され、その後利用規約の同意を経て終了となります。

condaを使えるようにする

 他の方の記事を見ているとインストールが終わった時点でcondaが使えるようになっている方もいらっしゃるようですが、私の環境では上記の作業を終えた時点では、

$conda --version
conda: command not found

というように、condaがコマンドとして認識されていませんでした。
 これを解消するために、パスを通します。やり方は以下のコマンドをターミナル上で実行するだけです。

$export PATH="~/anaconda3/bin:$PATH"

これでcondaが使えるようになりましたが、その後に

$conda init

を実行することで、base環境をactivateすることができるようになります。
 以上でcondaをWSL上で使えるようになりました。ここまで読んでいただいてありがとうございました。

2025年9月14日日曜日

CNC Candle

 


【CNCルーター】プリント基板を切断する~実行編

 

※なにか気になる点がありましたらコメント欄からお伝えください。また、CNCルータなど工作機械を操作する場合には、細心の注意を払って行うようお願いいたします。

目次

1.はじめに

 故あってプリント基板を切断することとなりました。今回は今年12月9日に投稿した「【CNCルーター】プリント基板を切断する~準備編」を受けて、実際に生成したGコードをもとにCNCルーターを動かして基板を切断する手順を解説していきたいと思います。

f:id:Tanuki_Bayashin:20211215185505j:plain
図1 切断した基板(バリをとるために小型のルーターを使用した)

2.Gコードについて

 CNCルーターはGコードと呼ばれる1種のプログラムで動作します。FlatCAMで生成されたコードを読み込むと、Gコードで書かれたプログラムがCandle の画面に表示されます。以下に簡単なGコードを列記します。

 G00 :平行移動(低速) G01Ⅹ0.00 で座標Ⅹ0.00(mm)まで移動させるときの命令。
     Y、ℤが指定されていないときはY、Zの値はそのままの状態を維持する。
 G01 :平行移動(高速)。X、Y、Zに移動先の値(mm)を指定する。
 F80.00:移動速度の指定(mm/分)。水平方向(XY平面内)と垂直方向(Z軸方向)の
     2種類が指定可能
 M03 S10000.0:主軸正転 スピンドルモーターの回転数(rpm:正転)を指定できる。
         (左の場合では10000回転を指定している)

 これくらい知っておけば、ある程度、困らないと思われます。詳しく知りたい方は、検索などで調べてください。(CNCルーターにより、機能がないために無効となる命令もある)

3.Candle の使い方

 CNCルーターを動かすソフトの一つに「Candle」と呼ばれるものがあります。下のリンク先からダウンロードできるようです。アンインストールしたいときはフォルダごと、削除すればよいようです。(バージョンはいくつかあるようです)

GitHub - Denvi/Candle: GRBL controller application with G-Code visualizer written in Qt.

f:id:Tanuki_Bayashin:20211215222420p:plain
図2 Candle.exe のダウンロード画面(Github)

 Candle.exe を実行すると図3のような画面が表示されます。また、Gコードのファイルを読み込むと、切削する部分が画像として表示されます。

f:id:Tanuki_Bayashin:20211215222636p:plain
図3 Candle.exeの実行画面

3.1 原点調整

 まず、座標の基準となる原点の調整について記述します。

f:id:Tanuki_Bayashin:20211215224309p:plain
図4 XY座標のリセット、ℤ座標のリセット Z probe
3.1.1 Z軸の調整

 ℤ軸(垂直方向)の原点調整にはℤprobe という便利な機能があります。3018‐PROではコントローラーにA5という接続箇所があります。ここにコードをつなげ、2本の電線をそれぞれ切削する対象と、エンドミルにつなぎます(ドリルの刃でもV 字カッターでも可能)。このとき [ Z probe ]をクリックするとℤ軸が降下してゆきます。

 するとエンドミルが対象物と接することにより2本の電線が導通状態になるので、Z軸がいったん浮き上がり、その後徐々に下に移動し、再び導通するとℤ軸が停止します(動画1 を参照)。この位置でZ軸の値をゼロにリセットすることで、原点調整が可能となります。(プローブに電気が流れることを利用しているので、加工するものが金属でない場合、表面にアルミホイルを張るなど工夫が必要です)

動画1:ℤ軸の原点調整の様子
youtu.be


 3018‐PRO以外のCNCルーターだと、コードが3本必要なものもあるそうなので、その場合はそれに適した方法にて対処してください。

 以下のリンク先のように製品化されているものもあります。筆者は図5のような治具を作り、[ Z probe ]のときに利用しています。プリント基板の切れ端を利用して作りました。厚さは約 1.6mmなので、その分空中にて高さが ‐1.6mmになるようにして、その時点でZ座標を0にリセットしています。

https://tanuki-bayashin.hatenablog.com/entry/2021/12/16/201652  参照

f:id:Tanuki_Bayashin:20211216023407j:plain
図5 Z probe のための治具
3.1.2 X Y軸の調整

 こちらはやや原始的な方法を用いています(図6)。Candle.exe では、Gコードで操作する以外に、X、Y、Z軸をそれぞれ単独で動かす機能もあります(1回のクリックで0.01mmから200mmまでの移動を調整可能)。この機能により、エンドミルの先端を、原点として指定したい辺りまで移動させ、光を当てながら影を見ることで調整しています。

 カメラで撮影した画像を利用したり、光の反射を利用するなどの方法が可能でないか、今後検討したいと思っています。

f:id:Tanuki_Bayashin:20211215214839j:plainf:id:Tanuki_Bayashin:20211215214801j:plain
図6 XY軸の調整(LEDライトを用いている)

3.2 基板の切断(Gコードを実行)

 動画2にて基板を切断している様子を示します。Gコードを読み込むと、図7のように切削する部分が線で描かれます。マウスを使うことにより、向きを3次元で変えることもできます。

 動画2
youtu.be

f:id:Tanuki_Bayashin:20211215233811p:plainf:id:Tanuki_Bayashin:20211215231559p:plain
図7 動作開始(上)と実行中(下)の画面


 切断する対象は、筆者の場合、両面テープにて固定しました。両面テープの厚さにより、削られる深さに変化が出ないように注意が必要かと思われます。
 
 プログラムを動かすには画面下の [ Send ] をクリックします。プログラム中に動作を一旦停止させるような指示があった場合、その地点で一時停止します。準備が整ったら、右上の [ Hold ](図7)をクリックすると、動作が再び開始されます。
 今回の場合、約10分で加工が終わりました。作業にどれくらい掛かるのか、目安となる時間が画面中央に表示されます。
 
 また、プログラムを途中で終了させたいときは、画面下側中央の [ Abort ] をクリックすると作業は終了となります(以降のGコードは無効となります)。

 また、今回の切削では台に当たる部分に板を用いました。木材は湿気で膨張したり収縮すると思われるので、湿気に影響されない樹脂に変えて試してみたいとも思っています。

https://www.footfoot.tokyo/post/2019/candle-pcb  参照

Candleで生基板を切削

Candleで生基板を切削してみる【CNCルーターでプリント基板製作】
前回は回路のG-codeを作ったのでCandleで切削してプリント基板を完成させます。なお穴は開けないズボラな基板になります。

CNCとPCの環境

  • CNCルーター : SainSmart Genmitsu CNC 3018-Pro
  • コントロール基板のファームウェア : GRBL 1.1f
  • PC : Windows10 64bit
  • USBシリアルドライバー : CH340

GRBLコントローラーはGRBL 1.1fに対応してるCandle_1.1.7を使います。SainSmartのキットに付属してる標準の環境です。USBシリアル通信のドライバーのCH340は最新のWin10ではUSBをつなぐだけで認識されたので標準サポートされてるようです。Candleの使い方はCandle Wikiにざっくりとしか書いてないので検索して調べました。

candleの画面

切削の前のセッティング

とりあえずInkscapeで作ったG-codeの.ncのファイルを「File」->「Open」で読み込みます。

CandleとCNCの接続

接続設定は上部メニュー「Service」->「Setting」でポートの更新マークをクリックするとCOMポートを自動で取得してくれます。COM4を選ぶとStatusがIdleになってJogでXYZ軸が動かせました。Settingはその他にたくさん項目がありますがこのままで問題なかったので触らず。

candle 1.1.7の初期設定。ポート設定

生基板を設置

素材の固定は金具は使わずにアクリル板に両面テープで固定するようにしてます。あんまりべったりつけると剥がすのが大変なので7.5cm x 10cmの生基板なら両面テープは5点ぐらいで十分。フレームと平行になるように工作マットを当てて大体テーブルの中央にくっつけました。両面テープはダイソーの「しっかり貼れてはがせる両面テープ」を使用。紙タイプのやつ。

ちなみにこの生基板は1.6mm厚で銅箔35μmのガラスエポキシ(FR-4)で、サイズが大きかったのでPカッターで何回も引っ掻いて割ったんですが硬くて大変でした。紙フェノールとか柔らかめの素材もあるのであとで試そう。このCNCでくり抜いたりするにはガラスエポキシは厳しいかもしれないし。

生基板を固定する両面テープ

XYZ軸をゼロ地点にセット

Gコードの(0,0,0)地点にスピンドルを移動します。XY軸は基板ぴったりだとプローブが使えないので生基板の左下から大体5.08mm内側にJogを操作して合わせました。Stepの値を下げると微調節できます。この5.08mm分(4マス)は予めInkscapeでずらしておいた値なのでこれで作図通りにいくはず。

プローブをV型カッターと生基板に接続

Z軸もゼロ(表面)にします。表面が金属ならプローブで自動で止めることができるので、スピンドルの刃と生基板にプローブを接続をしてControlのZ-probeをクリック。刃が表面についたらControlのZero XYとZero ZをクリックしてWork Coordinateを(0,0,0)にします。これで今の位置がゼロ地点になりました。

candleのゼロ地点の操作。Z-probe,XY Zero,Z ZeroでWork Coordinateをゼロに

Heightmapで高さを補正

Candleにはプローブを使って高さのずれを補正してくれるHeightmapがあります。プリント基板は掘る深さが0.何mmとかで少しのズレで銅箔が削れなかったりするのでheightmapは必須だなと思いました。

まずHeightmapのCreateをクリック。測る範囲がずれてたのでAutoをクリックすると自動で回路の範囲にしてくれました。Probe gridは高さを測るポイントの数で、多ければ精度は増しますが時間がかかります。7cm程度の回路だったので4x4で、Zt(移動時の高さ)は1.0でZb(Z軸の下限)は-1.0で問題なかったです。設定が終わったらProbeで計測開始。

candleのHeightmap設定

計測が終わったらEdit modeで元の画面に戻ります。Use Heightmapにチェックすると今作ったHeightmapが有効になります。スピンドルは終わったところで止まってますが切削を開始するとゼロ地点に戻るのでこのままで大丈夫でした。

candleのHeightmap完了

切削開始

準備が整ったのであとは下にあるSendを押すだけ。

candleでGコードを実行。

シンプルな回路なので2分ちょっとで削り終わりました。Z軸が-0.2mmで先端0.1mm角度20°のVカッターだとこの程度の切りくずで済むんですね。ほとんど飛び散ったりしないので掃除が楽。ハンディタイプの掃除機で吸ってから基板を剥がしました。切削中は振動で音がうるさかったフレームの下にゴムパッド的なのは付けたほうがよさそう。

candleで生基板を切削完了

一時停止はPauseで

何かあったらSendの右横にあるPauseで一時停止できます。スピンドルは回ったままなのでスピンドルも止めるならSpindleの刃のマークをクリック。もう一回押せば再開できます。刃にゴミがくっついた等で使いました。

candleで一時停止。Pauseとスピンドル停止

Resetでも止めることができますがこっちは再開はできません。UnlockでIdle状態に戻して最初からやり直すしかないようです。

candleで停止。ResetとUnlock

ズボラなプリント基板完成

うーんシンプル。こんなのでプリント基板と呼んでいいのかわかりませんが完成。明かりに透かしてみるとちゃんと削れてるかわかりますが大丈夫でした。穴は開けないで部品はそのままはんだ付けします。一応ICのところが1.27mmなのでこのぐらいなら切削できますね。