<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Destiny Onoja</title>
    <description>The latest articles on DEV Community by Destiny Onoja (@devdestiny).</description>
    <link>https://dev.to/devdestiny</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4202503%2F1a6e4ab7-2243-48df-abac-27146f5ea78e.png</url>
      <title>DEV Community: Destiny Onoja</title>
      <link>https://dev.to/devdestiny</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/devdestiny"/>
    <language>en</language>
    <item>
      <title>How We Built a Real-Time Edge-AI Theft Detection System on a Raspberry Pi 4 + Telegram Alerts</title>
      <dc:creator>Destiny Onoja</dc:creator>
      <pubDate>Wed, 04 Nov 2026 07:51:36 +0000</pubDate>
      <link>https://dev.to/devdestiny/how-we-built-a-real-time-edge-ai-theft-detection-system-on-a-raspberry-pi-4-telegram-alerts-20p1</link>
      <guid>https://dev.to/devdestiny/how-we-built-a-real-time-edge-ai-theft-detection-system-on-a-raspberry-pi-4-telegram-alerts-20p1</guid>
      <description>&lt;p&gt;Traditional surveillance systems often rely on heavy cloud infrastructure or manual monitoring, which introduces latency and high bandwidth costs. &lt;br&gt;
For retail environments, security needs to be instantaneous, local, and cost-effective. To solve this, we developed an Intelligent Video-Based Theft Detection and Alert System as part of our Computer Engineering final year project at FUTMinna. &lt;/p&gt;

&lt;p&gt;We built an edge-computing solution running entirely on a Raspberry Pi 4 Model B (4GB) that detects retail threats and pushes instant alerts to Telegram in an average of 2.1 seconds.&lt;/p&gt;

&lt;p&gt;Here is a breakdown of how the system architecture, hybrid AI pipeline, and alert mechanisms were engineered.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. The Hardware Core: Why Edge Computing?
&lt;/h2&gt;

&lt;p&gt;Running heavy neural networks on resource-constrained hardware is challenging. We chose the Raspberry Pi 4 Model B (4GB RAM) paired with the Raspberry Pi Camera Module v2 (connected natively via the CSI port for low CPU overhead). By processing video locally at 640x480 resolution, the system achieved a steady 25–31 FPS without requiring external cooling or cloud dependencies.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The Hybrid Computer Vision Pipeline
&lt;/h2&gt;

&lt;p&gt;Instead of relying on a single heavy model that would choke a Raspberry Pi, we engineered a three-detection pipeline that runs concurrently:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pipeline 1 - Masked-Face Detection (Haar Cascades)&lt;/strong&gt;:&lt;br&gt;
It Rapidly localizes frontal faces using lightweight Haar cascades adn then extracts the lower 40% of the bounding box (mouth/chin area) and calculates mean pixel intensity to flag hidden identities.   &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pipeline 2 - Weapon &amp;amp; Sharp Object Detection (MobileNetV2)&lt;/strong&gt;:&lt;br&gt;
Uses a custom Haar cascade to isolate hand regions, resizing ROIs to 224 X 224 pixels which passes the region through a MobileNetV2 model trained via transfer learning on a balanced dataset of weapon and non-weapon hand images.   &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pipeline 3 - Pocketing &amp;amp; Concealment Detection (MOG2 Background Subtraction)&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Utilizes OpenCV's MOG2 background subtraction algorithm restricted to the lower 40% of the frame.&lt;/li&gt;
&lt;li&gt;Implements an 8-frame hysteresis counter to track foreground pixel changes (Pcount &amp;gt; 1500), successfully filtering out routine customer movements like browsing shelves or adjusting clothes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When any of these three modules trigger a positive detection, the system elevates into a global "THEFT ALERT" state.   &lt;/p&gt;

&lt;h2&gt;
  
  
  3. Instant Alert Mechanism via Telegram Bot API
&lt;/h2&gt;

&lt;p&gt;Instead of relying on clunky email protocols or expensive SMS gateways, we integrated the Telegram Bot API.   &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F98qi3uvgeyshkg3dlzh6.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F98qi3uvgeyshkg3dlzh6.jpg" alt="Sequence of Telegram alerts received during a prolonged theft event" width="299" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The Flow&lt;/strong&gt;: When an anomaly is confirmed, the system saves an annotated JPEG of the frame locally and sends it to the user's Telegram chat with a timestamped caption ("BEWARE, POSSIBLE THEFT!").
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance&lt;/strong&gt;: Average delivery time was benchmarked at 2.1 seconds.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cooldown Policy&lt;/strong&gt;: An 8-second cooldown timer prevents message flooding during extended incidents while ensuring the very first alert arrives instantly.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Headless Monitoring via Flask Web UI
&lt;/h2&gt;

&lt;p&gt;To allow remote monitoring without an attached HDMI monitor, we built a lightweight web server using the Flask micro-framework. Using classic MJPEG streaming (multipart/x-mixed-replace), store owners can view the live camera feed, bounding boxes, and alert statuses straight from any smartphone or laptop browser connected to the local network.   &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4pigkixgc59c85vfubmc.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4pigkixgc59c85vfubmc.jpg" alt="Screenshot of live web interface" width="520" height="308"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Metrics &amp;amp; Results
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Overall System F1-Score:&lt;/strong&gt; 94.7%   Masked Face&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Precision/Recall:&lt;/strong&gt; 96.4% / 93.8%   Weapon Detection&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Precision/Recall:&lt;/strong&gt; 91.2% / 88.7%   Pocketing&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Detection Precision/Recall:&lt;/strong&gt; 94.1% / 92.6% &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Processing Speed:&lt;/strong&gt; 25–31 FPS&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Telegram Alerts:&lt;/strong&gt; 2.1seconds&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This project proved that high-accuracy, real-time edge AI is entirely feasible on budget-friendly hardware like the Raspberry Pi without sacrificing performance or relying on expensive cloud subscriptions.   &lt;/p&gt;

</description>
      <category>ai</category>
      <category>python</category>
      <category>machinelearning</category>
      <category>computervision</category>
    </item>
    <item>
      <title>How to Connect Python to the Ethereum Sepolia Testnet Using Web3.py</title>
      <dc:creator>Destiny Onoja</dc:creator>
      <pubDate>Fri, 23 Oct 2026 13:39:59 +0000</pubDate>
      <link>https://dev.to/devdestiny/how-to-connect-python-to-the-ethereum-sepolia-testnet-using-web3py-36k5</link>
      <guid>https://dev.to/devdestiny/how-to-connect-python-to-the-ethereum-sepolia-testnet-using-web3py-36k5</guid>
      <description>&lt;p&gt;Connecting Python applications to smart contracts allows you to build tamper-proof logging pipelines. Here is a quick, step-by-step guide to sending data to the Sepolia testnet using Web3.py.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Python 3.8+ installed&lt;/li&gt;
&lt;li&gt;An RPC URL (from Infura or Alchemy)&lt;/li&gt;
&lt;li&gt;A Sepolia testnet wallet address &amp;amp; private key&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Install Web3.py&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;pip install web3&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Initialize the Connection&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;from web3 import Web3&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Connect to Sepolia via Infura
w3 = Web3(Web3.HTTPProvider('YOUR_INFURA_SEPOLIA_URL'))&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;if w3.is_connected():&lt;br&gt;
    print("Successfully connected to Sepolia Testnet!")&lt;br&gt;
else:&lt;br&gt;
    print("Connection failed.")&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Call Your Smart Contract&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Define contract address and ABI, then send transaction...&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>python</category>
      <category>blockchain</category>
      <category>web3</category>
      <category>ai</category>
    </item>
    <item>
      <title>I Built a Surveillance System That Can't Be Hacked. Here's How.</title>
      <dc:creator>Destiny Onoja</dc:creator>
      <pubDate>Fri, 23 Oct 2026 12:48:02 +0000</pubDate>
      <link>https://dev.to/devdestiny/i-built-a-surveillance-system-that-cant-be-hacked-heres-how-59nc</link>
      <guid>https://dev.to/devdestiny/i-built-a-surveillance-system-that-cant-be-hacked-heres-how-59nc</guid>
      <description>&lt;p&gt;When designing real-time surveillance systems for high-risk security environments, traditional cloud-based logging presents two major issues: latency delays over weak networks and the vulnerability of databases that can be tampered with or deleted by intruders.&lt;/p&gt;

&lt;p&gt;To solve this, I designed and built an &lt;strong&gt;edge-AI automated surveillance pipeline&lt;/strong&gt; that detects local threats and processes video frames at the edge using &lt;strong&gt;TensorFlow Lite on a Raspberry Pi 4B&lt;/strong&gt; and automatically records &lt;strong&gt;tamper-proof attack logs&lt;/strong&gt; directly to the &lt;strong&gt;Ethereum Sepolia Testnet&lt;/strong&gt; using &lt;strong&gt;Web3.py&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Here is a breakdown of how the system was built, deployed, and tested.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Architecture&lt;/strong&gt;&lt;br&gt;
The system consists of three main components working together:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Edge Inference Engine (AI/IoT): OpenCV and TensorFlow Lite processing live camera frames directly on a Raspberry Pi 4B.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Web Monitoring Dashboard: A real-time web interface built with HTML/JS and hosted on Render.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Immutable Audit Layer (Blockchain): A Solidity smart contract deployed on the Ethereum Sepolia Testnet to store tamper-proof logs.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;The Edge AI Engine&lt;/strong&gt;&lt;br&gt;
Training heavy deep learning models locally isn't feasible for low-power edge hardware.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Training: I trained a CNN model, 3D Convolutional AutoEncoder (3DCAE) on Kaggle using custom dataset augmentation (data_gen.py) for low-light surveillance conditions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Optimization: The model was then converted to .tflite format, enabling the Raspberry Pi to perform periodic frame checks with a 3–4 second detection latency ideal for monitoring slow-moving physical threats.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Making Logs Tamper-Proof (Web3 Integration)&lt;/strong&gt;&lt;br&gt;
If a physical security breach occurs, standard database records can easily be wiped or modified by an attacker with local access.&lt;/p&gt;

&lt;p&gt;To prevent this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Whenever the CNN classifies a frame as an "Anomaly", the system automatically triggers a Web3.py script.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The script calls the logAnomaly function on my smart contract deployed at 0x279FcACc1eB244BBD7Be138D34F3f562Da179dd5.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The timestamp, frame index, and device ID are recorded permanently on-chain—creating a verified, unerasable audit log that anyone can inspect via Sepolia Etherscan.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Lessons Learned &amp;amp; Future Improvements&lt;/strong&gt;&lt;br&gt;
Building this system proved that integrating decentralized ledgers with edge AI is practical for high-security environments, but it comes with trade-offs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Latency vs. Speed: Balancing edge CPU memory limits with AI accuracy (achieved ~80% accuracy).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Next Steps: Optimizing models further for Jetson Nano hardware and adding automated Twilio SMS emergency alerts for security teams.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Project Links &amp;amp; Resources&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;GitHub Repository: &lt;a href="https://github.com/Boss-Bobs/Bandit-Detection-System-AI-Blockchain" rel="noopener noreferrer"&gt;https://github.com/Boss-Bobs/Bandit-Detection-System-AI-Blockchain&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Smart Contract on Etherscan: &lt;a href="https://sepolia.etherscan.io/address/0x279FcACc1eB244BBD7Be138D34F3f562Da179dd5" rel="noopener noreferrer"&gt;https://sepolia.etherscan.io/address/0x279FcACc1eB244BBD7Be138D34F3f562Da179dd5&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>blockchain</category>
      <category>python</category>
    </item>
  </channel>
</rss>
