diff --git a/doc/example-deployments/HackRF-RPI5/README.md b/doc/example-deployments/HackRF-RPI5/README.md new file mode 100644 index 0000000..544166c --- /dev/null +++ b/doc/example-deployments/HackRF-RPI5/README.md @@ -0,0 +1,101 @@ +# Components + +- Raspberry Pi 5 (RPI) with 16GB RAM. +- 2x HackRF One SDR. +- (Optional, but highly recommended) HackRF TCXO. +- 2x antennas tuned for the chosen frequency. +- (If using ADS-B) Omni-directional ADS-B antenna. +- Good quality RF cables. Ideally, cables with 50ohm impedance. +- RF Cable connectors (e.g. SMA). +- (If using ADS-B) RTL-sdr (RTL2832U & R820T2 are fine. No need for an expensive one). +- (If using ADS-B) Low Noise Amplifier (LNA). +- (If using ADS-B or a cooling fan) DC-to-DC Converter. +- (Optional) Cooling fan (5v or 12v). +- USB Cables (to connect HackRf One and RTL-sdr to RPI). +- Soldering kit. +- Cable crimping tool. +- Heatshrink sleeves. +- Patch cables (to power LNA, use RPI GPIO, etc.). + +# Physical build + +**Circuit Diagram** + +HackRF-Circuit-diagram + + +**Wiring of the 2 HackRF One devices** + +HackRF-wiring + +- If you are using a TCXO to enhance the clock stability, put it on the Surveillance device as shown below. + + + + +- If you are using an original HackRF One, make sure to have an antenna plugged in all the time when operating the SDR. Otherwise, you may damage the board. (The Clifford Heath version which you can find on AliExpress has a protection circuit against this). +- Some of the ADS-B packages you'll find below may fail to install correctly if you don't have the RTL-sdr dongle plugged in. + +# Software Installation + +- Install Ubuntu Server 25.10 +- Update Ubuntu +- Upgrade Ubuntu +- Install Docker by [using the apt repository](https://docs.docker.com/engine/install/ubuntu/) +- Install HackRF firmware and tools + ```bash + sudo apt install hackrf + ``` +- Install RTL-sdr tools + ```bash + sudo apt install rtl-sdr* + ``` +- Install [blah2](https://github.com/30hours/blah2) +- If the installation had failed, this is likely due to the default Dockerfile. It was written for x64 machines. You need to replace it with [this Dockerfile](/30hours/blah2/blob/main/contrib/raspberrypi/Dockerfile) that was written for ARM devices. +- Obtain the HackRF One serial numbers by running ```hackrf_info```. +- Make sure to place the correct config file for HackRF One in ```/opt/blah2/config/config.yml```. Another type of SDR device config could be there be default. All example config files reside in the same directory. +- At this stage, you just need to put the serial numbers of the reference and surveillance HackRF One devices. Tuning other parameters will be discussed separately. +- (Optional) As I have been testing outdoors, it may take the HackRF board a bit of time after a cold start to warm up and stabilise. Hence, I force blah2 to restart after 10mins of boot time + ```bash + sudo crontab -e + ``` + Then, add the following line to the end of the file + ```bash + @reboot sleep 600 && sudo docker compose -f /opt/blah2/docker-compose.yml down; sudo docker compose -f /opt/blah2/docker-compose.yml up + ``` +- Install [adsb2dd](https://github.com/30hours/adsb2dd). No additional configuration is required for adsb2dd. +- Install readsb (it helps if the rtl-sdr dongle is plugged in!). Instruction can be found [here](https://github.com/wiedehopf/adsb-scripts/wiki/Automatic-installation-for-readsb). +- Set your radar location by putting the right coordinates. (latitude, longitude) + ```bash + sudo readsb-set-location 0.00000001 0.00000001 + ``` +- Install [tar1090](https://github.com/wiedehopf/tar1090). After installation, do the following. +```bash +sudo mv /etc/lighttpd/conf-enabled/88-tar1090.conf /etc/lighttpd/conf-enabled/88-tar1090.conf_archived +``` +The service can be accessed now from ```http://ip_address:8504/``` + +**Cooling fan - Optional** + +- If you're going to install a cooling fan in your enclosure to cool it down, install "sensors" to get readings from sensors onboard the RPI. +```bash +sudo apt install lm-sensors +sudo sensors-detect +sensors +``` +- Create the file ```create /opt/automation/fan.sh``` and copy the content of [fan.sh](./fan.sh) inside it. +- Run +```bash +chmod 755 /opt/automation/fan.sh +sudo crontab -e +``` +Insert the following line at the end of the file +```bash +* * * * * sudo /opt/automation/fan.sh +``` + +# Tuning and Troubleshooting + +TBC + + diff --git a/doc/example-deployments/HackRF-RPI5/fan.sh b/doc/example-deployments/HackRF-RPI5/fan.sh new file mode 100644 index 0000000..b20be6a --- /dev/null +++ b/doc/example-deployments/HackRF-RPI5/fan.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# Toggle GPIO 17 based on CPU temperature (>60°C) +# Usage: ./fan.sh + +# Ensure pinctrl is available +if ! command -v pinctrl &> /dev/null; then + echo "Error: pinctrl not found. Please install or check your system." + exit 1 +fi + +# Set GPIO17 as output (optional – can be omitted if already configured) +sudo pinctrl set 17 op + +# Extract the temperature from sensors output +# Expected line: "temp1: +56.2°C" +temp_raw=$(sensors | grep -A 2 "cpu_thermal-virtual-0" | grep "temp1:" | awk '{print $2}' | tr -d '+°C') + +if [ -z "$temp_raw" ]; then + echo "Error: Could not read temperature from sensors" + exit 1 +fi + +# Convert to integer by multiplying by 10 (e.g., 56.2 → 562) +temp_int=$(echo "$temp_raw" | awk '{printf "%d", $1 * 10}') + +# Compare with threshold 60.0°C → 600 +if [ "$temp_int" -gt 600 ]; then + sudo pinctrl set 17 dh + echo "Temperature ${temp_raw}°C is above 60°C → GPIO17 set HIGH" +else + sudo pinctrl set 17 dl + echo "Temperature ${temp_raw}°C is ≤60°C → GPIO17 set LOW" +fi