Skip to content

jakka351/WIFI-CSI-Motion-Detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WIFI-CSI-Motion-Detection

Detecting Motion via WIFI Channel State Information using a RPI4 with patched firmware. Use case: Detect motion through walls using Wi-Fi signals and a Raspberry Pi by capturing Channel State Information (CSI) from 802.11 beacons.

simplescreenrecorder-2025-09-06_16 43 06


Table of Contents

  1. Introduction
  2. Hardware Requirements
  3. Setup
  4. Run the Wi-Fi Sensing Script
  5. Interpretation of Data Display
  6. Credits

Introduction

This project demonstrates how Wi-Fi signals—specifically, CSI extracted from on-board Raspberry Pi Wi-Fi—can be used for detecting motion, even through walls, by analyzing reflections/absorption caused by the human body or moving objects.
Notes:

  • CSI comes from OFDM-based 802.11 beacons; this works best in the 5 GHz band.
  • On many routers, 2.4 GHz uses DSSS (not OFDM), which is less suitable.
  • Use channels like 36/80 or 157/80, which are commonly supported by default patches.
  • This setup disables on-board Wi-Fi communication; make sure to use an Ethernet connection to access the Pi, alternatively use a second USB wifi dongle on WLAN1 to access the Pi.

Hardware Requirements

  • Raspberry Pi 4 Model B (or similar Pi with onboard Wi-Fi).
  • USB Wifi Adaptor

Setup

  1. Flash 32 Bit Raspberry Pi - Legacy OS onto your SD card. This is important as we need to patch the firmware of the Raspbery Pi.

  2. Update and upgrade packages:

    sudo apt update -y && sudo apt upgrade -y
    sudo reboot
    
  3. Install picsi on a Raspberry Pi, which is a Python tool for installing and managing Nexmon CSI on Raspberry Pi: Ensure Python 3 and pip are installed: picsi requires Python 3.7 or newer. Raspberry Pi OS usually comes with Python 3 pre-installed. You'll also need pip for Python

    sudo apt install python3-pip
    pip3 install picsi

    Update your PATH (optional but recommended): To ensure the picsi command is readily available in your terminal, update your shell's PATH variable:

    source ~/.profile

    Install Nexmon CSI firmware/binaries: picsi handles the installation of Nexmon CSI, which involves downloading or compiling the necessary firmware and binaries for your specific Raspberry Pi model. Execute the following command:

    picsi install
    

    Enable picsi

    picsi enable

    This enables Nexmon CSI and starts CSI collection. You can view the status using picsi status or stop it with picsi down.

  4. Set Raspberry Pi Firmware for Channel State Information:

    #/bin/bash
    # run at start up
    #Run this script to setup your CSI parameters and bring up Mon0 - the monitoring interface on wlan0
    makecsiparams -c 157/80 -C 1 -N 1 -b 0x80
    # bring wlan0 up
    sudo ifconfig wlan0 up
    #
    nexutil -Iwlan0 -s500 -b -l34 -v m+IBEQGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==
    # create interface mon0
    sudo iw dev wlan0 interface add mon0 type monitor
    # set mon0 up
    sudo ip link set mon0 up
  5. Create the python scripts, wifi_sensing.py & matrix.py

    located in the github repository
  6. Create the script start.sh

    #/bin/bash
    python3 -u wifi_sensing.py | python3 matrix.py
  7. Run the script

    sudo chmod +x ./start.sh
    ./start.sh

Interpretation of Data Display

I am yet to figure out how to interpret the data on the Console GUI display. Let me know if you have any ideas.

Credits

This is a variation on code found in this guide:
Credit: Mikhail Zakharov, published December 20, 2021
License: GPL-3.0+ (https://www.hackster.io/mzakharo/wifi-sensing-via-raspberry-pi-ff1087)

About

Detecting Motion via WIFI Channel State Information using a RPI4 with patched firmware.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published