IoT Anti-Theft Floor Mat System with Raspberry Pi & Pressure Sensors
Secure your home or office entrance with an invisible pressure-sensitive floor mat that triggers silent alarms and mobile alerts when stepped on.
Required Hardware & Component Checklist
Curated components verified for this project. Check the items you need, adjust quantities, and add straight to cart:
IoT Anti-Theft Floor Mat System with Raspberry Pi & Pressure Sensors
Educational Notes
This project is designed to be accessible to students from Class 4 to Masters level, with complexity scalable to match different age groups and skill levels.
Learning Objectives:
- Understand basic electronics and circuitry principles
- Learn sensor applications and data collection techniques
- Develop problem-solving skills through hands-on building and troubleshooting
- Apply programming concepts to control hardware and process data
- Connect projects to real-world Nepalese contexts and challenges
Adaptability:
- For younger students (Class 4-8): Focus on assembling pre-built circuits, observing results, and understanding basic concepts
- For intermediate students (Class 9-12): Modify code, experiment with parameters, and explore underlying principles
- For advanced students (Undergraduate/Masters): Optimize designs, add features, conduct research extensions, and analyze performance
Safety Note: Always supervise younger students when working with electricity, heat, or moving parts.
Create an invisible security perimeter using Force Sensitive Resistors (FSR) embedded under a floor mat. When an intruder steps on the mat, the system silently alerts you via mobile notification without triggering audible alarms that could escalate the situation.
Hardware Bill of Materials (In Stock at Ghumti Pasal):
- Controller: Raspberry Pi 3B+ / 4 Model B
- Pressure Sensors: 4x Round Force Sensitive Resistor (FSR 402) 0.5" diameter
- ADC: MCP3008 8-Channel 10-Bit ADC with SPI Interface
- Indicator: RGB LED Module (Status Indicator)
- Power: 5V 2.5A Micro USB Power Adapter
- Mat: Interlocking Foam Floor Tiles (to conceal sensors)
- Wiring: Thin flexible silicone wires
Circuit Pinout & Wiring Connections:
| Component / Sensor Pin | Raspberry Pi GPIO Pin | Function / Description |
|---|---|---|
| MCP3008 VDD / VREF | 3.3V | ADC Reference Voltage |
| MCP3008 AGND / DGND | GND | Analog & Digital Ground |
| MCP3008 CLK | GPIO 11 (SPI CLK) | SPI Clock |
| MCP3008 DIN | GPIO 10 (SPI MOSI) | SPI Master Out |
| MCP3008 DOUT | GPIO 9 (SPI MISO) | SPI Master In |
| MCP3008 CS/SHDN | GPIO 8 (SPI CE0) | Chip Select |
| MCP3008 CH0-CH3 | FSR Signal Pins | 4 Pressure Sensor Channels |
| FSR Other Lead | 3.3V via 10kฮฉ | Voltage Divider Pull-up |
| RGB LED R/G/B | GPIO 17/27/22 | Status Indicators |
Firmware Source Code (Python 3)
import spidev
import time
import requests
import RPi.GPIO as GPIO
from datetime import datetime
# Telegram Configuration
BOT_TOKEN = "YOUR_BOT_TOKEN"
CHAT_ID = "YOUR_CHAT_ID"
# SPI Setup
spi = spidev.SpiDev()
spi.open(0, 0)
spi.max_speed_hz = 1350000
# GPIO Setup
GPIO.setmode(GPIO.BCM)
LED_PINS = {'R': 17, 'G': 27, 'B': 22}
for pin in LED_PINS.values():
GPIO.setup(pin, GPIO.OUT)
GPIO.output(pin, False)
# Calibration - baseline readings when mat is empty
BASELINE_SAMPLES = 100
THRESHOLD_MULTIPLIER = 1.3
def read_adc(channel):
if channel < 0 or channel > 7:
return -1
adc = spi.xfer2([1, (8 + channel) << 4, 0])
data = ((adc[1] & 3) << 8) + adc[2]
return data
def calibrate_baseline():
print("Calibrating baseline... Keep mat empty!")
baselines = [0, 0, 0, 0]
for _ in range(BASELINE_SAMPLES):
for ch in range(4):
baselines[ch] += read_adc(ch)
time.sleep(0.01)
return [b / BASELINE_SAMPLES for b in baselines]
def set_led(color):
for c, pin in LED_PINS.items():
GPIO.output(pin, c in color)
def send_alert(sensor_id, pressure_value):
message = f"๐จ **FLOOR MAT ALERT**\n"
message += f"Sensor: Zone {sensor_id + 1}\n"
message += f"Pressure: {pressure_value} ADC units\n"
message += f"Time: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n"
message += f"Location: Main Entrance"
url = f"https://api.telegram.org/bot{BOT_TOKEN}/sendMessage"
requests.post(url, json={'chat_id': CHAT_ID, 'text': message, 'parse_mode': 'Markdown'})
def main():
baselines = calibrate_baseline()
thresholds = [int(b * THRESHOLD_MULTIPLIER) for b in baselines]
print(f"Baselines: {baselines}")
print(f"Thresholds: {thresholds}")
print("System armed. Monitoring...")
set_led('G') # Green = Armed
alert_cooldown = {0: 0, 1: 0, 2: 0, 3: 0}
COOLDOWN_SECONDS = 30
try:
while True:
for ch in range(4):
value = read_adc(ch)
if value > thresholds[ch]:
now = time.time()
if now - alert_cooldown[ch] > COOLDOWN_SECONDS:
print(f"ALERT! Zone {ch+1}: {value} (threshold: {thresholds[ch]})")
send_alert(ch, value)
alert_cooldown[ch] = now
set_led('R') # Red = Alert
time.sleep(2)
set_led('G')
time.sleep(0.1)
except KeyboardInterrupt:
set_led('') # Off
GPIO.cleanup()
spi.close()
if __name__ == "__main__":
main()
Installation Guide
- Sensor Placement: Place 4 FSR sensors at corners of entrance mat area
- Wiring: Run thin wires under baseboard to Raspberry Pi location
- Concealment: Cover with interlocking foam tiles - sensors are <1mm thick
- Calibration: Run script with empty mat to establish baseline
- Testing: Step on each zone to verify detection
Zone Configuration Options
| Zones | Coverage Area | Use Case |
|---|---|---|
| 4 Corners | 60x60cm | Standard door mat |
| 8 Sensors (2x MCP3008) | 120x60cm | Wide entrance / hallway |
| 16 Sensors | Full room perimeter | Room-scale intrusion detection |
Nepal-Specific Applications
- Kathmandu Apartments: Silent apartment entry monitoring
- Remote Offices: After-hours intrusion detection without audible alarm
- Shop Fronts: Customer counting + security in one system
- Elderly Care: Fall detection at bedside (pressure pattern analysis)
Power Consumption
- Raspberry Pi 4: ~3.5W idle, ~6W active
- MCP3008: <1mA
- FSR Sensors: Passive (no power)
- Total: ~5W continuous = 120Wh/day
- Solar option: 10W panel + 18650 battery for off-grid
Cost Breakdown (NPR)
| Component | Est. Price | Source |
|---|---|---|
| Raspberry Pi 3B+ | 8,500 | Ghumti Pasal |
| MCP3008 ADC | 450 | Ghumti Pasal |
| 4x FSR 402 | 1,200 | Ghumti Pasal |
| RGB LED Module | 150 | Ghumti Pasal |
| Foam Tiles (4pc) | 800 | Local hardware |
| Power Adapter | 400 | Ghumti Pasal |
| Total | ~11,500 |
Advanced Features
- Weight Estimation: Calibrate with known weights for approximate intruder weight
- Pattern Recognition: Distinguish human footsteps from pets/objects
- Multi-Mat Network: Multiple Pis communicating via MQTT for whole-building coverage
- Integration: Home Assistant, Node-RED, or custom dashboard
