Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

Version 1 Current »

Installing RTL-SDR from source

$ sudo apt install libusb-1.0.0-dev git cmake
$ sudo apt install pkg-config

Then clone the rtl-sdr repo

$ git clone https://github.com/osmocom/rtl-sdr.git 

Once it is cloned, make a build directory, build it and install it:

$ cd rtl-sdr
$ mkdir build
$ cd build
$ cmake ../ -DINSTALL_UDEV_RULES=ON
$ make
$ sudo make install
$ sudo cp ../rtl-sdr.rules /etc/udev/rules.d
$ sudo ldconfig

Creating permissions for non-root users

Next, you need to add some udev rules to make the dongle available for the non-root users.

Find the vendor id and product id for your dongle.

mtb@netrabrick:~$ lsusb
Bus 005 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 004 Device 005: ID 1d6b:0104 Linux Foundation Multifunction Composite Gadget
Bus 004 Device 004: ID 05e3:0610 Genesys Logic, Inc. Hub
Bus 004 Device 003: ID 8087:0029 Intel Corp. AX200 Bluetooth
Bus 004 Device 002: ID 0bda:2838 Realtek Semiconductor Corp. RTL2838 DVB-T
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 002: ID 04b4:0003 Cypress Semiconductor Corp. USB-UART LP
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
lsusb

The important line was the Realtek dongle:

Bus 004 Device 002: ID 0bda:2838 Realtek Semiconductor Corp. RTL2838 DVB-T

The important parts are "0bda" (the vendor id) and "2838" (the product id).

Create a new file as root named /etc/udev/rules.d/20.rtlsdr.rules that contains the following line:

SUBSYSTEM=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="2838", GROUP="adm", MODE="0666", SYMLINK+="rtl_sdr"

With the vendor and product ids for your particular dongle. This should make the dongle accessible to any user in the adm group. and add a /dev/rtl_sdr symlink when the dongle is attached.

mtb@netrabrick:~$ ls -la /dev/rtl_sdr 
lrwxrwxrwx 1 root root 15 Aug 24 12:14 /dev/rtl_sdr -> bus/usb/004/002

When finished, run

mtb@netrabrick:~$ rtl_test
Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Supported gain values (29): 0.0 0.9 1.4 2.7 3.7 7.7 8.7 12.5 14.4 15.7 16.6 19.7 20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4 37.2 38.6 40.2 42.1 43.4 43.9 44.5 48.0 49.6 
[R82XX] PLL not locked!
Sampling at 2048000 S/s.

Info: This tool will continuously read from the device, and report if
samples get lost. If you observe no further output, everything is fine.

Reading samples in async mode...

Blacklisting the Default Kernel Driver

The default kernel might automatically load drivers for the RTL-SDR, which can prevent SDR applications from accessing the dongle. You need to blacklist it.

  1. Create a blacklist.conf file

    sudo vi /etc/modprobe.d/blacklist.conf

  2. Add the following lines at the end of the file:

    blacklist dvb_usb_rtl28xxu

  3. Unload the conflicting kernel module:

    sudo rmmod dvb_usb_rtl28xxu

  4. Reboot the system to apply changes:

    sudo reboot

Testing SDR

If the SDR radio receiver can be found, you should see similar output:

mtb@netrabrick:~$ rtl_test
Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Supported gain values (29): 0.0 0.9 1.4 2.7 3.7 7.7 8.7 12.5 14.4 15.7 16.6 19.7 20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4 37.2 38.6 40.2 42.1 43.4 43.9 44.5 48.0 49.6 
[R82XX] PLL not locked!
Sampling at 2048000 S/s.

Info: This tool will continuously read from the device, and report if
samples get lost. If you observe no further output, everything is fine.

Reading samples in async mode...

rtl_433

rtl_433 is an open-source software tool used with RTL-SDR (Software Defined Radio) dongles. It is specifically designed for decoding and demodulating signals from various low-cost ISM (Industrial, Scientific, and Medical) band devices that operate around the 433 MHz frequency range. These devices often include sensors such as:

  • Weather stations

  • Tire pressure monitoring systems (TPMS)

  • Remote temperature and humidity sensors

  • Power consumption meters (e.g., smart meters)

  • Doorbells and remote control devices

Installing rtl_433

mkdir -p rtl
git clone https://github.com/switchdoclabs/rtl_433.git
cd rtl_433
mkdir build
cd build
cmake ..
make
sudo make install
rtl_433

MariaDB setup

sudo mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] Y
Enabled successfully!
Reloading privilege tables..
 ... Success!


You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] n
 ... skipping.

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Load the SkyWeather databases:

sudo mysql < SkyWeather2_db_schema.sql
sudo mysql < WeatherSenseWireless_db_schema.sql

test the database

sudo mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 43
Server version: 10.11.6-MariaDB-0+deb12u1 Debian 12

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show databases;
+----------------------+
| Database             |
+----------------------+
| SkyWeather2          |
| WeatherSenseWireless |
| information_schema   |
| mysql                |
| performance_schema   |
| sys                  |
+----------------------+
6 rows in set (0.000 sec)

MariaDB [(none)]> 
MariaDB [(none)]> Ctrl-C -- exit!
Aborted

  • No labels