<?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: Mounir</title>
    <description>The latest articles on DEV Community by Mounir (@supermnr).</description>
    <link>https://dev.to/supermnr</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%2F2422738%2Fc48d9451-3125-49b0-ab7c-4d7d705475eb.jpg</url>
      <title>DEV Community: Mounir</title>
      <link>https://dev.to/supermnr</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/supermnr"/>
    <language>en</language>
    <item>
      <title>Self-Host n8n Nod 24/7 for $19/mo (v0.8.0 Setup &amp; Cost Math)</title>
      <dc:creator>Mounir</dc:creator>
      <pubDate>Sun, 22 Nov 2026 23:14:33 +0000</pubDate>
      <link>https://dev.to/supermnr/self-host-n8n-nod-247-for-19mo-v080-setup-cost-math-k84</link>
      <guid>https://dev.to/supermnr/self-host-n8n-nod-247-for-19mo-v080-setup-cost-math-k84</guid>
      <description>&lt;p&gt;n8n recently open-sourced &lt;strong&gt;Nod&lt;/strong&gt; (Apache 2.0), a personal AI agent that runs inside its own isolated Linux workspace and headless Chromium browser. On paper, the software is 100% free.&lt;/p&gt;

&lt;p&gt;In practice, running Nod like a true 24/7 personal assistant on a laptop hits &lt;strong&gt;two hidden walls&lt;/strong&gt; immediately:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The Laptop Trap:&lt;/strong&gt; Closing your MacBook or Windows lid puts the OS to sleep and freezes your Docker containers. Your 6:30 AM cron briefings and remote Telegram commands silently fail.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Frontier Browser Loops:&lt;/strong&gt; Headless browser tasks aren't 500-token chat prompts. Reading bulky DOM snapshots and looping through tool retries averages &lt;strong&gt;~40,000 tokens per run&lt;/strong&gt;, easily burning &lt;strong&gt;$72 to $144/month&lt;/strong&gt; on frontier APIs.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here is the complete breakdown of how to pair Nod's &lt;strong&gt;v0.8.0 per-task model splitting&lt;/strong&gt; with an &lt;strong&gt;8 GB KVM VPS&lt;/strong&gt; to run 24/7 for roughly &lt;strong&gt;$19.45/month&lt;/strong&gt; (breaking even in Month 2).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Prefer watching? The full video walkthrough is embedded at the top of this post. All commands and cost math are written out below.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;VPS used for this setup: &lt;a href="https://my.racknerd.com/aff.php?aff=22039" rel="noopener noreferrer"&gt;RackNerd 8 GB KVM Plans&lt;/a&gt; (affiliate link, ~$10/mo on annual promo). Disclosure: I may earn a commission at no extra cost to you.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Version Note: This guide was verified on Nod &lt;code&gt;v0.8.0&lt;/code&gt; (Nov 16). Because Nod is an active research preview with rapid &lt;code&gt;v0.9.x&lt;/code&gt; updates shipping frequently, always check the latest release notes in &lt;code&gt;n8n-io/nod&lt;/code&gt; before rebuilding.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  1. What Actually Runs Inside Nod
&lt;/h2&gt;

&lt;p&gt;Unlike a lightweight Python script, Nod spins up a multi-container stack under the hood:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Core Server:&lt;/strong&gt; Node.js + Fastify (Pi runtime, MCP, and Composio 200+ app integrations)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Durable State:&lt;/strong&gt; PostgreSQL + &lt;code&gt;pg-boss&lt;/code&gt; for memory, cron schedules, and job queues&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sandbox 1:&lt;/strong&gt; An isolated Linux workspace container for file &amp;amp; shell execution&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sandbox 2:&lt;/strong&gt; A dedicated headless Chromium container for logging into portals without APIs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It also ships with &lt;strong&gt;4 built-in guardrails&lt;/strong&gt;: an encrypted credential Vault isolated from raw prompt context, human-in-the-loop Telegram approvals before sending money or emails, a default &lt;strong&gt;$5/task cap&lt;/strong&gt;, and a &lt;strong&gt;$200/month&lt;/strong&gt; default budget ceiling.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Why You Need an Always-On 8 GB VPS (Don't Use 4 GB)
&lt;/h2&gt;

&lt;p&gt;Nod has a keep-awake flag while a job is actively running, &lt;strong&gt;but it cannot override a closed laptop lid or OS sleep mode&lt;/strong&gt;. For reliable morning inbox triage, scheduled web checks, and remote Telegram triggers while traveling, Nod belongs on an always-on Linux box.&lt;/p&gt;

&lt;p&gt;Checking &lt;code&gt;nod/deployment/self-host&lt;/code&gt; in the official repo, the recommended baseline is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;CPU:&lt;/strong&gt; 2+ cores&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;RAM:&lt;/strong&gt; 8 GB minimum&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Storage:&lt;/strong&gt; 50+ GB SSD (Docker images, Postgres, and Chromium add up quickly)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Runtime:&lt;/strong&gt; Docker Engine 25+ (with Compose v2) &amp;amp; HTTPS on ports &lt;code&gt;80/443&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Reality check on 4 GB servers:&lt;/strong&gt; Do not try to squeeze Nod onto a 2 GB or 4 GB VPS if you are building from source. Running &lt;code&gt;docker compose build&lt;/code&gt; alongside PostgreSQL and headless Chromium tabs routinely spikes memory and triggers OOM crashes. On an &lt;strong&gt;8 GB KVM VPS&lt;/strong&gt;, peak load hovers cleanly around &lt;strong&gt;~4.6 GB&lt;/strong&gt;, leaving comfortable headroom.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Nod v0.8.0 Model Splitting: The 24-Month Cost Math
&lt;/h2&gt;

&lt;p&gt;Before &lt;code&gt;v0.8.0&lt;/code&gt;, one expensive frontier model handled everything, including repetitive background cron jobs. Now, you can assign a dedicated &lt;strong&gt;Scheduled Model&lt;/strong&gt; using a low-cost open-weight API while reserving frontier models only for high-stakes interactive prompts.&lt;/p&gt;

&lt;h3&gt;
  
  
  Workload Assumptions
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Browser task average:&lt;/strong&gt; ~40,000 tokens per run (~30k DOM input + ~10k actions/summary output)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Volume:&lt;/strong&gt; 15 scheduled runs/day = &lt;strong&gt;18 Million tokens/month&lt;/strong&gt; (13.5M input / 4.5M output)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Monthly &amp;amp; 24-Month Comparison
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Setup (18M tokens / month)&lt;/th&gt;
&lt;th&gt;API / mo&lt;/th&gt;
&lt;th&gt;VPS / mo&lt;/th&gt;
&lt;th&gt;Total / mo&lt;/th&gt;
&lt;th&gt;24-Month Total&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;Laptop + Claude Opus 5.5&lt;/strong&gt; ($4 / $20)&lt;/td&gt;
&lt;td&gt;$144.00&lt;/td&gt;
&lt;td&gt;$0 &lt;em&gt;(sleeps)&lt;/em&gt;
&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$144.00&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$3,456&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;Laptop + Claude Sonnet 5.5&lt;/strong&gt; ($2 / $10)&lt;/td&gt;
&lt;td&gt;$72.00&lt;/td&gt;
&lt;td&gt;$0 &lt;em&gt;(sleeps)&lt;/em&gt;
&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$72.00&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$1,728&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;RackNerd 8 GB (Annual) + Open API&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;$9.45&lt;/td&gt;
&lt;td&gt;~$10.00&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$19.45&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$467&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;RackNerd 8 GB (Monthly) + Open API&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;$9.45&lt;/td&gt;
&lt;td&gt;$36.59&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$46.04&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$1,105&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Routing those 18M scheduled tokens through an open-weight API like &lt;strong&gt;DeepSeek v4.1 Flash&lt;/strong&gt; ($0.30 input / $1.20 output per million) slashes the monthly API bill from &lt;strong&gt;$72.00 down to $9.45&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Even if you pay the &lt;strong&gt;$119.99/year&lt;/strong&gt; &lt;a href="https://my.racknerd.com/aff.php?aff=22039" rel="noopener noreferrer"&gt;RackNerd 8 GB KVM promo&lt;/a&gt; upfront (6 to 7 vCPU, 150 GB SSD, locked renewal), your token savings against Sonnet 5.5 pay off the entire first year of hosting in &lt;strong&gt;Month 2&lt;/strong&gt;, saving over &lt;strong&gt;$1,260 across 24 months&lt;/strong&gt;. If promotional stock is unavailable or you prefer zero annual lock-in, the standard monthly 8 GB plan ($36.59/mo, 220 GB RAID-10 SSD) still beats Sonnet every month while giving you true 24/7 uptime.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Step-by-Step Self-Host Setup (Ubuntu 24.04)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: Prep Docker &amp;amp; Firewall
&lt;/h3&gt;

&lt;p&gt;SSH into your fresh Ubuntu 24.04 server, install Docker Engine 25+ with Compose v2, and lock down firewall ports:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 1. Install Docker Engine &amp;amp; Compose v2&lt;/span&gt;
curl -fsSL https://get.docker.com &lt;span class="o"&gt;|&lt;/span&gt; sh

&lt;span class="c"&gt;# 2. Lock down UFW ports&lt;/span&gt;
ufw allow 22/tcp
ufw allow 80/tcp
ufw allow 443/tcp
ufw &lt;span class="nb"&gt;enable&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: Clone &amp;amp; Initialize Nod
&lt;/h3&gt;

&lt;p&gt;Clone the official repository and run the setup script to generate your &lt;code&gt;.env&lt;/code&gt;, database credentials, and Vault encryption keys:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/n8n-io/nod.git
&lt;span class="nb"&gt;cd&lt;/span&gt; nod/deployment/self-host
sh setup.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3: Build, Launch &amp;amp; Verify
&lt;/h3&gt;

&lt;p&gt;Build and start the containers in detached mode, waiting for health checks:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker compose up -d --build --wait

&lt;span class="c"&gt;# Verify PostgreSQL, Workspace, and Chromium are all healthy&lt;/span&gt;
docker compose ps
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 4: Configure v0.8.0 Model Splitting
&lt;/h3&gt;

&lt;p&gt;Open the dashboard over &lt;strong&gt;HTTPS&lt;/strong&gt; (remote web browser logins require HTTPS):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Add your primary frontier API key (optional, for complex interactive reasoning) and your open-weight API key.&lt;/li&gt;
&lt;li&gt;Under &lt;strong&gt;v0.8.0 Settings&lt;/strong&gt;, assign your cheap open-weight model as the &lt;strong&gt;Scheduled Model&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Pair your Telegram bot for remote control and human-in-the-loop approvals.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  5. Four Real Gotchas Before You Deploy
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Gotcha #1: Port 80 / 443 Collision (Bundled Caddy)
&lt;/h3&gt;

&lt;p&gt;If your VPS already hosts &lt;strong&gt;n8n, Coolify, Traefik, or Nginx&lt;/strong&gt; on ports &lt;code&gt;80&lt;/code&gt; and &lt;code&gt;443&lt;/code&gt;, &lt;strong&gt;do not&lt;/strong&gt; enable Nod's bundled Caddy HTTPS profile, or it will crash trying to bind the same ports.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fix:&lt;/strong&gt; Keep Caddy disabled and point your existing reverse proxy to &lt;code&gt;127.0.0.1:4310&lt;/code&gt; with &lt;strong&gt;WebSockets enabled&lt;/strong&gt;, or access it privately via Tailscale or an SSH tunnel.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Gotcha #2: Unmanaged VPS Backups Are on You
&lt;/h3&gt;

&lt;p&gt;Low-cost KVM providers like RackNerd give you clean root Linux performance, not a managed PaaS control panel. Set up automated off-server backups for your &lt;code&gt;.env&lt;/code&gt; file, Vault keys, and PostgreSQL volumes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Gotcha #3: Don't Use Tiny Models on Vault / Write Actions
&lt;/h3&gt;

&lt;p&gt;Even n8n notes that safety approvals are model-driven. Smaller open-weight models are noticeably weaker at spotting &lt;strong&gt;prompt injections&lt;/strong&gt; buried inside untrusted emails or scraped web pages.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Smart Split:&lt;/strong&gt; Use open-weight models for read-only morning briefs and web summaries; keep high-risk financial, email-sending, or Vault actions gated by a strong frontier model + Telegram approval.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Gotcha #4: Fast Release Velocity
&lt;/h3&gt;

&lt;p&gt;Nod is evolving fast (&lt;code&gt;v0.7&lt;/code&gt; ➔ &lt;code&gt;v0.8&lt;/code&gt; ➔ &lt;code&gt;v0.9+&lt;/code&gt;). Before running &lt;code&gt;git pull &amp;amp;&amp;amp; docker compose up --build&lt;/code&gt;, always read the latest release notes for &lt;code&gt;.env&lt;/code&gt; or schema changes, and back up your volumes first.&lt;/p&gt;




&lt;h2&gt;
  
  
  Resources &amp;amp; Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Official Repository:&lt;/strong&gt; &lt;a href="https://github.com/n8n-io/nod" rel="noopener noreferrer"&gt;github.com/n8n-io/nod&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;8 GB KVM VPS Used in Benchmarks:&lt;/strong&gt; &lt;a href="https://my.racknerd.com/aff.php?aff=22039" rel="noopener noreferrer"&gt;RackNerd 8 GB KVM Plans&lt;/a&gt; &lt;em&gt;(Affiliate link)&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Are you keeping Nod on your desktop or moving it to a VPS? Drop your stack or token usage numbers in the comments below!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>selfhosted</category>
      <category>tutorial</category>
      <category>automation</category>
    </item>
    <item>
      <title>20 ESP32s Burn ThingsBoard's Free Tier in 28 Hours. Here's What Hosting Actually Costs</title>
      <dc:creator>Mounir</dc:creator>
      <pubDate>Wed, 18 Nov 2026 22:51:28 +0000</pubDate>
      <link>https://dev.to/supermnr/20-esp32s-burn-thingsboards-free-tier-in-28-hours-heres-what-hosting-actually-costs-3i7l</link>
      <guid>https://dev.to/supermnr/20-esp32s-burn-thingsboards-free-tier-in-28-hours-heres-what-hosting-actually-costs-3i7l</guid>
      <description>&lt;p&gt;&lt;em&gt;Disclosure: This post contains affiliate links (&lt;a href="https://thingsboard.io/?fpr=r5cma7" rel="noopener noreferrer"&gt;ThingsBoard&lt;/a&gt; and &lt;a href="https://my.racknerd.com/aff.php?aff=22039" rel="noopener noreferrer"&gt;RackNerd&lt;/a&gt;), meaning I may earn a commission at no extra cost to you. I also co-founded AskSensors, included below as a managed alternative. Prices verified Nov 17, 2026.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;ThingsBoard 4.4 merged its Community and Professional editions under a source-available license (BUSL 1.1) on September 29. Since then, I wanted to check what a modest ESP32 fleet actually costs on Managed Cloud compared to running it on your own box, or skipping ThingsBoard altogether.&lt;/p&gt;

&lt;p&gt;Take a normal setup: &lt;strong&gt;20 ESP32 boards, 5 sensor readings each, sending one MQTT payload every 10 seconds.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;On ThingsBoard Cloud's Free plan, that setup burns through the monthly quota in about &lt;strong&gt;28 hours&lt;/strong&gt;. You don't even make it through the weekend. Past that, your real 24-month bill depends mostly on how much Linux maintenance you feel like doing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;ThingsBoard Cloud&lt;/strong&gt; lands at &lt;strong&gt;$69 to $79/month&lt;/strong&gt; with top-up packs (&lt;strong&gt;$1,656 to $1,896 over two years&lt;/strong&gt;), not automatically $149/month like a lot of guides assume.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;An 8 GB KVM VPS&lt;/strong&gt; costs &lt;strong&gt;$240 to $878 over two years&lt;/strong&gt;, as long as you are fine updating Docker and PostgreSQL yourself.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A flat-rate managed alternative (&lt;a href="https://asksensors.com/pricing.html" rel="noopener noreferrer"&gt;AskSensors PRO&lt;/a&gt;)&lt;/strong&gt; works out to &lt;strong&gt;$380 to $456 over two years&lt;/strong&gt;, with no server to manage if you don't need ThingsBoard's Rule Engine.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Quick verdict
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Go with &lt;a href="https://thingsboard.io/?fpr=r5cma7" rel="noopener noreferrer"&gt;ThingsBoard Cloud&lt;/a&gt;&lt;/strong&gt; if you want their Rule Engine without touching Linux, Java, or database backups. Even better if your sensors can report every &lt;strong&gt;30 seconds&lt;/strong&gt; instead of 10, which drops the bill to &lt;strong&gt;$49/month&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grab an &lt;a href="https://my.racknerd.com/aff.php?aff=22039" rel="noopener noreferrer"&gt;8 GB RackNerd KVM VPS&lt;/a&gt;&lt;/strong&gt; if you need 10-second updates, want a full year of raw telemetry on your own disk for around &lt;strong&gt;$10/month&lt;/strong&gt; (on annual promos), and don't mind spending time in a terminal.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Try &lt;a href="https://asksensors.com/pricing.html" rel="noopener noreferrer"&gt;AskSensors PRO&lt;/a&gt;&lt;/strong&gt; if you just need dashboards, alerts, and 24-month retention for 20 to 25 devices at &lt;strong&gt;$15.83 to $19/month&lt;/strong&gt;, without maintaining a server or counting data points.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why 20 ESP32s burn the free tier in 28 hours
&lt;/h2&gt;

&lt;p&gt;On ThingsBoard Cloud, you aren't just billed per MQTT message. Every numeric key inside your payload counts as one billable data point. With 20 boards sending temperature, humidity, battery voltage, RSSI, and uptime every 10 seconds over a 30-day month:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Messages:&lt;/strong&gt; &lt;code&gt;20 x (2,592,000 / 10) = 5.184 million / month&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data points:&lt;/strong&gt; &lt;code&gt;5.184M x 5 = 25.92 million / month&lt;/code&gt; (10 points per second)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is how each ThingsBoard Cloud tier handles that load:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Cloud Plan&lt;/th&gt;
&lt;th&gt;Base Limits&lt;/th&gt;
&lt;th&gt;At 25.92M points/mo&lt;/th&gt;
&lt;th&gt;Monthly Bill&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Free&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;5 devices, 1M points&lt;/td&gt;
&lt;td&gt;Over device cap; 1M points gone in ~27.8h&lt;/td&gt;
&lt;td&gt;$0 (unusable)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Prototype&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;50 devices, 5M msg, 10M points&lt;/td&gt;
&lt;td&gt;Hits 10M cap on Day 12 unless topped up&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;$69/mo&lt;/strong&gt; (4 Traffic Packs, 30d TTL)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Prototype (60d default TTL)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;1B storage point-days included&lt;/td&gt;
&lt;td&gt;25.92M x 60d = 1.555B point-days&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;$79/mo&lt;/strong&gt; (4 Traffic + 1 Storage Pack)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Pilot&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;100 devices, 50M msg, 100M points&lt;/td&gt;
&lt;td&gt;Fits out of the box (needed above 50 devices)&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$149/mo&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;You don't actually have to jump straight from $49 Prototype to $149 Pilot. Prototype lets you buy &lt;code&gt;$5&lt;/code&gt; Traffic Packs (+2.5M messages and +5M data points each). Four packs add &lt;code&gt;$20/month&lt;/code&gt;, cover the load, and put you at &lt;strong&gt;$69/month&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Watch the default retention setting, though. Prototype keeps raw telemetry for &lt;strong&gt;60 days&lt;/strong&gt; out of the box. At 10 points per second, that adds up to &lt;code&gt;1.555 billion&lt;/code&gt; point-days, which crosses the 1B included limit and triggers an extra &lt;code&gt;$10&lt;/code&gt; Storage Pack. Trim your rule chain down to &lt;strong&gt;30 days&lt;/strong&gt; right away, or you end up paying &lt;strong&gt;$79/month&lt;/strong&gt; without noticing why.&lt;/p&gt;

&lt;h2&gt;
  
  
  24-month math: Cloud vs. RackNerd 8 GB KVM
&lt;/h2&gt;

&lt;p&gt;Under ThingsBoard 4.4's Free License (BUSL 1.1), &lt;strong&gt;commercial self-hosting costs $0 up to 100 devices on one production server&lt;/strong&gt;, provided you leave ThingsBoard branding visible.&lt;/p&gt;

&lt;p&gt;For hardware sizing, ThingsBoard's PostgreSQL estimate (~14 MB per point-per-second per day) comes out to roughly &lt;strong&gt;51 GB per year&lt;/strong&gt; just for raw telemetry at 10 points/sec. Add Java 25, PostgreSQL, and Docker containers, and an &lt;strong&gt;8 GB RAM / 150+ GB SSD&lt;/strong&gt; server gives you comfortable headroom.&lt;/p&gt;

&lt;p&gt;Looking at &lt;a href="https://my.racknerd.com/aff.php?aff=22039" rel="noopener noreferrer"&gt;RackNerd&lt;/a&gt;, there are two realistic ways to rent 8 GB KVM:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Annual 8 GB KVM special:&lt;/strong&gt; around &lt;strong&gt;$119.99/year&lt;/strong&gt; (~$10.00/mo), locked recurring rate, 150 GB SSD.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Standard monthly 8 GB KVM:&lt;/strong&gt; &lt;strong&gt;$36.59/month&lt;/strong&gt;, 6 vCPU, 220 GB RAID-10 SSD, no annual lock-in.&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Timeframe&lt;/th&gt;
&lt;th&gt;Cloud Prototype ($69/mo, 30d TTL)&lt;/th&gt;
&lt;th&gt;Cloud Pilot ($149/mo, &amp;gt;50 dev)&lt;/th&gt;
&lt;th&gt;RackNerd 8 GB (Annual ~$10/mo)&lt;/th&gt;
&lt;th&gt;RackNerd 8 GB (Monthly $36.59/mo)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;12 Months&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;$828&lt;/td&gt;
&lt;td&gt;$1,788&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$120&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$439&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;24 Months&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;$1,656&lt;/td&gt;
&lt;td&gt;$3,576&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$240&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$878&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Year 3+ Rate&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;$69/mo&lt;/td&gt;
&lt;td&gt;$149/mo&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;$10/mo&lt;/strong&gt; (locked)&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$36.59/mo&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;If you prepay the &lt;strong&gt;$119.99 annual VPS&lt;/strong&gt;, you break even against &lt;code&gt;$69/mo&lt;/code&gt; Cloud in &lt;strong&gt;Month 2&lt;/strong&gt; (&lt;code&gt;$119.99&lt;/code&gt; spent once vs. &lt;code&gt;$138&lt;/code&gt; cumulative Cloud). Pick the &lt;strong&gt;$36.59 monthly VPS&lt;/strong&gt; instead and you are &lt;code&gt;$32.41/mo&lt;/code&gt; cheaper from &lt;strong&gt;Month 1&lt;/strong&gt;, with zero upfront commitment.&lt;/p&gt;

&lt;p&gt;Your own time isn't free, of course. Saving &lt;code&gt;$59/month&lt;/code&gt; (annual VPS vs. &lt;code&gt;$69&lt;/code&gt; Cloud) pays you &lt;code&gt;$50/hour&lt;/code&gt; as long as server upkeep stays under roughly &lt;strong&gt;70 minutes a month&lt;/strong&gt; after initial setup. If you spend a Saturday night every other month debugging a broken Docker upgrade, that math stops looking quite so good.&lt;/p&gt;

&lt;h2&gt;
  
  
  The easiest fix before you buy anything
&lt;/h2&gt;

&lt;p&gt;Before pulling out a card, ask yourself if your hallway thermometer really needs to phone home every 10 seconds.&lt;/p&gt;

&lt;p&gt;Change your ESP32 send interval from &lt;strong&gt;10 seconds to 30 seconds&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;20 x 5 / 30 s = 8.64M points/month&lt;/code&gt;. That sits comfortably under Prototype's 10M limit and drops your Cloud bill from &lt;strong&gt;$69 or $79/month down to $49/month&lt;/strong&gt; (the exact cutoff in a 30-day month is &lt;strong&gt;26 seconds&lt;/strong&gt;). For room temperature, humidity, or battery voltage, 30 seconds is plenty.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where both options can bite you
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;On ThingsBoard Cloud:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Default 60-day retention:&lt;/strong&gt; Leave the default TTL untouched and you pay an extra &lt;strong&gt;$10/month Storage Pack&lt;/strong&gt; for history you might not care about.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;51-device cliff:&lt;/strong&gt; Device #51 forces a jump to Pilot (&lt;strong&gt;$149/month&lt;/strong&gt;), even if your boards barely send any data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hosting location:&lt;/strong&gt; Telemetry lives on the vendor's AWS tenant rather than your own disk.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;On RackNerd (Self-Hosted):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Unmanaged Linux:&lt;/strong&gt; RackNerd gives you a bare VPS, not a one-click ThingsBoard dashboard. You install Docker, configure TLS with Caddy or Nginx, and handle OS, Java 25, and PostgreSQL updates yourself.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Backups are your problem:&lt;/strong&gt; Provider snapshots aren't tested restores. Set up automated off-server &lt;code&gt;pg_dump&lt;/code&gt; backups and database retention pruning, or telemetry will eventually fill your disk.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;BUSL 1.1 limits:&lt;/strong&gt; The free license covers &lt;strong&gt;100 devices on one production server&lt;/strong&gt; with ThingsBoard branding. Running a separate staging instance in production, white-labeling, or passing 100 devices requires a paid license.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Promo stock:&lt;/strong&gt; Annual 8 GB specials (~$119.99/yr) depend on active stock. Outside promos, standard monthly 8 GB KVM pricing is &lt;strong&gt;$36.59/month&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A third option: skipping ThingsBoard altogether
&lt;/h2&gt;

&lt;p&gt;Look, ThingsBoard is tough to beat if you actually need its Rule Engine, digital twins, or white-label customer portals. A lot of ESP32 projects just don't need any of that.&lt;/p&gt;

&lt;p&gt;If you only want MQTT or HTTP ingestion, live graphs, email alerts, and CSV/JSON exports without paying &lt;strong&gt;$69 to $79/month&lt;/strong&gt; or babysitting PostgreSQL on weekends, there is a simpler middle ground.&lt;/p&gt;

&lt;p&gt;Full transparency here: I co-founded &lt;strong&gt;&lt;a href="https://asksensors.com/pricing.html" rel="noopener noreferrer"&gt;AskSensors&lt;/a&gt;&lt;/strong&gt;. Because we charge per device instead of metering data points, &lt;strong&gt;20 ESP32 boards pushing 5 readings every 10 seconds&lt;/strong&gt; fit on our &lt;strong&gt;PRO plan&lt;/strong&gt; (up to 25 devices):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AskSensors PRO (Monthly):&lt;/strong&gt; &lt;strong&gt;$19/month&lt;/strong&gt; (&lt;strong&gt;$228/year&lt;/strong&gt;, &lt;strong&gt;$456 over 24 months&lt;/strong&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AskSensors PRO (Annual):&lt;/strong&gt; &lt;strong&gt;$190/year&lt;/strong&gt; (~$15.83/month, &lt;strong&gt;$380 over 24 months&lt;/strong&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Included:&lt;/strong&gt; Unlimited data storage, &lt;strong&gt;24 months of retention&lt;/strong&gt; (versus 30 or 60 days on ThingsBoard Prototype), 1-second graph refresh, up to 25 custom dashboards and 300 shareable widgets, plus CSV/JSON export.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Past 50 devices:&lt;/strong&gt; Where ThingsBoard Cloud jumps to $149/month at device #51, our &lt;strong&gt;GURU plan&lt;/strong&gt; covers up to &lt;strong&gt;60 devices&lt;/strong&gt; with &lt;strong&gt;30 months of retention&lt;/strong&gt; for &lt;strong&gt;$29/month&lt;/strong&gt; (or &lt;strong&gt;$290/year&lt;/strong&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is how all five setups compare over 24 months:&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%2Fdqeithezuus0ryo3zawz.png" 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%2Fdqeithezuus0ryo3zawz.png" alt="24-Month Hosting Cost Comparison for 20 ESP32s at 10-Second Intervals" width="800" height="336"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Option&lt;/th&gt;
&lt;th&gt;12 Months&lt;/th&gt;
&lt;th&gt;24 Months&lt;/th&gt;
&lt;th&gt;Operations&lt;/th&gt;
&lt;th&gt;Key Trade-off&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;ThingsBoard Cloud (30d TTL)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;$828&lt;/td&gt;
&lt;td&gt;$1,656&lt;/td&gt;
&lt;td&gt;Managed&lt;/td&gt;
&lt;td&gt;Expensive at 10s intervals; $149/mo above 50 devices&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;RackNerd 8 GB (Monthly)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;$439&lt;/td&gt;
&lt;td&gt;$878&lt;/td&gt;
&lt;td&gt;Unmanaged&lt;/td&gt;
&lt;td&gt;No lock-in, but you handle Linux, Docker &amp;amp; Postgres&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;AskSensors PRO (Monthly)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;$228&lt;/td&gt;
&lt;td&gt;$456&lt;/td&gt;
&lt;td&gt;Managed&lt;/td&gt;
&lt;td&gt;Simpler feature set (no TB Rule Engine or white-labeling)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;AskSensors PRO (Annual)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;$190&lt;/td&gt;
&lt;td&gt;$380&lt;/td&gt;
&lt;td&gt;Managed&lt;/td&gt;
&lt;td&gt;24-month retention included; 25-device cap (Guru is $290/yr for 60)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;RackNerd 8 GB (Annual promo)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;$120&lt;/td&gt;
&lt;td&gt;$240&lt;/td&gt;
&lt;td&gt;Unmanaged&lt;/td&gt;
&lt;td&gt;Lowest raw cost, zero managed support&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;I am not going to pretend it replaces ThingsBoard's Rule Engine. If you need heavy server-side processing or want full control over the stack, self-hosting on a &lt;strong&gt;$119.99/year&lt;/strong&gt; VPS is still the cheapest way to go. If you just want a managed dashboard for 20 to 60 ESP32s without paying &lt;strong&gt;$69 to $149/month&lt;/strong&gt;, AskSensors works out to roughly &lt;strong&gt;4x cheaper&lt;/strong&gt; than ThingsBoard Cloud over two years.&lt;/p&gt;

&lt;h2&gt;
  
  
  Run your own numbers
&lt;/h2&gt;

&lt;p&gt;I put the ThingsBoard Cloud vs. RackNerd math into a small static calculator (no signup, no tracking) where you can adjust device count, metrics, send interval, retention days, and both RackNerd plans:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Interactive calculator:&lt;/strong&gt; &lt;a href="https://supermnr.github.io/thingsboard-tco-calculator/" rel="noopener noreferrer"&gt;https://supermnr.github.io/thingsboard-tco-calculator/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Raw pricing JSON and formulas:&lt;/strong&gt; &lt;a href="https://github.com/SuperMnr/thingsboard-tco-calculator/blob/master/pricing-data.json" rel="noopener noreferrer"&gt;https://github.com/SuperMnr/thingsboard-tco-calculator/blob/master/pricing-data.json&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;How many devices are you running right now, and what send interval did you settle on? Drop your numbers in the comments and I will check which tier they land on.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(Links used in this comparison: &lt;a href="https://thingsboard.io/?fpr=r5cma7" rel="noopener noreferrer"&gt;ThingsBoard Cloud / 4.4 Free License&lt;/a&gt;, &lt;a href="https://my.racknerd.com/aff.php?aff=22039" rel="noopener noreferrer"&gt;RackNerd 8 GB KVM VPS&lt;/a&gt;, and &lt;a href="https://asksensors.com/pricing.html" rel="noopener noreferrer"&gt;AskSensors Pricing&lt;/a&gt;.)&lt;/em&gt;&lt;/p&gt;

</description>
      <category>iot</category>
      <category>esp32</category>
      <category>devops</category>
      <category>selfhosted</category>
    </item>
    <item>
      <title>Build Your Own Smart Motion Detector That Actually Works! (ESP32 + PIR Tutorial)</title>
      <dc:creator>Mounir</dc:creator>
      <pubDate>Mon, 24 Feb 2025 13:57:09 +0000</pubDate>
      <link>https://dev.to/supermnr/build-your-own-smart-motion-detector-that-actually-works-esp32-pir-tutorial-1i8n</link>
      <guid>https://dev.to/supermnr/build-your-own-smart-motion-detector-that-actually-works-esp32-pir-tutorial-1i8n</guid>
      <description>&lt;p&gt;Want to protect your home with a DIY solution? Create your own smart motion detector that works as effectively as commercial systems. Perfect for beginners in IoT and home automation!&lt;/p&gt;

&lt;h2&gt;
  
  
  What You'll Create:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A reliable motion detection system that sends instant alerts&lt;/li&gt;
&lt;li&gt;Your own IoT device that works with smart home platforms&lt;/li&gt;
&lt;li&gt;A professional-grade security sensor you built yourself&lt;/li&gt;
&lt;li&gt;Automated email notifications when motion is detected&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Prerequisites :
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Active AskSensors account: &lt;a href="https://asksensors.com/pricing.html" rel="noopener noreferrer"&gt;Create AskSensors account&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Create a new sensor. Follow the simple process described &lt;a href="https://doc.asksensors.com/docs/d/s1/sensor-setup/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Required Hardware:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;ESP32 board&lt;/li&gt;
&lt;li&gt;PIR motion sensor&lt;/li&gt;
&lt;li&gt;Jumper wires&lt;/li&gt;
&lt;li&gt;1kΩ resistor&lt;/li&gt;
&lt;li&gt;Breadboard&lt;/li&gt;
&lt;li&gt;Micro USB cable&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Quick Assembly:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Connect PIR VCC → ESP32 5V&lt;/li&gt;
&lt;li&gt;Connect PIR GND → ESP32 GND&lt;/li&gt;
&lt;li&gt;Connect PIR DATA → ESP32 GPIO2 (with 1kΩ resistor)&lt;/li&gt;
&lt;/ol&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.amazonaws.com%2Fuploads%2Farticles%2Fck0z2wr45qi1vbrnqc1o.png" 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.amazonaws.com%2Fuploads%2Farticles%2Fck0z2wr45qi1vbrnqc1o.png" alt="PIR sensor and ESP32 diagram" width="799" height="273"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Note: The ESP32 GPIOs require 3V3 signals (not 5V tolerent). For quick hack, you can only add a serial resistor of 1K between the PIR DATA pin and the ESP32 GPIO pin to protect the ESP32 GPIO from damage. However, for production, a 5V/3V3 level shifter is needed to guarantee long term circuit reliability. You can check &lt;a href="https://makeradvisor.com/tools/logic-level-converter-module/" rel="noopener noreferrer"&gt;this page&lt;/a&gt; to get a 5V/3V3 level shifter module.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup Instructions:
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Prepare Your Environment
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Install the latest version of the &lt;a href="https://www.arduino.cc/en/Main/Software" rel="noopener noreferrer"&gt;Arduino IDE software (1.8.7 or higher)&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;In your Arduino IDE, go to File&amp;gt; Preferences.&lt;/li&gt;
&lt;li&gt;Go to the “Additional Board Manager URLs” field, Enter the following URL:
&lt;a href="https://dl.espressif.com/dl/package_esp32_index.json" rel="noopener noreferrer"&gt;https://dl.espressif.com/dl/package_esp32_index.json&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;If you already have the ESP8266 boards URL, separate the URLs with a comma as shown below:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://dl.espressif.com/dl/package_esp32_index.json,http://arduino.esp8266.com/stable/package_esp8266com_index.json" rel="noopener noreferrer"&gt;https://dl.espressif.com/dl/package_esp32_index.json,http://arduino.esp8266.com/stable/package_esp8266com_index.json&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now, open boards manager (Tools &amp;gt; Board &amp;gt; Boards Manager), search for ESP32 and click the install button for the “ESP32 by Espressif Systems”.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Code
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Install the &lt;a href="https://github.com/asksensors/pubsubclient" rel="noopener noreferrer"&gt;MQTT PubSubClient Library&lt;/a&gt; for the Arduino IDE if you haven’t already.&lt;/li&gt;
&lt;li&gt;Download this demo from the &lt;a href="https://github.com/asksensors/AskSensors-ESP32-PIR" rel="noopener noreferrer"&gt;AskSensors Github page&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;The provided code simply reads the status of the PIR sensor and send this information to AskSensors over MQTT. You need to modify the following variables:&lt;/li&gt;
&lt;li&gt;Your network credentials, so that ESP8266 can establish a connection with existing network&lt;/li&gt;
&lt;li&gt;The Api Key In and username to set the MQTT Topic:username/apiKeyIn
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="kt"&gt;char&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;ssid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"YOUR_WIFI_NAME"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="kt"&gt;char&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;password&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"YOUR_WIFI_PASSWORD"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="kt"&gt;char&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;username&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"YOUR_USERNAME"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="kt"&gt;char&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;pubTopic&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"publish/username/apiKeyIn"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Upload and Test
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Connect ESP32 via USB&lt;/li&gt;
&lt;li&gt;Check your Sensor data stream on AskSensors.&lt;/li&gt;
&lt;li&gt;You can cross-check the AskSensors graph readings with the values being printed on your ESP32 Serial Terminal.&lt;/li&gt;
&lt;li&gt;You can customize a Binary graph to plot your data as showing by next pictures.&lt;/li&gt;
&lt;/ul&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.amazonaws.com%2Fuploads%2Farticles%2Fiogijjiwi0nxhah1segl.png" 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.amazonaws.com%2Fuploads%2Farticles%2Fiogijjiwi0nxhah1segl.png" alt="PIR sensor on" width="384" height="363"&gt;&lt;/a&gt;&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.amazonaws.com%2Fuploads%2Farticles%2Fphc9mx7j8t5pqrq3we3j.png" 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.amazonaws.com%2Fuploads%2Farticles%2Fphc9mx7j8t5pqrq3we3j.png" alt="PIR sensor off" width="384" height="363"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Configure Email Alerts
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Log into your &lt;a href="https://asksensors.com" rel="noopener noreferrer"&gt;AskSensors Iot platform&lt;/a&gt; &amp;amp; select your sensor&lt;/li&gt;
&lt;li&gt;Click the 'Add Alert' button&lt;/li&gt;
&lt;li&gt;Select 'Email Alert' as the notification type&lt;/li&gt;
&lt;li&gt;Set your desired threshold values:

&lt;ul&gt;
&lt;li&gt;Choose 'Max Value' = 1 to detect motion&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Enter your email address&lt;/li&gt;
&lt;li&gt;Save the configuration&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now you'll receive instant email notifications whenever motion is detected!&lt;/p&gt;

&lt;h2&gt;
  
  
  Perfect For:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Home security&lt;/li&gt;
&lt;li&gt;Smart lighting automation&lt;/li&gt;
&lt;li&gt;Pet monitoring&lt;/li&gt;
&lt;li&gt;Visitor counting&lt;/li&gt;
&lt;li&gt;Energy saving&lt;/li&gt;
&lt;li&gt;Remote property monitoring&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;This project takes only 30 minutes to complete and can be a great addition to your smart home security system. With email alerts, you'll never miss any unauthorized movement again!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>iot</category>
      <category>cpp</category>
      <category>mqtt</category>
      <category>diy</category>
    </item>
  </channel>
</rss>
