๐Ÿš€ Complete Guide to YateBTS on Raspberry Pi 4: Build Your Own GSM Base Station

Learn how to build a complete GSM base station with YateBTS on Raspberry Pi 4. This comprehensive guide covers everything from hardware setup to advanced configuration, perfect for emergency communication, research, or educational purposes.

๐ŸŽฏ What You'll Learn

  • Complete hardware requirements and setup
  • Step-by-step YateBTS installation process
  • BladeRF Mini A4 configuration and optimization
  • Network configuration and security setup
  • Performance tuning and troubleshooting
  • Real-world use cases and applications

๐Ÿ“‹ Prerequisites

Before starting, ensure you have:

  • Raspberry Pi 4 (8GB RAM recommended)
  • BladeRF Mini A4 SDR device
  • GeeekPi DeskPi Lite Case with cooling
  • M.2 SSD (2TB recommended)
  • Ubuntu 22.04 LTS installed
  • Basic Linux command line knowledge

๐Ÿ”ง Hardware Setup

Raspberry Pi 4 Configuration

The Raspberry Pi 4 with 8GB RAM provides sufficient processing power for YateBTS operations. Here's how to optimize it:

# Enable GPU memory split
sudo raspi-config
# Advanced Options > Memory Split > 16

# Enable SPI and I2C
sudo raspi-config
# Interface Options > SPI > Enable
# Interface Options > I2C > Enable

BladeRF Mini A4 Setup

The BladeRF Mini A4 is our recommended SDR device for its excellent performance and compatibility:

# Install BladeRF drivers
sudo apt update
sudo apt install bladerf

# Verify device detection
bladeRF-cli -p
# Should show: Found a bladeRF with device identifier: 0x0100

Cooling and Power Management

Proper cooling is essential for stable operation:

  • Enable PWM fan control in the GeeekPi case
  • Monitor CPU temperature during operation
  • Use a quality 5V/3A power supply
  • Consider active cooling for extended use

๐Ÿ’ป Software Installation

System Preparation

Start with a clean Ubuntu 22.04 LTS installation:

# Update system
sudo apt update && sudo apt upgrade -y

# Install essential packages
sudo apt install -y build-essential cmake git wget curl
sudo apt install -y libusb-1.0-0-dev libfftw3-dev
sudo apt install -y libbladerf-dev libbladerf2

YateBTS Installation

Install YateBTS from source for best performance:

# Clone YateBTS repository
git clone https://github.com/yatebts/yatebts.git
cd yatebts

# Configure and build
./autogen.sh
./configure --enable-bladerf
make -j4
sudo make install

Configuration Files

Create essential configuration files:

# Create YateBTS configuration directory
sudo mkdir -p /usr/local/etc/yatebts

# Copy default configurations
sudo cp yatebts.conf /usr/local/etc/yatebts/
sudo cp radio.conf /usr/local/etc/yatebts/

โš™๏ธ Network Configuration

GSM Network Settings

Configure your GSM network parameters:

# Edit yatebts.conf
sudo nano /usr/local/etc/yatebts/yatebts.conf

# Set network parameters
[GSM]
MCC=001
MNC=01
ShortName=RFS-BTS
LongName=RFS Portable BTS
LocationAreaCode=1
CellID=1

Radio Configuration

Configure the BladeRF radio settings:

# Edit radio.conf
sudo nano /usr/local/etc/yatebts/radio.conf

# Set radio parameters
[Radio]
Device=bladerf
Frequency=900000000
Bandwidth=200000
Gain=40

๐Ÿ”’ Security Configuration

Authentication Setup

Configure SIM authentication for security:

# Create authentication database
sudo mkdir -p /usr/local/var/lib/yatebts
sudo sqlite3 /usr/local/var/lib/yatebts/auth.db

# Create authentication table
CREATE TABLE auth (
    imsi TEXT PRIMARY KEY,
    ki TEXT NOT NULL,
    opc TEXT,
    amf TEXT
);

Firewall Configuration

Secure your system with proper firewall rules:

# Configure UFW firewall
sudo ufw enable
sudo ufw allow ssh
sudo ufw allow 5060/udp  # SIP
sudo ufw allow 5060/tcp  # SIP
sudo ufw allow 10000:20000/udp  # RTP

๐Ÿš€ Performance Optimization

System Tuning

Optimize your Raspberry Pi for YateBTS:

# Set CPU governor to performance
echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

# Increase network buffer sizes
echo 'net.core.rmem_max = 16777216' | sudo tee -a /etc/sysctl.conf
echo 'net.core.wmem_max = 16777216' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p

BladeRF Optimization

Optimize BladeRF performance:

# Set optimal gain settings
bladeRF-cli -g 40

# Configure sample rates
bladeRF-cli -s 2000000

# Enable bias tee if needed
bladeRF-cli -b 1

๐Ÿงช Testing and Validation

System Tests

Verify your installation:

# Test BladeRF connection
bladeRF-cli -p

# Test YateBTS startup
sudo yatebts -c /usr/local/etc/yatebts/yatebts.conf

# Check system resources
htop
iostat -x 1

Network Testing

Test your GSM network:

  • Use a GSM phone to scan for networks
  • Verify your BTS appears in network list
  • Test call establishment and quality
  • Monitor signal strength and coverage

๐Ÿ“Š Monitoring and Maintenance

System Monitoring

Set up monitoring for your BTS:

# Monitor CPU temperature
watch -n 1 'cat /sys/class/thermal/thermal_zone0/temp'

# Monitor memory usage
watch -n 1 'free -h'

# Monitor network traffic
watch -n 1 'iftop'

Log Management

Configure proper logging:

# Configure YateBTS logging
sudo nano /usr/local/etc/yatebts/yatebts.conf

# Set log levels
[Logging]
Level=info
File=/var/log/yatebts.log
MaxSize=10MB
MaxFiles=5

๐ŸŽฏ Real-World Applications

Emergency Communication

Your portable BTS can provide critical communication during emergencies:

  • Natural disaster response
  • Remote area communication
  • Temporary event coverage
  • Research and testing

Educational Use

Perfect for learning about mobile networks:

  • GSM protocol understanding
  • SDR technology exploration
  • Network security research
  • Telecommunications education

๐Ÿ”ง Troubleshooting

Common Issues

Here are solutions to common problems:

BladeRF Not Detected

# Check USB connection
lsusb | grep -i blade

# Reload USB modules
sudo modprobe -r usb-storage
sudo modprobe usb-storage

High CPU Usage

# Check for thermal throttling
cat /sys/class/thermal/thermal_zone0/temp

# Optimize cooling
sudo apt install fancontrol
sudo pwmconfig

Poor Signal Quality

  • Check antenna connections
  • Verify frequency settings
  • Adjust gain settings
  • Check for interference

๐Ÿ“š Additional Resources

Documentation

Community Support

๐ŸŽ‰ Conclusion

Congratulations! You now have a complete GSM base station running on Raspberry Pi 4. This setup provides a powerful platform for emergency communication, research, and education.

Remember to:

  • Follow local regulations for radio transmission
  • Use appropriate antennas for your use case
  • Monitor system performance regularly
  • Keep your system updated and secure

For more advanced configurations and optimizations, check out our Performance Guide and Security Guide.

๐Ÿš€ Ready to Build Your Own?

Get started with our Quick Start Guide or join our Discord community for support and collaboration.