The signal level monitoring system, that uses programmable modules Pololu Wixel for spectrum analysis. It was developed at context of the research work.
Note: the publication is based on the draft version of the monitoring system. However, it had the same concepts of realization.
cmtg is Python3.7+ application, that provides real-time signal level monitoring at range 2403.47–2476.50 MHz. For example, you can improve Wi-Fi router work quality, by checking free channels. It's built by client-server architecture and has interactive Web UI. The monitoring system was designed with attention to run it on the single-board computers like Raspberry Pi.
Note: first two versions of the monitoring system: COMonitoring, COMonitoring2.
The programmable module Pololu Wixel is based on the CC2511F32 system-on-chip (SoC), which has an integrated 2.4 GHz radio transceiver. We can load firmware to scan radio ether on different channels:
- Install platform-specific driver.
- Turn the module's bootloader mode and connect it to the computer.
- Load the firmware (file with .wxl extension) via Wixel Configuration Utility.
Note: there is alternative way to load firmware via wixel-sdk. Get more details by Pololu Wixel User's Guide.
On Linux distributions, you have to set group dialout (for our case it gives serial port access):
$ sudo usermod -aG dialout $USER
Otherwise, you should run monitoring system with root permissions.
Note: if you don't have Pololu Wixel modules, the monitoring system supports functional, that emulates module's connection. So, you can check how monitoring system works without real modules. This is described at run section.
This is the simplest way to run application:
- Install docker (don't forget to add the user to the
docker
group). - Clone repository:
$ git clone https://github.com/anzodev/cmtg.git
- Build docker image:
$ cd cmtg
$ docker build -t cmtg .
After that, you will have docker image with cmtg:latest tag, but you can set your specific tag.
The monitoring system run process is described below.
Firstly, install Python3.7. There are several platform-specific ways to install Python interpreters (see more). However, we recommend to use pyenv tool. It's preferable way to manage several Python interpreters on single machine.
Note: if you use Raspbian, the Python3.7 is installed already by system (actual info for 2019-07-10 release date). So, you can just install virtualenv, because pyenv compiles interpreter from source, that can take much time.
After the interpreter is installed, you have several ways to get virtualenv tool:
- With pyenv there is available pyenv-virtualenv plugin already. You don't need to install virtualenv.
- Use method, that is described in docs.
Create environment, activate it and install dependencies from requirements.txt file:
(cmtg-venv)$ pip install -r requirements.txt
Lets reproduce all steps using pyenv (don't forget to check prerequisites):
# Install pyenv.
$ curl https://pyenv.run | bash
# Install Python3.7 interpreter.
$ pyenv install 3.7.4 -v
# Create virtual environment.
$ pyenv virtualenv 3.7.4 cmtg-venv
# Clone repository.
$ mkdir ~/apps && cd ~/apps
$ git clone https://github.com/anzodev/cmtg.git
# Activate virtual environment.
$ cd cmtg
$ pyenv activate cmtg-venv
# Install dependencies.
(cmtg-venv)$ pip install -r requirements.txt
Note, that you have to run cmtg package as module:
$ python -m cmtg
The application supports some command line arguments:
$ python -m cmtg -h
usage: cmtg [-h] [--log string] [--host string] [--port int] [--wxls int]
Pololu Wixel Spectrum Analysis (monitoring system).
optional arguments:
-h, --help show this help message and exit
--log string system logs level
--host string web service host
--port int web service port
--wxls int quantity of emulated Pololu Wixel connections
arguments | type | default | description |
---|---|---|---|
--log |
str | "INFO" | The system log's handler level. Supported values: "NOTSET", "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL". Get more details from docs. |
--host |
str | "0.0.0.0" | The web service host. |
--port |
int | 5000 | The web service port. |
--wxls |
int | 0 | The quantity of emulated Pololu Wixel connections. If you set emulated connections, the real module connection will not recognize anymore while app is running. |
You can run docker container after the docker image is built. There are two important options:
- The
/dev
volume is required, that the monitoring system works with dynamically plugged modules. - Run container with
--privileged
option to give monitoring system access for serial port reading.
Also, you have to publish port to get access for web service. For example:
# Run the monitoring system for real module connections and change logs level.
$ docker run -p 5000:5000 -v /dev:/dev --privileged cmtg:latest --log DEBUG
# Run the monitoring system with 2 emulated Pololu Wixel modules.
$ docker run -p 5000:5000 cmtg:latest --wxls 2
Firstly, you need to activate your virtual environment. After that, run the monitoring system. For example:
# Run the monitoring system and change port.
(cmtg-venv)$ python -m cmtg --port 8080
# Run the monitoring system with 2 emulated Pololu Wixel modules
# and change host.
(cmtg-venv)$ python -m cmtg --wxls 2 --host 127.0.0.1
Vladimir Sokolov (manager)
Ivan Bogachuk (developer)