<?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>Forem: Payam Hoseini</title>
    <description>The latest articles on Forem by Payam Hoseini (@payamhn).</description>
    <link>https://forem.com/payamhn</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1521728%2Fd3ec951e-909f-4d50-b41b-6283f70b2835.jpeg</url>
      <title>Forem: Payam Hoseini</title>
      <link>https://forem.com/payamhn</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/payamhn"/>
    <language>en</language>
    <item>
      <title>Agentic AI: A Complete Beginner's Guide</title>
      <dc:creator>Payam Hoseini</dc:creator>
      <pubDate>Fri, 02 Jan 2026 14:45:27 +0000</pubDate>
      <link>https://forem.com/payamhn/agentic-ai-a-complete-beginners-guide-55mh</link>
      <guid>https://forem.com/payamhn/agentic-ai-a-complete-beginners-guide-55mh</guid>
      <description>&lt;p&gt;In the world of AI, there are different kinds of AI. You've probably used ChatGPT or Gemini, they are in group of Generative AI's. It means that they generate a content, wether a simple answer of making a photo or gives you a website codes. But there's a new type of AI that's much more interesting in my opinion. It's called "Agentic AI," and it can actually do things for you, not just chat with you. It's an Agent ;)&lt;/p&gt;

&lt;p&gt;In this guide, you'll learn what Agentic AI is and how to build your own simple AI agent, even if you've never written code before.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Agentic AI?
&lt;/h2&gt;

&lt;p&gt;Think about the difference between asking a friend for advice versus hiring someone to do a job for you.&lt;/p&gt;

&lt;h3&gt;
  
  
  Regular AI: The Friend Who Gives Advice
&lt;/h3&gt;

&lt;p&gt;When you use ChatGPT or a regular chatbot, it's like talking to a knowledgeable friend who reads many many books and can answer any questions that you may have. You ask questions, and it gives you answers. But that's where it stops. If you want to book a flight, it can tell you how to do it, but you still have to open the airline website and do all the clicking yourself.&lt;/p&gt;

&lt;h3&gt;
  
  
  Agentic AI: The Person Who Gets Things Done
&lt;/h3&gt;

&lt;p&gt;Agentic AI is different. It's like hiring someone to actually do the work. You can say "Book me a flight to Tehran next week," and it will:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Figure out what information it needs&lt;/li&gt;
&lt;li&gt;Ask you the right questions&lt;/li&gt;
&lt;li&gt;Search for flights&lt;/li&gt;
&lt;li&gt;Actually make the booking&lt;/li&gt;
&lt;li&gt;Confirm everything with you&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The key difference? &lt;strong&gt;Regular AI talks about doing things. Agentic AI actually does them.&lt;/strong&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%2Fwsplqy3048hm4654w8xe.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%2Fwsplqy3048hm4654w8xe.png" alt="www.payamdev.com" width="640" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What Makes Agentic AI Special?
&lt;/h2&gt;

&lt;p&gt;Agentic AI has three superpowers that regular AI doesn't have:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. It Can Think in Steps
&lt;/h3&gt;

&lt;p&gt;Imagine you ask it to "plan a birthday party." A regular AI would just give you suggestions. But an Agentic AI breaks it down into steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;First, I need to know the date and budget&lt;/li&gt;
&lt;li&gt;Then I'll search for venues&lt;/li&gt;
&lt;li&gt;Next, I'll look for caterers&lt;/li&gt;
&lt;li&gt;Finally, I'll send out invitations&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It creates a plan and follows it, just like a real person would.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. It Can Use Tools
&lt;/h3&gt;

&lt;p&gt;This is the game-changer. Agentic AI can connect to other software and websites to actually do things. How Agentic AI connects to other sites or tools? OfCourse, API. Agentic AI can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Send emails through Gmail&lt;/li&gt;
&lt;li&gt;Search the internet&lt;/li&gt;
&lt;li&gt;Update spreadsheets&lt;/li&gt;
&lt;li&gt;Book appointments&lt;/li&gt;
&lt;li&gt;Make purchases&lt;/li&gt;
&lt;li&gt;And much more&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Without tools, AI is trapped inside a chat box like Generative AI's.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. It Can Learn from Mistakes
&lt;/h3&gt;

&lt;p&gt;When an Agentic AI tries something and it doesn't work, it notices. It thinks: "That didn't work. What went wrong? How can I do better next time?" Then it tries a different approach.&lt;/p&gt;

&lt;p&gt;This is like when you learn to cook. The first time you burn the toast, you remember to watch it more carefully next time.&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%2F2wgh2p4zmgipjk4v7swf.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.amazonaws.com%2Fuploads%2Farticles%2F2wgh2p4zmgipjk4v7swf.jpg" alt="www.payamdev.com" width="800" height="418"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Build Your Own Simple AI Agent
&lt;/h2&gt;

&lt;p&gt;Now for the exciting part of this blog post, I'll show you exactly how to create a simple AI agent that can actually do something useful. We'll build a &lt;strong&gt;Weather Assistant&lt;/strong&gt; that not only tells you the weather but can also send you a text message if it's going to rain.&lt;/p&gt;

&lt;h3&gt;
  
  
  What You'll Need
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;A computer&lt;/strong&gt; (Windows, Mac, or Linux)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Claude or ChatGPT account&lt;/strong&gt; (the free version works)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;About 30 minutes&lt;/strong&gt; of your time&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Don't worry, It's not complicated at all, as i said, only 30 minutes it takes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Choose What Your AI Agent Will Do
&lt;/h3&gt;

&lt;p&gt;First, decide on a simple task. For this guide, i'll create an AI agent that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Checks the weather for your city&lt;/li&gt;
&lt;li&gt;Tells you if you need an umbrella&lt;/li&gt;
&lt;li&gt;Can send you a reminder if rain is coming&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is simple but useful, and you'll understand all the concepts.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Set Up Your AI Agent (Using Claude)
&lt;/h3&gt;

&lt;p&gt;Open Claude (at claude.ai) and give it these instructions. Copy and paste this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You are a Weather Assistant AI agent. Your job is to help people prepare for the weather.

You have access to these tools:
1. check_weather(city) - Gets current weather for a city
2. send_reminder(message) - Sends a text reminder to the user

When someone asks about the weather:
- Use check_weather to get current conditions
- Tell them the temperature and conditions
- If it's going to rain, ask if they want a reminder
- If they say yes, use send_reminder to send them a message

Always be helpful and proactive. If you see rain in the forecast, suggest they bring an umbrella.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is called a "system prompt." It tells the AI what its job is and what tools it can use.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Create the Tools (The Easy Way)
&lt;/h3&gt;

&lt;p&gt;Now we need to connect real tools to your AI. Here's the beginner-friendly way:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For the Weather Tool:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to weatherapi.com and sign up for a free account&lt;/li&gt;
&lt;li&gt;You'll get an "API key" (it's like a password that lets your AI get weather data)&lt;/li&gt;
&lt;li&gt;Use a service like Make.com or Zapier (both have free plans) to connect the weather API&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;For the Reminder Tool:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use a service like Twilio (free tier available) or IFTTT&lt;/li&gt;
&lt;li&gt;Set it up to send you a text message when triggered&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If this sounds complicated, don't worry! There's an even easier way which i used a lot:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Claude with the Anthropic API&lt;/strong&gt; (it has built-in tool calling)&lt;/p&gt;

&lt;p&gt;Here's a complete example you can copy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;I want you to act as my weather agent.

When I ask about weather, follow these steps:
1. Ask me which city I want to check
2. Pretend to check the weather (in a real setup, you'd use weatherapi.com)
3. Tell me the conditions
4. If it might rain, offer to remind me

Let's start with a simulated version. I'll tell you to "check weather for London" and you'll simulate the process.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 4: Test Your Agent
&lt;/h3&gt;

&lt;p&gt;Now talk to your AI agent like it's a real assistant:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You:&lt;/strong&gt; "What's the weather like in London today?"&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AI Agent:&lt;/strong&gt; "Let me check that for you. [Uses weather tool] It's currently 15°C and cloudy in London. There's a 70% chance of rain this afternoon. Would you like me to send you a reminder to bring an umbrella?"&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You:&lt;/strong&gt; "Yes please"&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AI Agent:&lt;/strong&gt; "Done! I've set up a reminder that will text you at noon to bring your umbrella."&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5: Make It Real (Next Level)
&lt;/h3&gt;

&lt;p&gt;Once you understand how it works, you can make it actually functional:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Sign up for API access&lt;/strong&gt; to Claude or GPT-4 (costs a few dollars)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use a no-code tool&lt;/strong&gt; like Zapier or Make.com to connect:

&lt;ul&gt;
&lt;li&gt;Weather API for real weather data&lt;/li&gt;
&lt;li&gt;SMS service for real text messages&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Set up the workflow&lt;/strong&gt; so when you message the AI, it triggers the actual tools&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Many no-code platforms now have AI agent templates you can copy and customize.&lt;/p&gt;

&lt;h3&gt;
  
  
  Real Example Tools You Can Connect
&lt;/h3&gt;

&lt;p&gt;Here are services that work with AI agents (most have free tiers):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Weather:&lt;/strong&gt; OpenWeatherMap, WeatherAPI&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Email:&lt;/strong&gt; Gmail API, SendGrid&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Calendar:&lt;/strong&gt; Google Calendar, Outlook&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Messages:&lt;/strong&gt; Twilio, Telegram Bot API&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reminders:&lt;/strong&gt; Todoist, IFTTT&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Smart Home:&lt;/strong&gt; Philips Hue, IFTTT&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What Else Can You Build?
&lt;/h2&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%2Fpu3m0lun45cpwyb19cag.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%2Fpu3m0lun45cpwyb19cag.png" alt="www.payamdev.com" width="768" height="512"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you understand the basics, you can create agents for almost anything:&lt;/p&gt;

&lt;h3&gt;
  
  
  Personal Assistant Agent
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Checks your calendar&lt;/li&gt;
&lt;li&gt;Reads your emails&lt;/li&gt;
&lt;li&gt;Schedules meetings&lt;/li&gt;
&lt;li&gt;Sets reminders&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Shopping Agent
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Monitors prices on websites&lt;/li&gt;
&lt;li&gt;Notifies you of deals&lt;/li&gt;
&lt;li&gt;Can add items to your cart&lt;/li&gt;
&lt;li&gt;Tracks deliveries&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Home Automation Agent
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Controls smart lights&lt;/li&gt;
&lt;li&gt;Adjusts thermostat&lt;/li&gt;
&lt;li&gt;Locks doors&lt;/li&gt;
&lt;li&gt;Monitors security cameras&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Research Agent
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Searches multiple websites&lt;/li&gt;
&lt;li&gt;Summarizes articles&lt;/li&gt;
&lt;li&gt;Saves interesting content&lt;/li&gt;
&lt;li&gt;Creates reports&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Alternate Solution
&lt;/h2&gt;

&lt;p&gt;Ai world is growing so fast, each day i check news and i saw new tools in every sections. Recently i work with new tool, n8n (short for “node-to-node”) which is an open-source workflow automation tool that lets you connect apps, APIs, and services together without heavy coding—similar to Zapier or Make, but self-hosted and more flexible. In other word :&lt;br&gt;
“When this happens → do that → then this other thing”&lt;/p&gt;

&lt;p&gt;In previous example that i told you, you may have pay a little but for your personal use, n8n wont charge you anything. Here is a sample of n8n workflow:&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%2F1wd91s7rdhpmk9jtzqcu.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%2F1wd91s7rdhpmk9jtzqcu.png" alt="www.payamdev.com" width="800" height="407"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Common Questions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Q: Do I need to know programming?&lt;/strong&gt;&lt;br&gt;
A: Not necessarily! Many no-code tools now let you build AI agents by connecting blocks together, like Lego. However, knowing basic programming helps you build more powerful agents. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Is it expensive?&lt;/strong&gt;&lt;br&gt;
A: You can start completely free using Claude or ChatGPT directly. Building more advanced agents with APIs costs a few dollars per month. n8n is also open-source.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Is it safe?&lt;/strong&gt;&lt;br&gt;
A: Start with simple, harmless tasks. Don't give your AI agent access to sensitive accounts (like your bank) until you really understand how it works. I am still using it under testing condition because i think we have to check it completely, maybe there were any security issues, but as i follow that, there is not any major problems till now.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: How long does it take to build one?&lt;/strong&gt;&lt;br&gt;
A: A simple agent like the weather assistant? About 30 minutes. A more complex personal assistant? Maybe a few hours to a day.&lt;/p&gt;

&lt;h2&gt;
  
  
  Your Next Steps
&lt;/h2&gt;

&lt;p&gt;Ready to build your first AI agent? Here's what to do:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Start simple&lt;/strong&gt; - Try the weather assistant example above&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Experiment&lt;/strong&gt; - Ask the AI to do different things and see how it responds&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add one tool&lt;/strong&gt; - Connect a real API (weather is the easiest)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Share your results&lt;/strong&gt; - Show friends and family what you built&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Level up&lt;/strong&gt; - Once comfortable, try connecting two or three tools together&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;Agentic AI is transforming how we interact with technology. Instead of being tools we use, AI agents are becoming digital helpers that work for us.&lt;/p&gt;

&lt;p&gt;The best part? The technology is here now, and it's getting easier to use every day. You don't need a computer science degree to build useful AI agents. You just need curiosity to experiment.&lt;/p&gt;

&lt;p&gt;Start small, learn by doing, and soon you'll have your own AI agent handling tasks for you while you focus on what matters most.&lt;/p&gt;

&lt;p&gt;There is always a concern when people see these kind of improvements and technologies. Maybe you think Agentic Ai's are starting of replacing humans with computers and robots but i am not agree with this at all. In these kind of situations, i always think about Internet Taxi Systems like Uber. Years ago there is not any things like them and people raise their hands for Taxi drivers and they saw them and pick them up and takes them to their destinations. does that kind of Taxi cars and drivers are now jobless? Of course not, they improved themselves and now using Uber or other stuffs like that. What if a taxi driver stand in front of these change for example because they cant work with smartphones to install required apps? yes, they became jobless. So i think AI and it's relevant technologies like Agentic AI's will not make us jobless, we have to use that to make our life more easier.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;So Your first agent is just one conversation away. What Agent you want to make for yourself?&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>tutorial</category>
      <category>machinelearning</category>
      <category>computerscience</category>
    </item>
    <item>
      <title>Want To Be a Hacker? Getting Started with Ethical Hacking (TryHackMe Journey)</title>
      <dc:creator>Payam Hoseini</dc:creator>
      <pubDate>Sat, 27 Dec 2025 16:37:37 +0000</pubDate>
      <link>https://forem.com/payamhn/want-to-be-a-hacker-getting-started-with-ethical-hacking-tryhackme-journey-5eg9</link>
      <guid>https://forem.com/payamhn/want-to-be-a-hacker-getting-started-with-ethical-hacking-tryhackme-journey-5eg9</guid>
      <description>&lt;p&gt;Are you looking for an intro to world of CyberSecurity?&lt;br&gt;
You want to become an ethical hacker? I get it.Like me, years ago.&lt;br&gt;
The cybersecurity world looks intimidating from the outside, all those technical terms, endless tools, and complicated concepts. But here's the truth: &lt;strong&gt;you can start learning today, right now, without any prior experience&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Let me show you how TryHackMe makes this possible.&lt;/p&gt;
&lt;h2&gt;
  
  
  Why TryHackMe? Learn by Actually Doing It
&lt;/h2&gt;

&lt;p&gt;There is a painful fact in this field, Most beginners fail because they &lt;strong&gt;read too much and practice too little&lt;/strong&gt;.&lt;br&gt;
Forget boring textbooks and endless theory. TryHackMe teaches you by letting you hack into real systems (legally, of course) in a safe environment. Think of it like a flight simulator for hackers, you get real experience without any real-world consequences.&lt;/p&gt;

&lt;p&gt;The best part? You learn the exact same techniques that real hackers use. When you hear about big companies getting hacked on the news, TryHackMe often has challenges that let you recreate those exact attacks. That's powerful learning. Think of it like A hacking gym for beginners.No damage. No risk. Just learning.&lt;/p&gt;
&lt;h2&gt;
  
  
  What Are CTF Challenges?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;CTF stands for "Capture the Flag."&lt;/strong&gt; It's basically a hacking puzzle where you break into a system and find hidden "flags" (special text strings) to prove you completed the challenge, like Paintball game if you played ;)&lt;/p&gt;

&lt;p&gt;Don't worry, you don't need to be an expert to start. CTFs are designed to teach you as you go. Here's what you'll learn:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Network Scanning&lt;/strong&gt;: Finding what services are running on a target system&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Web Hacking&lt;/strong&gt;: Breaking into websites and web applications
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Linux Skills&lt;/strong&gt;: Mastering the command line (super important for hackers)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Problem-Solving&lt;/strong&gt;: Thinking like an attacker to find weaknesses&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Your Learning Path: Start Here
&lt;/h2&gt;
&lt;h3&gt;
  
  
  1. Create Your Free Account
&lt;/h3&gt;

&lt;p&gt;TryHackMe has tons of free content. Seriously, over 500 free rooms (that's what they call challenges) that you can complete without paying anything.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Recommended paths for beginners:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pre-Security Path&lt;/strong&gt;: Start here if you're completely new&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Penetration Tester Path&lt;/strong&gt;: For learning offensive security&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SOC Level 1 Path&lt;/strong&gt;: If you want to work as a security analyst&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  2. Understanding the Interface
&lt;/h3&gt;

&lt;p&gt;When you open a TryHackMe room, you'll see:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Questions to answer&lt;/li&gt;
&lt;li&gt;A virtual machine you can deploy&lt;/li&gt;
&lt;li&gt;Instructions and hints&lt;/li&gt;
&lt;li&gt;A terminal right in your browser&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%2Feobwh0y5772dz3c83f9f.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%2Feobwh0y5772dz3c83f9f.png" alt="Payamdev - TryHackMe Rooms" width="800" height="472"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  3. Connect to the VPN
&lt;/h3&gt;

&lt;p&gt;To hack the machines, you need to connect to TryHackMe's network using OpenVPN.&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%2Fbhf4yfutoicv8987sq4e.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%2Fbhf4yfutoicv8987sq4e.png" alt="Payamdev - OpenVPN Connected Tryhackme" width="800" height="564"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;TryHackMe recently focus on their new feature which is AttackBox which runs a complete OS in a Pip view in browser to make it easier for you and get rid of connectiong via OpenVPN. you can also use that feature.&lt;/p&gt;
&lt;h2&gt;
  
  
  Let's Hack Something: Your First Challenge
&lt;/h2&gt;

&lt;p&gt;Let me walk you through a beginner-friendly CTF called &lt;strong&gt;"Bounty Hacker"&lt;/strong&gt; so you can see exactly what this looks like.&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 1: Deploy the Machine and Scan It
&lt;/h3&gt;

&lt;p&gt;First, you click "Start Machine" on TryHackMe. It gives you an IP address, let's say &lt;code&gt;10.81.174.194&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Now you scan it with Nmap to see what ports are open:&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%2F8wrfpvvc3xsx9q1auma8.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%2F8wrfpvvc3xsx9q1auma8.png" alt="Payamdev - nmap" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What this does:&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;nmap&lt;/code&gt;: The scanning tool&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-sV&lt;/code&gt;: Detects what services/versions are running&lt;/li&gt;
&lt;li&gt;The IP address: Your target&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Step 2: Check Open Ports
&lt;/h3&gt;

&lt;p&gt;As you may saw, there are ports open like 22 which belongs to ssh. Your real journey starts here. Each room has it's flag, for example, in a room you will see credentials for ssh so you can connect as a user to target device and your goal (flag) is to become root, means to gain system admin password.&lt;br&gt;
You may ask how to get that valuable information? Yes it is complicated at begining but when you read room's instructions carefully and consider to the clues, you will find a way to find root password. &lt;/p&gt;

&lt;p&gt;I remember in one of that rooms, at first i have to coonect to server via ssh, after that and using nmap, i found ftp port is open. Next i found that i can connect to ftp with it's default password (A common mistake that people do in real world a lot). So i can find a Text file that has information about other users, and with the help of a password cracking tool app which name is Hydra, I can finnaly found system admin password and login as root and capture that flag.&lt;/p&gt;
&lt;h2&gt;
  
  
  Pro Tips from Someone Who's Been There
&lt;/h2&gt;
&lt;h3&gt;
  
  
  It's Okay to Get Stuck
&lt;/h3&gt;

&lt;p&gt;I'm going to be honest: &lt;strong&gt;you will get stuck. A lot.&lt;/strong&gt; That's completely normal. When you do:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Read the hints on TryHackMe&lt;/li&gt;
&lt;li&gt;Search for writeups (walkthroughs) online&lt;/li&gt;
&lt;li&gt;Ask in the TryHackMe Discord&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Important:&lt;/strong&gt; Don't just copy answers. Read the walkthrough, understand WHY that command works, try it yourself, and learn the concept. That's how you grow.&lt;/p&gt;

&lt;p&gt;When i stuck anywhere in all of my IT learning process, always i leave my sit and go somewhere else, like another room, then get relaxed and think again from start to that problem. I got the answer every time i use this simple trick, believe me ;)&lt;/p&gt;
&lt;h3&gt;
  
  
  Keep Track of Your Progress
&lt;/h3&gt;

&lt;p&gt;TryHackMe has a cool leveling system. You start as a "Neophyte" and work your way up to "Titan" and beyond. It's gamified to keep you motivated.&lt;/p&gt;
&lt;h3&gt;
  
  
  Take Notes
&lt;/h3&gt;

&lt;p&gt;Start a hacking journal. When you learn a new technique, write it down:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;## Nmap Scanning&lt;/span&gt;

Basic scan: nmap -sV [target-ip]
Full scan: nmap -sC -sV -p- [target-ip]
UDP scan: nmap -sU [target-ip]

When to use: Always scan first to see what services are running
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  From Hobby to Career: SOC Analyst
&lt;/h2&gt;

&lt;p&gt;If you want to turn this into a career, the &lt;strong&gt;SOC Level 1 path&lt;/strong&gt; is your golden ticket. A SOC (Security Operations Center) Analyst is basically a digital security guard who:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Monitors network traffic for threats&lt;/li&gt;
&lt;li&gt;Investigates security alerts&lt;/li&gt;
&lt;li&gt;Responds to incidents&lt;/li&gt;
&lt;li&gt;Creates reports&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The job market is HOT right now.&lt;/strong&gt; Companies are desperate for SOC Analysts because there aren't enough skilled people. After completing the SOC Level 1 path, you'll know How to analyze network traffic, SIEM tools (security monitoring platforms), Digital forensics and Phishing analysis.&lt;/p&gt;

&lt;p&gt;Believe me if you do some stuff like this and prove to any employer that you have this kind of skills, you will be their top candidate.&lt;/p&gt;

&lt;h2&gt;
  
  
  What You Need to Get Started
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Hardware:&lt;/strong&gt;&lt;br&gt;
A computer (doesn't need to be fancy), Internet connection and That's it!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Software:&lt;/strong&gt;&lt;br&gt;
TryHackMe account (free), OpenVPN (free), Optional: Kali Linux VM for practicing (free)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Money:&lt;/strong&gt;&lt;br&gt;
Start with free content, Premium is $13/month if you want access to everything. I dont buy Premium subscription in first 3 months of using.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Look, cybersecurity seems scary and complicated from the outside. But here's what I've learned: &lt;strong&gt;the best way to learn is to just start&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;You don't need a computer science degree. You don't need to know everything about networking. You just need curiosity and persistence. I know peoples that even don't know what DNS or NAT is or what is diffrences between TCP or UDP but they started to DO and make experiences and in their experimenting, they learned all of that scary words in a very good way. Do not stuck in tutorial hell and do projects, even silly ones.&lt;/p&gt;

&lt;p&gt;Create that free account. Open your terminal. Run that first Nmap scan. See what happens.&lt;/p&gt;

&lt;p&gt;The cybersecurity community needs more people. We need fresh perspectives, different backgrounds, and new ways of thinking. That could be you.&lt;/p&gt;

&lt;p&gt;Your hacking journey starts with a single command. Make today that day.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Ready to start?&lt;/strong&gt; Head over to &lt;a href="https://tryhackme.com" rel="noopener noreferrer"&gt;TryHackMe&lt;/a&gt; and create your free account. See you in the challenges!&lt;/p&gt;

</description>
      <category>hack</category>
      <category>security</category>
      <category>tutorial</category>
      <category>ceh</category>
    </item>
    <item>
      <title>Machine Learning for Everyone: A Book Review</title>
      <dc:creator>Payam Hoseini</dc:creator>
      <pubDate>Wed, 24 Dec 2025 11:51:49 +0000</pubDate>
      <link>https://forem.com/payamhn/machine-learning-for-everyone-a-book-review-40f6</link>
      <guid>https://forem.com/payamhn/machine-learning-for-everyone-a-book-review-40f6</guid>
      <description>&lt;p&gt;I attracted to this book when i read book preface first line which is: &lt;br&gt;
&lt;em&gt;Let’s start by telling the truth: machines don’t learn.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This book has been praised by top level managers of Amazon and LinkedIn so if you've been searching for a way to dive into the world of Machine Learning (ML) without getting lost in massive, complicated textbooks, I might have found your solution: &lt;strong&gt;The Hundred-Page Machine Learning Book&lt;/strong&gt; by Andriy Burkov.&lt;/p&gt;

&lt;p&gt;It's literally what it says, a simple guide, at around 100 pages (maybe a few more ;) ).I think fastest way to know what Machine Learning and maybe AI is. Experts rave about it, calling it a "great introduction" and praising how it cuts through the noise right from the start. If you're an engineer looking to put ML into your daily work without spending tons of time, this is for you. You definitely don't need a heavy background in high-level math or complex programming to understand it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's Inside This Little Book?
&lt;/h2&gt;

&lt;p&gt;This book is a compact handbook on "how to do data science". It moves fast, covering everything from the basics to the really fancy stuff.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Essential Basics
&lt;/h3&gt;

&lt;p&gt;The book starts by breaking down what Machine Learning actually is. You learn about the main kinds of learning, like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Supervised Learning:&lt;/strong&gt; Where your data has labels, like training an email filter to tell the difference between "spam" and "not_spam". The goal is to build a model that predicts the label for new data.&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%2Fn2r2mj8rbsa1qu4rvut3.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%2Fn2r2mj8rbsa1qu4rvut3.png" alt="Payamdev - SVM Model" width="800" height="639"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Unsupervised Learning:&lt;/strong&gt; Where your data doesn't have labels, and you try to find patterns, like grouping similar customers together (clustering).&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Semi-Supervised Learning:&lt;/strong&gt; Where you have a lot of unlabeled data and only a little bit of labeled data, hoping the extra unlabeled examples help you build a better model.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Core Algorithms
&lt;/h3&gt;

&lt;p&gt;You get to meet five fundamental algorithms used constantly in practice:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Linear Regression:&lt;/strong&gt; Used for making predictions where the answer is a real number, like estimating a house price.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Logistic Regression:&lt;/strong&gt; Don't let the name fool you—it's actually a classification algorithm, great for problems like deciding if something is "yes" or "no".&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Support Vector Machine (SVM):&lt;/strong&gt; This clever algorithm finds the best imaginary line (or plane) to separate different categories of examples with the largest possible space between them.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Decision Trees:&lt;/strong&gt; This uses a tree structure to make decisions based on specific features.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;k-Nearest Neighbors (kNN):&lt;/strong&gt; This simple method keeps all training data and predicts a new example's label by looking at the majority vote of the examples closest to it.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Making It Work in Real Life
&lt;/h3&gt;

&lt;p&gt;The book spends crucial time explaining the common pitfalls and how to actually apply these tools. You learn about &lt;strong&gt;Feature Engineering&lt;/strong&gt;, which is the art of turning raw data (like customer activity logs) into useful numerical values (features) that the machine can use. &lt;/p&gt;

&lt;p&gt;It tackles the problem of building a model that predicts your training data perfectly but fails miserably on new data—a problem called &lt;strong&gt;Overfitting&lt;/strong&gt;. To stop overfitting, the book talks about techniques like &lt;strong&gt;Regularization&lt;/strong&gt;, which makes the model simpler so it can generalize better.&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%2F3bu6vqq68t4owrdcn60x.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%2F3bu6vqq68t4owrdcn60x.png" alt="Payamdev Blog" width="800" height="232"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There is also exaples of how mailing service find spam e-mails from other e-mails which i understood it well. And of course, since models aren't magic, it shows you how to test if your model is actually good using metrics like the &lt;strong&gt;Confusion Matrix&lt;/strong&gt;, &lt;strong&gt;Accuracy&lt;/strong&gt;, and &lt;strong&gt;Precision/Recall&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Next Level
&lt;/h3&gt;

&lt;p&gt;If you’re interested in the modern parts on ML, the book covers them too:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Neural Networks and Deep Learning:&lt;/strong&gt; It explains the basic building blocks of neural networks (which are really just nested mathematical functions). Deep learning just means training networks with more than two hidden layers.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Advanced Structures:&lt;/strong&gt; You’ll learn about Convolutional Neural Networks (CNNs), great for handling images, and Recurrent Neural Networks (RNNs) like Midjourney, used for working with sequences like text or speech.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Ensemble Learning:&lt;/strong&gt; Ways to combine many simple, "weak" models (like shallow decision trees) into a "strong" meta-model, such as &lt;strong&gt;Random Forest&lt;/strong&gt; and &lt;strong&gt;Gradient Boosting&lt;/strong&gt;, which often achieve fantastic accuracy and honestly i cant undesrstand them till now ;)&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%2Fck2y9fnthkk58boa3j9z.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%2Fck2y9fnthkk58boa3j9z.png" alt="Payam Blog-Dimensionality" width="800" height="271"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Word
&lt;/h2&gt;

&lt;p&gt;This book is distributed on a unique principle: &lt;strong&gt;Learn Machine Learning in a simple way&lt;/strong&gt;. If you read it and found it helpful, you can deep dive to it if you want but for many regular persons who dont want to be a machine learning specialist, i think its more than enough. I think in our modern world this book is a Have To Read book.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>machinelearning</category>
      <category>resources</category>
    </item>
    <item>
      <title>Complete Guide to Run AI Models Locally, Even on Mid-Tier Laptop</title>
      <dc:creator>Payam Hoseini</dc:creator>
      <pubDate>Sat, 20 Dec 2025 12:35:54 +0000</pubDate>
      <link>https://forem.com/payamhn/complete-guide-to-run-ai-models-locally-even-on-mid-tier-laptop-212p</link>
      <guid>https://forem.com/payamhn/complete-guide-to-run-ai-models-locally-even-on-mid-tier-laptop-212p</guid>
      <description>&lt;p&gt;If you focus on companies that invest in AI a lot like Meta and OpenAI or Apple you will see every one of them point to solve a problem. I found Apple solution interesting more than other which is Running AI locally on your device. Why it matters? i want you to read this blog post of mine so you can run an AI model on your PC or Laptop even if it's not a high-end device.&lt;br&gt;
If you are not a Geek, you may not know this that this problem was unthinkable just a few years ago and only powerful computers can do that but nowadays with the help of OpenSource communities, it's not a dream anymore.&lt;/p&gt;

&lt;p&gt;In this guide, we’ll explore &lt;strong&gt;why running AI locally matters&lt;/strong&gt;, what &lt;strong&gt;hardware and software&lt;/strong&gt; you actually need in 2025, and walk through a &lt;strong&gt;simple, practical setup&lt;/strong&gt; to get your first local model running today.&lt;br&gt;
If you like it, please support me by reading my blog posts.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Why Run AI on Your Own Computer?
&lt;/h2&gt;

&lt;p&gt;Running AI models locally offers too many benefits that may be a concern for you, let's get into that.&lt;/p&gt;

&lt;h3&gt;
  
  
  🔐 Full Privacy and Control
&lt;/h3&gt;

&lt;p&gt;There is a famous meme on net: There is no Cloud, There is some one else computer&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%2Fs6il5fpr2cblzj9kl552.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%2Fs6il5fpr2cblzj9kl552.png" alt="Cloud is not safe" width="666" height="666"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Why someone else see our chats, photos and everything else? &lt;/p&gt;

&lt;h3&gt;
  
  
  ⚡ Instant Speed and Offline Access
&lt;/h3&gt;

&lt;p&gt;Imagine your internet has much latency or weak upload speed to uploading your files and photos. What do you think about removing these kind of limitations?&lt;/p&gt;

&lt;p&gt;An added bonus: local models work &lt;strong&gt;fully offline&lt;/strong&gt;. No internet connection, no service outages, no rate limits.&lt;/p&gt;

&lt;h3&gt;
  
  
  💰 Long-Term Cost Savings
&lt;/h3&gt;

&lt;p&gt;While there may be an upfront hardware investment, running models locally eliminates recurring API fees. You can perform unlimited inferences with no per-token or per-request cost, shifting expenses from ongoing operational fees to a predictable, one-time setup.For myself, No more Remaining token checking :))&lt;/p&gt;




&lt;h2&gt;
  
  
  2. What You’ll Need: Hardware
&lt;/h2&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%2Fo7xs2p7v657su84t4wvg.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%2Fo7xs2p7v657su84t4wvg.png" alt="CPU-GPU-Ram" width="768" height="512"&gt;&lt;/a&gt;&lt;br&gt;
Years ago, AI scientist thinks that CPU is the main power we need for machine learning and AI but after testing and comparing, they found that &lt;br&gt;
&lt;strong&gt;GPU (Graphics Processing Unit)&lt;/strong&gt; is better and more efficient than CPU. GPUs excel at parallel processing, allowing them to handle thousands of operations simultaneously—something CPUs are not designed to do efficiently.&lt;/p&gt;

&lt;h3&gt;
  
  
  The VRAM Imperative
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Video RAM (VRAM)&lt;/strong&gt; is the single most important factor for running AI models locally.&lt;/p&gt;

&lt;p&gt;Think of VRAM as the model’s workspace: if the model doesn’t fit, performance drops—or it won’t run at all. The amount of VRAM directly determines:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How large a model you can load&lt;/li&gt;
&lt;li&gt;How fast inference will be&lt;/li&gt;
&lt;li&gt;How stable long-running sessions are&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For a smooth experience with modern models, &lt;strong&gt;8–12 GB of VRAM&lt;/strong&gt; is the practical minimum in 2025.&lt;/p&gt;

&lt;h3&gt;
  
  
  Quantization, What Is That?
&lt;/h3&gt;

&lt;p&gt;Let's learn one of most important words in the AI world. Quantization is a clever technique that shrinks AI models so they can fit into smaller VRAM budgets.&lt;/p&gt;

&lt;p&gt;Imagine a professional photographer’s massive, high-resolution &lt;strong&gt;RAW&lt;/strong&gt; photo. It’s incredibly detailed—but too large to quickly share or view on a phone. By compressing it into a &lt;strong&gt;JPEG&lt;/strong&gt;, the file becomes much smaller and faster to load. While a tiny amount of detail is lost, the image remains visually excellent and far more practical.&lt;/p&gt;

&lt;p&gt;Quantization works the same way for AI models. It compresses them dramatically, making them usable on consumer hardware with minimal—and often imperceptible—quality loss.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Pro Tip:&lt;/strong&gt; When browsing models on platforms like Hugging Face, look for files labeled &lt;strong&gt;GGUF&lt;/strong&gt;. These are pre-quantized models designed to run efficiently with tools like LM Studio and Ollama.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  When You Need CPU and RAM
&lt;/h3&gt;

&lt;p&gt;If a model is too large to fit into VRAM—even after quantization—the system falls back to using system &lt;strong&gt;RAM&lt;/strong&gt; and the &lt;strong&gt;CPU&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In these scenarios, raw GPU speed matters less than &lt;strong&gt;memory bandwidth and stability&lt;/strong&gt;. Surprisingly, server-grade CPUs can outperform GPU-heavy setups for certain workflows.&lt;/p&gt;

&lt;h3&gt;
  
  
  A Note on Apple Silicon
&lt;/h3&gt;

&lt;p&gt;Apple’s M-series chips use a &lt;strong&gt;unified memory architecture&lt;/strong&gt;, allowing the CPU and GPU to share a single, high-bandwidth memory pool. This design effectively sidesteps traditional VRAM limits, making Apple Silicon machines surprisingly capable of running very large models—often beyond what similarly priced discrete GPUs can handle.&lt;/p&gt;

&lt;h3&gt;
  
  
  Hardware Recommendations at a Glance
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;B Means Billion&lt;/em&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model Size&lt;/th&gt;
&lt;th&gt;Recommended Hardware&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Smaller models (e.g. Llama 3 8B, Phi-3 Mini)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;NVIDIA GPU with &lt;strong&gt;8–12 GB VRAM&lt;/strong&gt; and &lt;strong&gt;16 GB system RAM&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Larger models (70B+ parameters)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;High-end GPU (&lt;strong&gt;24 GB+ VRAM&lt;/strong&gt;), Apple Silicon Mac with &lt;strong&gt;64 GB+ unified memory&lt;/strong&gt;, or server-grade CPU with high-bandwidth RAM&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  3. The Toolkit: Essential Software and Apps
&lt;/h2&gt;

&lt;p&gt;To bring local AI to life, you need two things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A &lt;strong&gt;runner&lt;/strong&gt; to load and interact with models&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Acceleration software&lt;/strong&gt; to make inference fast&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  3.1 Choosing Your “Runner”
&lt;/h3&gt;

&lt;p&gt;Think of an AI model as a powerful engine. A runner is the car built around it—it lets you start the engine, steer it with prompts, and see the results.&lt;/p&gt;

&lt;p&gt;While your choice may depend on hardware and experience level, these three tools dominate the local AI ecosystem in 2025.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;th&gt;Best For&lt;/th&gt;
&lt;th&gt;Key Characteristics&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;LM Studio&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Beginners &amp;amp; non-technical users&lt;/td&gt;
&lt;td&gt;Polished GUI, built on &lt;code&gt;llama.cpp&lt;/code&gt;, browse and download models inside the app, true “open and chat” experience&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Ollama&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Developers &amp;amp; tinkerers&lt;/td&gt;
&lt;td&gt;Simple CLI, local API, easy automation, excellent performance—especially on Apple Silicon&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;llama.cpp&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Power users&lt;/td&gt;
&lt;td&gt;Upstream engine, fastest updates, maximum control and performance, requires compilation and CLI usage&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  3.2 Behind the Scenes: Acceleration Software
&lt;/h3&gt;

&lt;p&gt;Your runner talks to the GPU through specialized acceleration frameworks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;NVIDIA GPUs:&lt;/strong&gt; CUDA (the industry standard for AI acceleration)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Apple Silicon:&lt;/strong&gt; Metal (deeply integrated into macOS)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You typically don’t need to install these manually—up-to-date graphics drivers handle everything.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Your First Local AI: Step-by-Step (with LM Studio)
&lt;/h2&gt;

&lt;p&gt;In this section, we’ll use &lt;strong&gt;LM Studio&lt;/strong&gt;, one of the easiest and most user-friendly tools for running AI models locally.&lt;br&gt;&lt;br&gt;
The best part? &lt;strong&gt;You don’t need a GPU&lt;/strong&gt;. LM Studio works perfectly with &lt;strong&gt;CPU-only systems&lt;/strong&gt;, and will automatically use your GPU &lt;em&gt;if you have one&lt;/em&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Download and Install LM Studio
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Visit the official &lt;strong&gt;LM Studio&lt;/strong&gt; website&lt;/li&gt;
&lt;li&gt;Download the installer for &lt;strong&gt;Windows, macOS, or Linux&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Install and launch the app — no command line required&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;LM Studio comes bundled with everything you need. No CUDA, no environment variables.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Choose a Model
&lt;/h3&gt;

&lt;p&gt;Once LM Studio is open:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to the &lt;strong&gt;Models&lt;/strong&gt; tab&lt;/li&gt;
&lt;li&gt;Browse or search for a model (for example:
&lt;em&gt;Phi-3 Mini&lt;/em&gt;, &lt;em&gt;Llama 3 8B&lt;/em&gt;, or &lt;em&gt;Mistral 7B&lt;/em&gt;)&lt;/li&gt;
&lt;li&gt;Choose a &lt;strong&gt;GGUF&lt;/strong&gt; version (these are optimized and quantized)&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Download&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 Tip: If your system has no GPU, start with smaller models (3B–8B). They run surprisingly well on modern CPUs.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can also download your desired model from Huggingface site where is the Github of AI models.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Run the Model (CPU or GPU)
&lt;/h3&gt;

&lt;p&gt;After the download:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open the &lt;strong&gt;Chat&lt;/strong&gt; tab&lt;/li&gt;
&lt;li&gt;Select your model&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Load Model&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;LM Studio automatically detects your hardware:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you have a compatible GPU, it will use it&lt;/li&gt;
&lt;li&gt;If not, it runs &lt;strong&gt;entirely on CPU&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;No extra configuration needed.&lt;/p&gt;

&lt;p&gt;You can now start chatting with your local AI — fully offline.&lt;/p&gt;

&lt;h3&gt;
  
  
  Performance Expectations (Be Realistic)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;CPU-only&lt;/strong&gt;: Slower responses, but totally usable for learning, writing, and experimentation&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GPU available&lt;/strong&gt;: Faster responses and smoother interaction&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Apple Silicon&lt;/strong&gt;: Excellent performance thanks to unified memory&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The key takeaway: &lt;strong&gt;GPU is a performance upgrade, not a requirement&lt;/strong&gt;. In my opinion, run a model with CPU is only for experimenting and learning. I Ran a small model with a 10th generation of Intel CPU and it takes a minute to write a paragragh with around 100 words.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Conclusion: Local AI Is for Everyone Now
&lt;/h2&gt;

&lt;p&gt;Running AI locally is no longer an elite or expensive experiment.&lt;/p&gt;

&lt;p&gt;Today, you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run models &lt;strong&gt;without internet&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Keep your data &lt;strong&gt;fully private&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Avoid API limits and monthly fees&lt;/li&gt;
&lt;li&gt;Start even with &lt;strong&gt;just a CPU&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Tools like &lt;strong&gt;LM Studio&lt;/strong&gt; have removed almost all friction. You don’t need to be a machine learning engineer, a Linux wizard, or own a high-end GPU.&lt;/p&gt;

&lt;p&gt;If you have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A laptop&lt;/li&gt;
&lt;li&gt;Some free disk space&lt;/li&gt;
&lt;li&gt;Curiosity&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You’re ready.&lt;/p&gt;

&lt;p&gt;Download a model. Run it locally.&lt;br&gt;&lt;br&gt;
And experience AI on &lt;strong&gt;your terms&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Try this process as soon as possible that you have around one hour free time, it's worth it.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I maked cover photo and hardwares photo of this blog post with the help of chatbot ;)&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>productivity</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Free Up Storage on Linux: ncdu, APT Cleanup, Log Rotation, and Kernel Removal Explained</title>
      <dc:creator>Payam Hoseini</dc:creator>
      <pubDate>Tue, 09 Dec 2025 12:34:36 +0000</pubDate>
      <link>https://forem.com/payamhn/free-up-storage-on-linux-ncdu-apt-cleanup-log-rotation-and-kernel-removal-explained-36gl</link>
      <guid>https://forem.com/payamhn/free-up-storage-on-linux-ncdu-apt-cleanup-log-rotation-and-kernel-removal-explained-36gl</guid>
      <description>&lt;p&gt;When i have Windows on my PC, from time to time, because of my system becomes laggy, i go into drives and folders to find unused files and get rid of them and do some other stuffs to make more available space and improve my PC for a while but when i migrate to Linux, as there is no lag or crashes (at least like Windows), I forgot to remove unused data from my PC anymore, But let’s be real: over time, even the best systems accumulate &lt;strong&gt;digital clutter&lt;/strong&gt;. We install software, forget about it, update our kernels, and suddenly, that smooth performance starts to feel a little sluggish, and your disk space notification pops up, demanding attention.&lt;/p&gt;

&lt;p&gt;I was reading an article in Linux Magazine issue 297 about this problem, i found it useful but i think there are some lack of information there, so i decided to write a blog post about it and cover as muchas i can about this.&lt;/p&gt;




&lt;h3&gt;
  
  
  1. Finding The Storage Leech
&lt;/h3&gt;

&lt;p&gt;Before deleting anything, you need to know &lt;em&gt;where&lt;/em&gt; the junk is hiding. Running blind with the &lt;code&gt;rm&lt;/code&gt; command is a recipe for disaster (trust me, you don't want to accidentally delete a folder a critical program needs!).&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Meet Your New Best Friend: Ncdu&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;The best tool for this job isn't some complex script; it's &lt;code&gt;ncdu&lt;/code&gt; (NCurses Disk Usage). It’s super user-friendly and gives you an &lt;strong&gt;interactive, real-time map&lt;/strong&gt; of your disk space right in your terminal. They define theirselfs like this :&lt;br&gt;&lt;br&gt;
Ncdu is a disk usage analyzer with a text-mode user interface. It is designed to find space hogs on a remote server where you don’t have an entire graphical setup available, but it is a useful tool even on regular desktop systems. Ncdu aims to be fast, simple, easy to use, and should be able to run on any POSIX-like system.&lt;/p&gt;

&lt;p&gt;To start hunting from your system's root directory (&lt;code&gt;/&lt;/code&gt;), you'll need to install it first if you don't have it:&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="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;ncdu
&lt;span class="nb"&gt;sudo &lt;/span&gt;ncdu /
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once running, you can navigate folders like you're browsing files, instantly seeing which directories (like &lt;code&gt;/var/log&lt;/code&gt; or a big &lt;code&gt;~/Downloads&lt;/code&gt; folder) are the heaviest.&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%2Fr4v8z9z1mkbcpqyheuwv.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%2Fr4v8z9z1mkbcpqyheuwv.png" alt="ncdu shows files of an Ubuntu root" width="800" height="522"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Manual Hunting for Mega Files&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;If you prefer a direct listing of massive files (over 50MB) without the interactive interface, the &lt;code&gt;find&lt;/code&gt; command is the best tool. This is particularly useful when accessing a server via SSH.&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="nb"&gt;sudo &lt;/span&gt;find / &lt;span class="nt"&gt;-size&lt;/span&gt; +50M &lt;span class="nt"&gt;-type&lt;/span&gt; f &lt;span class="nt"&gt;-exec&lt;/span&gt; &lt;span class="nb"&gt;du&lt;/span&gt; &lt;span class="nt"&gt;-h&lt;/span&gt; &lt;span class="o"&gt;{}&lt;/span&gt; &lt;span class="se"&gt;\;&lt;/span&gt; | &lt;span class="nb"&gt;sort&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. APT : For Packages and Dependencies
&lt;/h3&gt;

&lt;p&gt;The safest place to start cleaning is always with your package manager, APT, because it actually understands the structure of your system.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Removing Orphaned Dependencies&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;When you uninstall an app, sometimes its dependencies (packages it needed for installation) get left behind. These are called orphaned packages.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;autoremove&lt;/code&gt; command is brilliant because it finds these packages and safely removes them, making this command your &lt;strong&gt;first and most essential step&lt;/strong&gt; for regular maintenance,.&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="nb"&gt;sudo &lt;/span&gt;apt autoremove
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;strong&gt;Clearing Out the Downloaded Junk&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Every time you install something, APT downloads the &lt;code&gt;.deb&lt;/code&gt; file and put it away in a cache (&lt;code&gt;/var/cache/apt/archives/&lt;/code&gt;). While handy for offline installs, this cache often just sits there taking up space for ever.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;clean&lt;/code&gt;&lt;/strong&gt;: This removes &lt;strong&gt;all&lt;/strong&gt; downloaded package files. It frees up space but means you can't easily reinstall a package version offline,.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;autoclean&lt;/code&gt;&lt;/strong&gt;: This is the slightly gentler cousin; it only removes package files that are old and can no longer be downloaded, making them completely useless.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt clean
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;strong&gt;Purge (Handle with Care!)&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;If you want an application and its &lt;strong&gt;configuration files&lt;/strong&gt; completely erased (like, gone forever, including files in &lt;code&gt;/etc&lt;/code&gt;), you use &lt;code&gt;purge&lt;/code&gt;. This is more aggressive than a standard &lt;code&gt;remove&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Important Note:&lt;/strong&gt; Only use &lt;code&gt;purge&lt;/code&gt; if you are absolutely sure you never need those configurations again, especially for core system utilities. When i want to use Purge, always double check everything :)))&lt;/p&gt;

&lt;h3&gt;
  
  
  3. The Kernel :
&lt;/h3&gt;

&lt;p&gt;Every time Ubuntu updates its kernel (the core of the OS), it typically keeps the old ones around as a backup—just in case the new one causes trouble. This is smart, but if you've done several updates, these kernels pile up, consuming gigabytes of space in &lt;code&gt;/boot&lt;/code&gt;. For example, Kernel of Ubuntu 24 is around 1.5GB. Wowww&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Always&lt;/strong&gt; keep the currently running kernel plus at least one or two older, known working kernels.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Listing Your Kernels&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;First, let's see what you have installed. Look for the packages starting with &lt;code&gt;linux-image&lt;/code&gt; and &lt;code&gt;linux-headers&lt;/code&gt;,:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dpkg &lt;span class="nt"&gt;--list&lt;/span&gt; | egrep &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="nt"&gt;--color&lt;/span&gt; &lt;span class="s1"&gt;'linux-image|linux-headers'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And check which one is currently running (don't delete this one!):&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="nb"&gt;uname&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2F15pf7gsz6k5ees6gf6c3.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%2F15pf7gsz6k5ees6gf6c3.png" alt="Showing previous downloaded kernels in an Ubuntu" width="800" height="478"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;How to Remove Them&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;While &lt;code&gt;autoremove&lt;/code&gt; sometimes catches old kernels, the dedicated script &lt;strong&gt;&lt;code&gt;purge-old-kernels&lt;/code&gt;&lt;/strong&gt; is far more reliable and efficient for this specific task. You usually get this utility by installing the &lt;code&gt;byobu&lt;/code&gt; package:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Install the Tool (if needed):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;byobu
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Run the Purge:&lt;/strong&gt; (This example keeps the latest two kernels, removing all older ones)&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;purge-old-kernels &lt;span class="nt"&gt;--keep&lt;/span&gt; 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  4. Calming Down Storage Filler, The Logs
&lt;/h3&gt;

&lt;p&gt;Log files, usually tucked away in &lt;code&gt;/var/log/&lt;/code&gt;, record everything your system does. They are vital for troubleshooting, but they &lt;strong&gt;grow continuously&lt;/strong&gt; and, if unchecked, can strain your server resources and memory.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;The Automated Log Boss: Logrotate&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Luckily, Linux has a built-in superhero named &lt;strong&gt;Logrotate&lt;/strong&gt;. This utility is pre-installed on Ubuntu and runs automatically (usually daily via a cron job or systemd timer).&lt;/p&gt;

&lt;p&gt;Logrotate ensures logs are managed by either &lt;strong&gt;renaming or compressing&lt;/strong&gt; files before they get too large, and it removes or archives the oldest logs to free up space,,. For example, &lt;code&gt;logrotate&lt;/code&gt; often compresses files using &lt;code&gt;gzip&lt;/code&gt; and limits the number of historical logs kept (like keeping only four weeks' worth of backlogs).&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;The Safe Manual Fix: Truncation&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;If you find a huge log file (like &lt;code&gt;syslog&lt;/code&gt;) that's rapidly filling up because of a system bug, &lt;strong&gt;DO NOT delete it with &lt;code&gt;rm&lt;/code&gt;&lt;/strong&gt;,. If a program is actively writing to a log file, deleting it won't free up space until that program closes the file, which might not happen until reboot,.&lt;/p&gt;

&lt;p&gt;The safe trick is to &lt;strong&gt;truncate&lt;/strong&gt; (empty) the file while keeping the file itself intact:&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;# Example for the main system log&lt;/span&gt;
&lt;span class="nb"&gt;sudo truncate&lt;/span&gt; &lt;span class="nt"&gt;-s&lt;/span&gt; 0 /var/log/syslog
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;strong&gt;Systemd Journal Logs&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;For logs managed by &lt;code&gt;systemd&lt;/code&gt; (which is standard on modern Ubuntu), you can use &lt;code&gt;journalctl&lt;/code&gt; to limit their size (e.g., to a maximum of 300 megabytes),:&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="nb"&gt;sudo &lt;/span&gt;journalctl &lt;span class="nt"&gt;--vacuum-size&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;300M
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  5. Home Cleanup
&lt;/h3&gt;

&lt;p&gt;Finally, let's look in your personal space—your home directory (&lt;code&gt;~&lt;/code&gt;).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;The Cache (&lt;code&gt;~/.cache/&lt;/code&gt;):&lt;/strong&gt; Applications store temporary files and caches here, which can pile up,. It is generally &lt;strong&gt;safe to delete the *contents&lt;/strong&gt;* of this folder, though expect some apps (like web browsers) to load slightly slower the first time afterward.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; ~/.cache/&lt;span class="k"&gt;*&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;The Forgotten Folder (&lt;code&gt;~/Downloads&lt;/code&gt;):&lt;/strong&gt; This is the &lt;strong&gt;most common culprit&lt;/strong&gt; for digital hoarding,. Use the file manager or terminal to check its size and delete large, forgotten ISOs or installer packages.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;The Command Line Trash:&lt;/strong&gt; If you use the graphical desktop environment, files you delete go to the Trash Bin (&lt;code&gt;~/.local/share/Trash/&lt;/code&gt;). Make sure it's truly empty!&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; ~/.local/share/Trash/&lt;span class="k"&gt;*&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  🛠️ Terminal Command Cheat Sheet
&lt;/h3&gt;

&lt;p&gt;Here are the key commands That i used for my Ubuntu system cleanup. Remember to use &lt;code&gt;sudo&lt;/code&gt; where necessary and review any deletions before confirming! And as Michael Jackson said: Remember to always think twice.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Category&lt;/th&gt;
&lt;th&gt;Goal&lt;/th&gt;
&lt;th&gt;Command to Run&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Analysis&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Find Disk Hogs&lt;/strong&gt; (Install &amp;amp; Run Interactive Tool)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;sudo apt install ncdu&lt;/code&gt; then &lt;code&gt;sudo ncdu /&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Package Cleanup&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Remove Unused Dependencies&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;sudo apt autoremove --purge&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Package Cleanup&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Clear Downloaded Package Cache&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;sudo apt clean&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Kernel Cleanup&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Install Kernel Management Tool&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;sudo apt install byobu&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Kernel Cleanup&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Remove Old Kernels&lt;/strong&gt; (Keeps 2 latest versions)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;sudo purge-old-kernels --keep 2&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Log Management&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Limit Systemd Journal Logs&lt;/strong&gt; (e.g., 300M max)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;sudo journalctl --vacuum-size=300M&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Log Management&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Safely Empty Large Active Log File&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;sudo truncate -s 0 /var/log/syslog&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;User Cleanup&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Clear Application/Browser Caches&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;rm -rf ~/.cache/*&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;User Cleanup&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Empty the Trash Bin&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;rm -rf ~/.local/share/Trash/*&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;p&gt;I will appreciate if you see my other blog post &lt;a href="https://www.payamdev.com/blog" rel="noopener noreferrer"&gt;Here.&lt;/a&gt;&lt;/p&gt;

</description>
      <category>tooling</category>
      <category>performance</category>
      <category>linux</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>DIY GPS Tracking with Arduino, SIM800L and Ublox Neo-6M</title>
      <dc:creator>Payam Hoseini</dc:creator>
      <pubDate>Tue, 20 May 2025 14:49:26 +0000</pubDate>
      <link>https://forem.com/payamhn/diy-gps-tracking-with-arduino-sim800l-and-ublox-neo-6m-5hde</link>
      <guid>https://forem.com/payamhn/diy-gps-tracking-with-arduino-sim800l-and-ublox-neo-6m-5hde</guid>
      <description>&lt;p&gt;After learning how to use sim800l module in my &lt;a href="https://dev.to/payamhn/a-simple-guide-to-sim800l-control-your-iot-projects-from-anywhere-10km"&gt;previous project&lt;/a&gt;, I decided to create a GPS tracker using the Arduino platform. This project combines a SIM800L module for communication and a Ublox Neo-6M GPS module for location tracking with help of satellites. Making this device is also easy as previous project, just instead of using led, i use a GPS module to get the location and a little changes in the sketch. I measured the current consumption of the device under load and its around 50mAh for sim800l module and 100mAh for gps module. In standby mode, it consumes around 20mAh. With a regular battery(18650 Battery 2500mAh), this device last for around 5 days without charging. As you may now, these kind of devices used in cars or similar places that they has another source of power that help this device battery to charge(Alternators). This device needs a lot of improvement specially in security aspects, but it is a good start for you to learn how to use sim800l module, Ublox GPS module and Arduino platform. This is also a practical DIY device that you may use it in your car or bike.&lt;/p&gt;

&lt;h2&gt;
  
  
  Features
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Get GPS coordinates by sending an SMS command ("GPS") to the device&lt;/li&gt;
&lt;li&gt;Receive a reply with latitude, longitude, satellite count, altitude, speed, and a Google Maps link &lt;/li&gt;
&lt;li&gt;Works with standard Arduino boards (tested on Uno/Nano)&lt;/li&gt;
&lt;li&gt;Includes sample wiring diagrams and photos&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Ublox Neo-6M
&lt;/h2&gt;

&lt;p&gt;The Ublox Neo-6M GPS module works by connecting to multiple satellites orbiting the Earth. It listens for signals from at least four satellites, each broadcasting precise timing and location data. By calculating the time it takes for these signals to reach the module, the Neo-6M determines its own position (latitude, longitude, and altitude) with high accuracy. The more satellites it connects to, the more reliable and accurate the location data becomes. This satellite-based triangulation allows the module to provide real-time navigation and tracking information, which it then sends to your microcontroller via a serial interface. For best results, the module should have a clear view of the sky to maximize satellite connections and minimize signal interference.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;Arduino Uno, Nano, or compatible board&lt;/li&gt;
&lt;li&gt;SIM800L GSM module&lt;/li&gt;
&lt;li&gt;Ublox Neo-6M GPS module&lt;/li&gt;
&lt;li&gt;SIM card with SMS capability&lt;/li&gt;
&lt;li&gt;Jumper wires and breadboard or PCB&lt;/li&gt;
&lt;li&gt;Power supply (ensure enough current for SIM800L)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Hardware Pinout
&lt;/h2&gt;

&lt;h3&gt;
  
  
  SIM800L
&lt;/h3&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%2Fy3krw9rnu3m33yk3ccgu.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%2Fy3krw9rnu3m33yk3ccgu.png" alt="SIM800L Pinout" width="795" height="356"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Ublox Neo-6M
&lt;/h3&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%2Fvowkak5uds3d8z1lhehv.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%2Fvowkak5uds3d8z1lhehv.png" alt="Ublox Neo-6M Pinout" width="665" height="664"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Circuit Wiring
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Wiring Diagram
&lt;/h3&gt;

&lt;p&gt;This is wiring diagram which i make it in Fritzing. Please consider that i used a 18650 battery for SIM800l (as it is sensitive to power for working stable) and 5V pin of Arduino for GPS module.&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%2F7azhnbmgya1sm3yce5ho.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%2F7azhnbmgya1sm3yce5ho.png" alt="DIY GPS Tracking with Arduino, SIM800L and Ublox Neo-6M Wiring Diagram" width="800" height="494"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  My Wiring
&lt;/h3&gt;

&lt;p&gt;This is my circuit, pardon me if it's don't look nice. As this device is in experimental phase, i used usb cable to power up Arduino Uno but in production, we can use our battery with a regulator to increase it to 5 volt.&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%2F19vdrbtrcfbu53xj00cy.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.amazonaws.com%2Fuploads%2Farticles%2F19vdrbtrcfbu53xj00cy.jpg" alt="DIY GPS Tracking with Arduino, SIM800L and Ublox Neo-6M Wiring Circuit" width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Sketch
&lt;/h2&gt;

&lt;p&gt;This is the sketch that i uploaded to Arduino board. Please attention that this is a starting point for making a GPS tracking system and needs a lot of improvement but don't worry, this device do it's job fine ;)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;SoftwareSerial.h&amp;gt;
#include &amp;lt;AltSoftSerial.h&amp;gt;
#include &amp;lt;TinyGPS++.h&amp;gt;

#define SIM800_RX_PIN 2
#define SIM800_TX_PIN 3

SoftwareSerial sim800(SIM800_TX_PIN, SIM800_RX_PIN);
AltSoftSerial gpsSerial;
TinyGPSPlus gps;

String sim800Buffer = "";
float latitude = 0.0;
float longitude = 0.0;
bool gpsDataValid = false;
unsigned long lastGpsDebugTime = 0;

void setup() {
  Serial.begin(9600);
  sim800.begin(9600);
  gpsSerial.begin(9600);
  delay(2000);

  Serial.println("Initializing SIM800L and GPS...");
  sendATCommand("AT", 1000);
  sendATCommand("AT+CMGF=1", 1000); // Text mode
  sendATCommand("AT+CNMI=1,2,0,0,0", 1000); // New message indications
  Serial.println("SIM800L and GPS Ready");
}

void loop() {
  // GPS Processing
  while (gpsSerial.available()) {
    char c = gpsSerial.read();
    gps.encode(c);
    if (gps.location.isValid()) {
      latitude = gps.location.lat();
      longitude = gps.location.lng();
      gpsDataValid = true;
    }
  }

  // Periodic debug output
  if (millis() - lastGpsDebugTime &amp;gt; 5000) {
    lastGpsDebugTime = millis();
    Serial.print("GPS Satellites: ");
    Serial.println(gps.satellites.value());
    Serial.print("GPS Data Valid: ");
    Serial.println(gpsDataValid ? "Yes" : "No");
    if (gpsDataValid) {
      Serial.print("Location: ");
      Serial.print(latitude, 6);
      Serial.print(", ");
      Serial.println(longitude, 6);
    }
  }

  // Read SIM800 data into buffer
  while (sim800.available()) {
    char c = sim800.read();
    sim800Buffer += c;
  }

  // Process SMS only when both header and content are present
  if (sim800Buffer.indexOf("+CMT:") != -1 &amp;amp;&amp;amp; sim800Buffer.indexOf("\r\n", sim800Buffer.indexOf("+CMT:") + 6) != -1) {
    int headerEnd = sim800Buffer.indexOf("\r\n", sim800Buffer.indexOf("+CMT:") + 6);
    int msgStart = headerEnd + 2;
    int msgEnd = sim800Buffer.indexOf("\r\n", msgStart); // end of message text

    if (msgEnd != -1) {
      String header = sim800Buffer.substring(0, headerEnd);
      String sender = extractPhoneNumber(header);
      String msg = sim800Buffer.substring(msgStart, msgEnd);
      msg.trim();

      Serial.println("\n--- Incoming SMS ---");
      Serial.println("Sender: " + sender);
      Serial.println("Message: " + msg);

      if (msg.length() &amp;gt; 0 &amp;amp;&amp;amp; (msg.indexOf("GPS") != -1 || msg.indexOf("gps") != -1)) {
        sendGPSLocation(sender);
      } else if (msg.length() &amp;gt; 0) {
        sendSMS(sender, "Send 'GPS' to receive location.");
      }

      sim800Buffer = ""; // clear buffer after processing
    }
  }

  // Manual test from Serial
  if (Serial.available()) {
    String cmd = Serial.readStringUntil('\n');
    if (cmd.startsWith("SEND:")) {
      String num = cmd.substring(5);
      sendGPSLocation(num);
    } else {
      sim800.println(cmd);
    }
  }
}

String extractPhoneNumber(String header) {
  int firstQuote = header.indexOf('"');
  int secondQuote = header.indexOf('"', firstQuote + 1);
  if (firstQuote != -1 &amp;amp;&amp;amp; secondQuote != -1) {
    return header.substring(firstQuote + 1, secondQuote);
  }
  return "";
}

void sendGPSLocation(String number) {
  String msg;

  if (gpsDataValid) {
    msg = "Location: " + String(latitude, 6) + ", " + String(longitude, 6);
    msg += "\nSatellites: " + String(gps.satellites.value());

    if (gps.altitude.isValid()) {
      msg += "\nAltitude: " + String(gps.altitude.meters(), 1) + " m";
    }

    if (gps.speed.isValid()) {
      msg += "\nSpeed: " + String(gps.speed.kmph(), 1) + " km/h";
    }

    if (gps.date.isValid() &amp;amp;&amp;amp; gps.time.isValid()) {
      char dateTimeBuffer[30];
      sprintf(dateTimeBuffer, "\nTime: %02d:%02d, %02d-%02d-%04d",
              gps.time.hour(), gps.time.minute(),
              gps.date.day(), gps.date.month(), gps.date.year());
      msg += dateTimeBuffer;
    }

    msg += "\nhttps://maps.google.com/?q=" + String(latitude, 6) + "," + String(longitude, 6);
  } else {
    msg = "GPS not ready. Try again later.";
  }

  sendSMS(number, msg);
}


void sendSMS(String number, String message) {
  gpsSerial.end();
  delay(500);

  sim800.println("AT+CMGF=1");
  delay(1000);
  sim800.print("AT+CMGS=\"");
  sim800.print(number);
  sim800.println("\"");
  delay(1000);
  sim800.print(message);
  delay(500);
  sim800.write(26); // CTRL+Z
  delay(5000);

  Serial.println("SMS sent!");
  gpsSerial.begin(9600);
}

void sendATCommand(String cmd, int delayMs) {
  sim800.println(cmd);
  delay(delayMs);
  while (sim800.available()) {
    Serial.write(sim800.read());
  }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  How this device Works
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Power up the device with all modules connected as per the wiring diagram.&lt;/li&gt;
&lt;li&gt;Send an SMS with the text &lt;code&gt;GPS&lt;/code&gt; to the SIM card number in the SIM800L.&lt;/li&gt;
&lt;li&gt;The device replies with the current GPS location and a Google Maps link.&lt;/li&gt;
&lt;li&gt;You can also monitor serial output for debugging.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Current Usage
&lt;/h2&gt;

&lt;h3&gt;
  
  
  SIM800L
&lt;/h3&gt;

&lt;p&gt;This is current usage of SIM800L while it's Ready for SMS :&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%2Fn49bsrhkj1ihvz2ou9cu.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.amazonaws.com%2Fuploads%2Farticles%2Fn49bsrhkj1ihvz2ou9cu.jpg" alt="SIM800L Current Usage" width="800" height="600"&gt;&lt;/a&gt;&lt;br&gt;
While receiving SMS, maybe for a second, it goes up to around 120mAh and comes back to 50mAh.&lt;/p&gt;

&lt;h3&gt;
  
  
  Ublox Neo-6M and Arduino UNO
&lt;/h3&gt;

&lt;p&gt;This is current usage for both Arduino UNO and Ublox Neo-6M while they are working :&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%2Fhbuzcdmfb84eeak4y97h.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.amazonaws.com%2Fuploads%2Farticles%2Fhbuzcdmfb84eeak4y97h.jpg" alt="Arduino UNO and Ublox Neo-6M Current Usage" width="800" height="1066"&gt;&lt;/a&gt;&lt;br&gt;
As you see, it's around 0.11A which is 110mAh.&lt;br&gt;
Consider that these numbers are for these modules when they are completely ON and Ready. All of these modules has standby mode which decrease their usage a lot.&lt;/p&gt;

&lt;h2&gt;
  
  
  Output Samples
&lt;/h2&gt;

&lt;p&gt;First i connected this device to my laptop and check serial in Arduino IDE and this is device output :&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%2Fx2gqnjmppkyqqx84bfwd.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%2Fx2gqnjmppkyqqx84bfwd.png" alt="GPS Tracker Serial Output" width="619" height="813"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After that i connected Arduino to a power bank and send a SMS to check it's functionality. I also send a wrong format of SMS to check device response.&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%2Fjfoe6nxau5dape3e1pd5.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.amazonaws.com%2Fuploads%2Farticles%2Fjfoe6nxau5dape3e1pd5.jpg" alt="GPS Tracker SMS Output" width="800" height="598"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Libraries Used
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/mikalhart/TinyGPSPlus" rel="noopener noreferrer"&gt;TinyGPS++&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.arduino.cc/en/Reference/softwareSerial" rel="noopener noreferrer"&gt;SoftwareSerial&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.pjrc.com/teensy/td_libs_AltSoftSerial.html" rel="noopener noreferrer"&gt;AltSoftSerial&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Notes
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Make sure your SIM card has SMS credits and is unlocked.&lt;/li&gt;
&lt;li&gt;The SIM800L is sensitive to power supply quality; use a stable 4V power source.&lt;/li&gt;
&lt;li&gt;GPS fix may take a few minutes outdoors.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  License
&lt;/h2&gt;

&lt;p&gt;This project is open-source and free.&lt;/p&gt;




&lt;h2&gt;
  
  
  📧 Contact
&lt;/h2&gt;

&lt;p&gt;Payam Hoseini - &lt;a href="mailto:p.hoseini.ch@gmail.com"&gt;p.hoseini.ch@gmail.com&lt;/a&gt;&lt;br&gt;
WebSite: [&lt;a href="https://payamdev.com" rel="noopener noreferrer"&gt;https://payamdev.com&lt;/a&gt;]&lt;/p&gt;

&lt;p&gt;Project Link: &lt;a href="https://github.com/payamhsn/Iot-ArduinoGpsTracker" rel="noopener noreferrer"&gt;https://github.com/payamhsn/Iot-ArduinoGpsTracker&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you have any ideas or improvement please comment it for me.&lt;br&gt;
Made with ❤️ by &lt;em&gt;Payam Hoseini.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>iot</category>
      <category>gps</category>
      <category>diy</category>
      <category>arduino</category>
    </item>
    <item>
      <title>DIY Local Wireless Control System With ESP8266 And Relay - No Internet Required</title>
      <dc:creator>Payam Hoseini</dc:creator>
      <pubDate>Mon, 19 May 2025 17:56:56 +0000</pubDate>
      <link>https://forem.com/payamhn/diy-local-wireless-control-system-with-esp8266-and-relay-no-internet-required-2jn5</link>
      <guid>https://forem.com/payamhn/diy-local-wireless-control-system-with-esp8266-and-relay-no-internet-required-2jn5</guid>
      <description>&lt;p&gt;I think this is one of the most important projects if you are interested in iot. This project connects an ESP8266 (D1 Mini) to a 5-pin relay module, creating a web server that hosts a control interface. I select ESP8266 for this project because of its WIFI and I used D1 mini because it is one of the best ESP8266 variant, it's compact and powerful enough and has many pins. &lt;br&gt;
You can toggle the relay on/off from any device on your local network by accessing the ESP8266's IP address in a web browser. This is a simple and effective solution for controlling devices remotely using a web interface. &lt;br&gt;
I use a transistor(2n2222) and a diod(1n4007) because my relay is 5 volt and d1 mini pins has around 3 volt output and i use transistor to be able to use 5 volt pin of d1 mini to trigger relay coil. ( If you have 3V relays, You only need to connect D1 mini and relay together )&lt;/p&gt;
&lt;h2&gt;
  
  
  ✨ Features
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;🌐 Web-based control interface&lt;/li&gt;
&lt;li&gt;💡 Real-time status updates&lt;/li&gt;
&lt;li&gt;🔄 Automatic status refresh&lt;/li&gt;
&lt;li&gt;📱 Mobile-friendly responsive design&lt;/li&gt;
&lt;li&gt;🔌 Control any device connected to the relay&lt;/li&gt;
&lt;li&gt;🏠 Works on your local network (no internet required)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  🛠️ Hardware Requirements
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;ESP8266 D1 Mini (or any ESP8266-based board)&lt;/li&gt;
&lt;li&gt;5V Relay Module&lt;/li&gt;
&lt;li&gt;NPN Transistor (e.g., 2N2222)&lt;/li&gt;
&lt;li&gt;1kΩ Resistor&lt;/li&gt;
&lt;li&gt;Jumper Wires&lt;/li&gt;
&lt;li&gt;Micro USB Cable&lt;/li&gt;
&lt;li&gt;Power Supply (for the relay if needed)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  📊 Circuit Diagram
&lt;/h2&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%2Fupap73ofia8kgun69c6r.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%2Fupap73ofia8kgun69c6r.png" alt="Local Wireless Control System With ESP8266 And Relay Circuit Diagram" width="800" height="396"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  My Wiring
&lt;/h3&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%2Fx3ziyt5xdl1709846sq1.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.amazonaws.com%2Fuploads%2Farticles%2Fx3ziyt5xdl1709846sq1.jpg" alt="My Wiring for Local Wireless Control System With ESP8266 And Relay" width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  🔧 Setup Instructions
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Parts Pinout
&lt;/h3&gt;
&lt;h4&gt;
  
  
  5V Relay
&lt;/h4&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%2Fe1iqtr2yq5rojt7bdvm5.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%2Fe1iqtr2yq5rojt7bdvm5.png" alt="5V 5Pin Relay Pinout" width="434" height="406"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  2N2222 Transistor
&lt;/h4&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%2Fp0m0drfp2l4v2cq2q3c9.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%2Fp0m0drfp2l4v2cq2q3c9.png" alt="2N2222 Transistor Pinout" width="354" height="414"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  1N4007 Diode
&lt;/h4&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%2Fnxl3rqid2nt314ru6zgd.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%2Fnxl3rqid2nt314ru6zgd.png" alt="1N4007 Diode Pinout" width="774" height="258"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Hardware Setup
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Connect the D1 pin of the ESP8266 to the base of the NPN transistor through a 1kΩ resistor&lt;/li&gt;
&lt;li&gt;Connect the collector of the transistor to the control pin of the relay module&lt;/li&gt;
&lt;li&gt;Connect the emitter of the transistor to ground&lt;/li&gt;
&lt;li&gt;Connect the VCC of the relay module to the 5V output of the ESP8266 (or external power supply for larger relays)&lt;/li&gt;
&lt;li&gt;Connect the GND of the relay module to the GND of the ESP8266&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;
  
  
  Sketch
&lt;/h3&gt;

&lt;p&gt;Here is the sketch that you need to upload to your ESP8266 board :&lt;br&gt;
( If you dont know how to upload this sketch to your board, After sketch there is a simple guide to install Arduino IDE and required packages for uploading it )&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;ESP8266WiFi.h&amp;gt;
#include &amp;lt;ESP8266WebServer.h&amp;gt;
#include &amp;lt;ArduinoJson.h&amp;gt;

// WiFi credentials
const char* ssid = "YourWifiSSID";      // Replace with your WiFi name
const char* password = "YourWifiPassword";  // Replace with your WiFi password

// Pin definitions
const int relayPin = D1;  // D1 pin connected to transistor base via resistor

// Web server on port 80
ESP8266WebServer server(80);

// LED state
bool ledState = false;

void setup() {
  // Initialize serial communication
  Serial.begin(115200);

  // Set relay pin as output
  pinMode(relayPin, OUTPUT);

  // Initially turn off the relay
  digitalWrite(relayPin, LOW);

  // Connect to WiFi
  WiFi.begin(ssid, password);
  Serial.print("Connecting to WiFi");

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println();
  Serial.print("Connected to WiFi. IP address: ");
  Serial.println(WiFi.localIP());

  // Define server routes
  server.on("/", handleRoot);
  server.on("/toggle", handleToggle);
  server.on("/status", handleStatus);
  server.onNotFound(handleNotFound);

  // Start the server
  server.begin();
  Serial.println("HTTP server started");
}

void loop() {
  server.handleClient();
}

// Handle root page
void handleRoot() {
  String html = R"(
&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
    &amp;lt;title&amp;gt;LED Control&amp;lt;/title&amp;gt;
    &amp;lt;style&amp;gt;
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            background-color: #f5f5f5;
        }
        .container {
            background-color: white;
            border-radius: 10px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            padding: 30px;
            text-align: center;
            max-width: 400px;
            width: 100%;
        }
        h1 {
            color: #333;
            margin-bottom: 30px;
        }
        .status {
            margin: 20px 0;
            font-size: 18px;
        }
        .switch {
            position: relative;
            display: inline-block;
            width: 60px;
            height: 34px;
            margin: 20px 0;
        }
        .switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }
        .slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #ccc;
            transition: .4s;
            border-radius: 34px;
        }
        .slider:before {
            position: absolute;
            content: "";
            height: 26px;
            width: 26px;
            left: 4px;
            bottom: 4px;
            background-color: white;
            transition: .4s;
            border-radius: 50%;
        }
        input:checked + .slider {
            background-color: #2196F3;
        }
        input:checked + .slider:before {
            transform: translateX(26px);
        }
        .led-icon {
            font-size: 48px;
            margin: 20px 0;
            transition: color 0.3s;
        }
        .led-off {
            color: #ccc;
        }
        .led-on {
            color: #ffcc00;
            text-shadow: 0 0 10px #ffcc00;
        }
    &amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;div class="container"&amp;gt;
        &amp;lt;h1&amp;gt;LED Control Panel&amp;lt;/h1&amp;gt;

        &amp;lt;div class="led-icon" id="ledIcon"&amp;gt;💡&amp;lt;/div&amp;gt;

        &amp;lt;div class="status"&amp;gt;
            LED Status: &amp;lt;span id="ledStatus"&amp;gt;OFF&amp;lt;/span&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;label class="switch"&amp;gt;
            &amp;lt;input type="checkbox" id="toggleSwitch"&amp;gt;
            &amp;lt;span class="slider"&amp;gt;&amp;lt;/span&amp;gt;
        &amp;lt;/label&amp;gt;

        &amp;lt;div&amp;gt;
            &amp;lt;p&amp;gt;IP Address: )" + WiFi.localIP().toString() + R"(&amp;lt;/p&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;

    &amp;lt;script&amp;gt;
        const toggleSwitch = document.getElementById('toggleSwitch');
        const ledStatus = document.getElementById('ledStatus');
        const ledIcon = document.getElementById('ledIcon');

        // Get initial state
        fetchStatus();

        // Toggle switch event
        toggleSwitch.addEventListener('change', function() {
            fetch('/toggle')
            .then(response =&amp;gt; response.json())
            .then(data =&amp;gt; {
                updateUI(data.state);
            })
            .catch(error =&amp;gt; console.error('Error:', error));
        });

        // Fetch current status
        function fetchStatus() {
            fetch('/status')
            .then(response =&amp;gt; response.json())
            .then(data =&amp;gt; {
                updateUI(data.state);
            })
            .catch(error =&amp;gt; console.error('Error:', error));
        }

        // Update UI based on state
        function updateUI(state) {
            toggleSwitch.checked = state;
            ledStatus.textContent = state ? 'ON' : 'OFF';
            if (state) {
                ledIcon.classList.add('led-on');
                ledIcon.classList.remove('led-off');
            } else {
                ledIcon.classList.add('led-off');
                ledIcon.classList.remove('led-on');
            }
        }

        // Refresh status every 5 seconds
        setInterval(fetchStatus, 5000);
    &amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
  )";

  server.send(200, "text/html", html);
}

// Handle toggle request
void handleToggle() {
  ledState = !ledState;
  digitalWrite(relayPin, ledState ? HIGH : LOW);

  DynamicJsonDocument doc(64);
  doc["state"] = ledState;

  String response;
  serializeJson(doc, response);
  server.send(200, "application/json", response);
}

// Handle status request
void handleStatus() {
  DynamicJsonDocument doc(64);
  doc["state"] = ledState;

  String response;
  serializeJson(doc, response);
  server.send(200, "application/json", response);
}

// Handle 404 Not Found
void handleNotFound() {
  server.send(404, "text/plain", "Not Found");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Software Setup
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Install the Arduino IDE from &lt;a href="https://www.arduino.cc/en/software" rel="noopener noreferrer"&gt;arduino.cc&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Add ESP8266 board support:

&lt;ul&gt;
&lt;li&gt;Open Arduino IDE&lt;/li&gt;
&lt;li&gt;Go to File &amp;gt; Preferences&lt;/li&gt;
&lt;li&gt;Add &lt;code&gt;http://arduino.esp8266.com/stable/package_esp8266com_index.json&lt;/code&gt; to Additional Boards Manager URLs&lt;/li&gt;
&lt;li&gt;Go to Tools &amp;gt; Board &amp;gt; Boards Manager&lt;/li&gt;
&lt;li&gt;Search for ESP8266 and install&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Install required libraries:

&lt;ul&gt;
&lt;li&gt;Go to Sketch &amp;gt; Include Library &amp;gt; Manage Libraries&lt;/li&gt;
&lt;li&gt;Search for and install:

&lt;ul&gt;
&lt;li&gt;ESP8266WiFi&lt;/li&gt;
&lt;li&gt;ESP8266WebServer&lt;/li&gt;
&lt;li&gt;ArduinoJson&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Open the &lt;code&gt;sketch.ino&lt;/code&gt; file in Arduino IDE&lt;/li&gt;
&lt;li&gt;Update the WiFi credentials:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;   &lt;span class="k"&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="s"&gt;"YourWifiSSID"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;      &lt;span class="c1"&gt;// Replace with your WiFi name&lt;/span&gt;
   &lt;span class="k"&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="s"&gt;"YourWifiPassword"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// Replace with your WiFi password&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Select your board (Tools &amp;gt; Board &amp;gt; ESP8266 Boards &amp;gt; LOLIN(WEMOS) D1 R2 &amp;amp; mini)&lt;/li&gt;
&lt;li&gt;Select the correct port (Tools &amp;gt; Port)&lt;/li&gt;
&lt;li&gt;Upload the sketch to your ESP8266&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  🚀 Usage
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Power on your ESP8266&lt;/li&gt;
&lt;li&gt;The device will connect to your WiFi network&lt;/li&gt;
&lt;li&gt;Check the Serial Monitor (115200 baud) to see the assigned IP address&lt;/li&gt;
&lt;li&gt;Open a web browser on any device connected to the same network&lt;/li&gt;
&lt;li&gt;Enter the IP address in the address bar&lt;/li&gt;
&lt;li&gt;Use the toggle switch on the web interface to control the relay&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Sample of LED Control Panel
&lt;/h3&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%2Fwnibuxn2io00kit9jwzq.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.amazonaws.com%2Fuploads%2Farticles%2Fwnibuxn2io00kit9jwzq.jpg" alt="Sample of LED Control Panel" width="762" height="1080"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  🔍 Troubleshooting
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;ESP8266 not connecting to WiFi&lt;/strong&gt;: Double-check your WiFi credentials in the code&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Relay not switching&lt;/strong&gt;: Verify your wiring connections and ensure the transistor is properly connected&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cannot access web interface&lt;/strong&gt;: Make sure your device is connected to the same network as the ESP8266&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Relay switching erratically&lt;/strong&gt;: Check for proper grounding and consider adding a flyback diode if not already included in your relay module&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If there is any unknown problems, don't hesitate to contact me.&lt;/p&gt;

&lt;h2&gt;
  
  
  🛡️ Safety Warnings
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;This project involves working with electricity which can be dangerous&lt;/li&gt;
&lt;li&gt;Never connect the relay to mains voltage without proper knowledge and safety precautions&lt;/li&gt;
&lt;li&gt;Always disconnect power before making any changes to the circuit&lt;/li&gt;
&lt;li&gt;Consider using an optocoupler for additional safety when working with higher voltages&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  📧 Contact
&lt;/h2&gt;

&lt;p&gt;Payam Hoseini - &lt;a href="mailto:p.hoseini.ch@gmail.com"&gt;p.hoseini.ch@gmail.com&lt;/a&gt;&lt;br&gt;
WebSite: [&lt;a href="https://payamdev.com" rel="noopener noreferrer"&gt;https://payamdev.com&lt;/a&gt;]&lt;/p&gt;

&lt;p&gt;Project Link: &lt;a href="https://github.com/payamhsn/Iot-ESP8266andRelay" rel="noopener noreferrer"&gt;https://github.com/payamhsn/Iot-ESP8266andRelay&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;I wrote most of this blog post by myself and use chatgpt for some parts.&lt;br&gt;
Made with ❤️ by [Payam Hoseini]&lt;/p&gt;

</description>
      <category>esp8266</category>
      <category>iot</category>
      <category>diy</category>
      <category>devicecontroller</category>
    </item>
    <item>
      <title>A Simple Guide To SIM800L: Control Your IoT Projects From Anywhere</title>
      <dc:creator>Payam Hoseini</dc:creator>
      <pubDate>Mon, 19 May 2025 14:24:33 +0000</pubDate>
      <link>https://forem.com/payamhn/a-simple-guide-to-sim800l-control-your-iot-projects-from-anywhere-10km</link>
      <guid>https://forem.com/payamhn/a-simple-guide-to-sim800l-control-your-iot-projects-from-anywhere-10km</guid>
      <description>&lt;p&gt;I think Sim800l is one of most valuable modules in IOT because in conditions that you don't have internet or WIFI, you can use it only with a sim card. Also its so cheap and it is so easy to run and use. In my experiments i found it so easy to start working and it only needs a good power source. based on data sheet it needs between 3.4 to 4.2 volt, but i found around 4.1 volt is good and it will has a stable connection without any problems. When you power up Sim800l, if you see led on module blinks every 1 seconds it mean connection has problem and i found in most of cases its because of power supply. when it blinks every 3 seconds, its ok and connected. I use a 18650 battery which has around 4.2 volt when it is fully charged. You can also use Li-Po batteries.&lt;br&gt;
One of other benefits of Sim800l is its power usage which is very low and make it a good choice for portable devices. In sleep mode it only use 1 mAh and when it is under load for receiving SMS, it uses around 50 mAh. I calculated for a normal usage with a 5000 mAh battery, it last around 2 weeks.&lt;br&gt;
In this blog at first we just power up Sim800l and show received SMS in terminal, next we add a feature to send back a confirmation SMS as a SMS arrived and in last step we control a simple led with a command that we will send it through our SMS. This project is a starting point for using Sim800l and in future i am going to make other projects with it and replace this simple led with other things like GPS module to make a Tracker Device.&lt;/p&gt;
&lt;h2&gt;
  
  
  Project Overview
&lt;/h2&gt;

&lt;p&gt;This repository contains a step-by-step implementation of SMS-based control using the SIM800L GSM module. The project is divided into three main parts:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Basic SMS Reception&lt;/strong&gt; - Setting up the SIM800L to receive and display SMS messages in the serial monitor&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LED Control via SMS&lt;/strong&gt; - Extending the basic setup to control an LED by sending "ON" or "OFF" text messages&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SMS Reception and Confirmation&lt;/strong&gt; - Like first part but it will sends back a confirmation SMS that your SMS delivered.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Perfect for IoT enthusiasts looking to add remote control capabilities to their projects without relying on WiFi or Bluetooth.&lt;/p&gt;
&lt;h2&gt;
  
  
  Hardware Requirements
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Arduino UNO or compatible board&lt;/li&gt;
&lt;li&gt;SIM800L GSM/GPRS module&lt;/li&gt;
&lt;li&gt;SIM card with SMS capability (and some credit)&lt;/li&gt;
&lt;li&gt;LED&lt;/li&gt;
&lt;li&gt;220Ω resistor&lt;/li&gt;
&lt;li&gt;Breadboard and jumper wires&lt;/li&gt;
&lt;li&gt;Power supply (The SIM800L typically needs 3.7-4.2V)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  SIM800l Pinout
&lt;/h2&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%2F5ibj2xh7d0ngto4kc6a7.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%2F5ibj2xh7d0ngto4kc6a7.png" alt="SIM800l Pinout" width="795" height="356"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Wiring Connections
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;SIM800L Pin&lt;/th&gt;
&lt;th&gt;Arduino Pin&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;RX&lt;/td&gt;
&lt;td&gt;D2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TX&lt;/td&gt;
&lt;td&gt;D3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;VCC&lt;/td&gt;
&lt;td&gt;3.7-4.2V external supply&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GND&lt;/td&gt;
&lt;td&gt;GND&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For the LED control project:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Connect LED anode (longer leg) to Arduino pin D8&lt;/li&gt;
&lt;li&gt;Connect LED cathode (shorter leg) to a 220Ω resistor&lt;/li&gt;
&lt;li&gt;Connect the other end of the resistor to GND&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Wiring Connections Diagram Without LED
&lt;/h2&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%2Fd6bm53cbcovgjoesl3e8.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%2Fd6bm53cbcovgjoesl3e8.png" alt="SIM800L Wiring Connections Diagram Without LED" width="800" height="509"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Wiring Connections Diagram With LED
&lt;/h2&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%2Fe8un2oa3bf5vf2lojzqv.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%2Fe8un2oa3bf5vf2lojzqv.png" alt="SIM800L Wiring Connections Diagram With LED" width="800" height="543"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  My Wiring Connection (Sorry if it's not so nice)
&lt;/h2&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%2Fb0ts2iru62byqpgyes7f.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.amazonaws.com%2Fuploads%2Farticles%2Fb0ts2iru62byqpgyes7f.jpg" alt="Sample of SIM800L Wiring" width="800" height="503"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Software Setup
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Install the Arduino IDE if you haven't already&lt;/li&gt;
&lt;li&gt;No additional libraries are required for this project&lt;/li&gt;
&lt;li&gt;Upload the appropriate sketch to your Arduino:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;withoutLED.ino&lt;/code&gt; for basic SMS reception&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;WithLED.ino&lt;/code&gt; for LED control via SMS&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;WithoutLED&amp;amp;SendBackConfirm.ino&lt;/code&gt; for SMS reception and confirmation.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  Project Progression
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Part 1: Basic SMS Reception
&lt;/h3&gt;

&lt;p&gt;The first sketch demonstrates how to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Initialize the SIM800L module&lt;/li&gt;
&lt;li&gt;Configure it to receive SMS messages&lt;/li&gt;
&lt;li&gt;Display incoming messages in the serial monitor&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This provides a foundation for understanding how to communicate with the SIM800L module.&lt;br&gt;
Sketch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;SoftwareSerial.h&amp;gt;

#define SIM800_RX_PIN 2
#define SIM800_TX_PIN 3
#define SIM800_RST_PIN 4  // Optional, can be used to reset the module

SoftwareSerial sim800(SIM800_TX_PIN, SIM800_RX_PIN); // RX, TX for Arduino

void setup() {
  Serial.begin(9600);
  sim800.begin(9600);
  delay(1000);

  Serial.println("Initializing SIM800L...");
  sim800.println("AT");
  delay(1000);
  sim800.println("AT+CMGF=1"); // Set SMS text mode
  delay(1000);
  sim800.println("AT+CNMI=1,2,0,0,0"); // Auto show SMS
  delay(1000);
}

void loop() {
  if (sim800.available()) {
    Serial.write(sim800.read());
  }
  if (Serial.available()) {
    sim800.write(Serial.read());
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Part 2: Adding SMS Confirmation
&lt;/h3&gt;

&lt;p&gt;Building on the first part, this sketch adds:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Module sends back a confirmation that our SMS has been successfully received.
Sketch:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;SoftwareSerial.h&amp;gt;

#define SIM800_RX_PIN 2
#define SIM800_TX_PIN 3
#define SIM800_RST_PIN 4  // Optional, can be used to reset the module

SoftwareSerial sim800(SIM800_TX_PIN, SIM800_RX_PIN); // RX, TX for Arduino

String incomingData = "";
bool messageReceived = false;
String senderNumber = "";

void setup() {
  Serial.begin(9600);
  sim800.begin(9600);
  delay(1000);

  Serial.println("Initializing SIM800L...");

  // Reset module if needed
  // pinMode(SIM800_RST_PIN, OUTPUT);
  // digitalWrite(SIM800_RST_PIN, LOW);
  // delay(1000);
  // digitalWrite(SIM800_RST_PIN, HIGH);
  // delay(3000);

  // Initialize module
  sendATCommand("AT", 1000);
  sendATCommand("AT+CMGF=1", 1000); // Set SMS text mode
  sendATCommand("AT+CNMI=1,2,0,0,0", 1000); // Configure SMS notification

  Serial.println("SIM800L Ready");
}

void loop() {
  // Check for incoming data from SIM800L
  while (sim800.available()) {
    char c = sim800.read();
    incomingData += c;
    Serial.write(c); // Echo to serial monitor
    delay(10);
  }

  // Process complete messages
  if (incomingData.length() &amp;gt; 0) {
    // Check if it's an SMS message notification
    if (incomingData.indexOf("+CMT:") != -1) {
      // Extract sender phone number
      int phoneStartIndex = incomingData.indexOf("+CMT: \"") + 7;
      int phoneEndIndex = incomingData.indexOf("\"", phoneStartIndex);

      if (phoneStartIndex &amp;gt; 7 &amp;amp;&amp;amp; phoneEndIndex != -1) {
        senderNumber = incomingData.substring(phoneStartIndex, phoneEndIndex);
        Serial.print("Sender number: ");
        Serial.println(senderNumber);

        // Send reply SMS
        sendSMS(senderNumber, "Your SMS has been received. Thank you!");
      }
    }

    // Clear the buffer after processing
    incomingData = "";
  }

  // Handle commands from Serial monitor
  if (Serial.available()) {
    sim800.write(Serial.read());
  }
}

// Function to send AT commands
void sendATCommand(String command, int timeout) {
  sim800.println(command);
  delay(timeout);
  while (sim800.available()) {
    Serial.write(sim800.read());
  }
}

// Function to send SMS
void sendSMS(String number, String message) {
  Serial.println("Sending SMS reply...");

  sim800.println("AT+CMGF=1"); // Set SMS text mode
  delay(500);

  sim800.print("AT+CMGS=\"");
  sim800.print(number);
  sim800.println("\"");
  delay(500);

  sim800.print(message);
  delay(500);
  sim800.write(26); // ASCII code for CTRL+Z to send message

  delay(3000); // Wait for message to be sent

  Serial.println("SMS sent!");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Part 3: LED Control via SMS
&lt;/h3&gt;

&lt;p&gt;Building on the first part, this sketch adds:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;LED control functionality&lt;/li&gt;
&lt;li&gt;SMS command parsing&lt;/li&gt;
&lt;li&gt;Feedback through the serial monitor&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Send "ON" or "OFF" in an SMS to the SIM card number to control the LED remotely.&lt;br&gt;
Sketch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;SoftwareSerial.h&amp;gt;

#define SIM800_RX_PIN 2
#define SIM800_TX_PIN 3
#define SIM800_RST_PIN 4  // Optional, not used here
#define LED_PIN 8        // Connect an LED to this pin

SoftwareSerial sim800(SIM800_TX_PIN, SIM800_RX_PIN); // RX, TX for Arduino

String incomingData = ""; // To hold incoming data from SIM800

void setup() {
  pinMode(LED_PIN, OUTPUT);
  digitalWrite(LED_PIN, LOW); // Turn off LED initially

  Serial.begin(9600);
  sim800.begin(9600);
  delay(1000);

  Serial.println("Initializing SIM800L...");
  sim800.println("AT");
  delay(1000);
  sim800.println("AT+CMGF=1"); // Set SMS text mode
  delay(1000);
  sim800.println("AT+CNMI=1,2,0,0,0"); // Show SMS directly
  delay(1000);
}

void loop() {
  while (sim800.available()) {
    char c = sim800.read();
    Serial.write(c);
    incomingData += c;

    // Check for end of SMS
    if (c == '\n') {
      incomingData.trim(); // Remove extra spaces/newlines

      if (incomingData.indexOf("ON") != -1) {
        digitalWrite(LED_PIN, HIGH);
        Serial.println("LED turned ON");
      }
      else if (incomingData.indexOf("OFF") != -1) {
        digitalWrite(LED_PIN, LOW);
        Serial.println("LED turned OFF");
      }

      incomingData = ""; // Clear buffer for next message
    }
  }

  // Optional: forward Serial input to SIM800 for debugging
  while (Serial.available()) {
    sim800.write(Serial.read());
  }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Troubleshooting Tips
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Power Issues&lt;/strong&gt;: The SIM800L is sensitive to power fluctuations. Use a dedicated power supply capable of handling current spikes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Network Registration&lt;/strong&gt;: Make sure the SIM card is activated and has good signal strength.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AT Commands&lt;/strong&gt;: If you're having trouble, try sending basic AT commands through the serial monitor to test communication.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Baud Rate&lt;/strong&gt;: Ensure both the Arduino and SIM800L are communicating at the same baud rate (9600 in this project).&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;👉 You can find the full source code here:&lt;br&gt;
&lt;a href="https://github.com/payamhsn/Iot-Sim800l-Starter" rel="noopener noreferrer"&gt;GitHub Repo: payamhsn/Iot-Sim800l-Starter&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;At the end, i think this module is so valuable, because with this module and a relay which is a low cost setup, you can connect to any device with any voltage, from a Lamp to an Air condition systems and control them from anywhere that you are.&lt;br&gt;
Thanks a lot for reading my blog. I wrote everything by myself and a little help of AI in making tables and some content. Love &amp;amp; Respect&lt;/p&gt;

</description>
      <category>iot</category>
      <category>gsm</category>
      <category>sim800l</category>
      <category>diy</category>
    </item>
    <item>
      <title>LM35 vs BMP180: Comparing two budget temperature sensors</title>
      <dc:creator>Payam Hoseini</dc:creator>
      <pubDate>Mon, 19 May 2025 11:43:56 +0000</pubDate>
      <link>https://forem.com/payamhn/lm35-vs-bmp180-comparing-two-budget-temperature-sensors-4h04</link>
      <guid>https://forem.com/payamhn/lm35-vs-bmp180-comparing-two-budget-temperature-sensors-4h04</guid>
      <description>&lt;p&gt;&lt;em&gt;A project comparing temperature accuracy between an LM35 analog sensor and a BMP180 barometric sensor, with pressure/altitude measurements.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Early Conclusion:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;LM35&lt;/strong&gt; is more accurate for temperature.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;BMP180&lt;/strong&gt; is not accurate as LM35 is, but provides pressure/altitude measurements.
I've also tested DHT11 sensor previously and i can tell you that LM35 is so better and more accurate than DHT11, but if you want humidity beside temperature and price is not matter for your project, DHT22 is a better choice.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;👉 You can find the full source code here:&lt;br&gt;&lt;br&gt;
&lt;a href="https://github.com/payamhsn/Iot-LM35-vs-BMP180-Temp-" rel="noopener noreferrer"&gt;GitHub Repo: payamhsn/Iot-LM35-vs-BMP180-Temp&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🚀 Project Overview
&lt;/h2&gt;

&lt;p&gt;This project compares:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;LM35&lt;/strong&gt; (analog temperature sensor)
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;BMP180&lt;/strong&gt; (digital barometric sensor for temperature, pressure, and altitude)
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Key Findings:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;LM35&lt;/strong&gt; is more accurate for temperature (~24.44°C vs room thermometer: 24°C).
&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;BMP180&lt;/strong&gt; reads slightly higher (~26.10°C) due to internal heat but provides useful pressure/altitude data.
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🔍 How the Sensors Work
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;LM35 Temperature Sensor&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Principle:&lt;/strong&gt; Linear analog output (10mV/°C).
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Accuracy:&lt;/strong&gt; ±0.5°C at 25°C.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No calibration needed&lt;/strong&gt; – directly outputs Celsius.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Formula:&lt;/strong&gt;
Temp (°C) = (ADC Reading × 500) / 1023&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pros:&lt;/strong&gt; Simple, low-cost, reliable.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cons:&lt;/strong&gt; Only measures temperature.
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;BMP180 Barometric Sensor&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Measures:&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Temperature (°C)
&lt;/li&gt;
&lt;li&gt;Pressure (hPa)
&lt;/li&gt;
&lt;li&gt;Altitude (meters, derived from pressure)
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Interface:&lt;/strong&gt; I²C (SDA: A4, SCL: A5 on Arduino Uno).
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How it calculates altitude:&lt;/strong&gt;
Altitude = 44330 × (1 − (P/P₀)^(1/5.255))
Where:
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;P&lt;/code&gt; = Measured pressure
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;P₀&lt;/code&gt; = Sea-level pressure (1013.25 hPa default)
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pros:&lt;/strong&gt; Multi-functional (pressure/altitude).
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cons:&lt;/strong&gt; Temperature may drift due to internal heat.
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🔧 Hardware Setup
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;BMP180 Pinout&lt;/strong&gt;&lt;br&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%2Fltu3xsctkykib50uiqqr.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%2Fltu3xsctkykib50uiqqr.png" alt="BMP180 Pinout" width="421" height="386"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;LM35 Pinout&lt;/strong&gt;&lt;br&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%2Fayxqkszaydkce5mgcsk7.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%2Fayxqkszaydkce5mgcsk7.png" alt="LM35 Pinout" width="589" height="336"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Wiring Diagram&lt;/strong&gt;
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Sensor&lt;/th&gt;
&lt;th&gt;Arduino Uno Pin&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;LM35&lt;/td&gt;
&lt;td&gt;A0 (Analog)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;BMP180&lt;/td&gt;
&lt;td&gt;I²C (SDA:A4, SCL:A5)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Circuit Setup:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;LM35:&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;VCC&lt;/code&gt; → 5V
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;GND&lt;/code&gt; → GND
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;OUT&lt;/code&gt; → A0
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;BMP180:&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;VCC&lt;/code&gt; → 3.3V or 5V
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;GND&lt;/code&gt; → GND
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;SCL&lt;/code&gt; → A5
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;SDA&lt;/code&gt; → A4
&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%2Fhie7z6l9mrubum7l85gg.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%2Fhie7z6l9mrubum7l85gg.png" alt="Wiring Diagram connecting LM35 and BMP180 to Arduino Uno" width="800" height="796"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;My Wiring&lt;/strong&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%2Fiw95c3aobmynn4gfgzvi.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.amazonaws.com%2Fuploads%2Farticles%2Fiw95c3aobmynn4gfgzvi.jpg" alt="My Wiring for connecting LM35 and BMP180 to Arduino Uno" width="800" height="1066"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  💻 Code Explanation
&lt;/h2&gt;

&lt;p&gt;The Arduino code:  &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Reads &lt;strong&gt;LM35&lt;/strong&gt; (analog voltage → temperature).
&lt;/li&gt;
&lt;li&gt;Reads &lt;strong&gt;BMP180&lt;/strong&gt; (temperature, pressure, altitude).
&lt;/li&gt;
&lt;li&gt;Calculates the &lt;strong&gt;difference&lt;/strong&gt; between the two sensors.
&lt;/li&gt;
&lt;li&gt;Prints data to &lt;strong&gt;Serial Monitor&lt;/strong&gt; every 10 seconds.
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Key Libraries:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Wire.h&lt;/code&gt; (I²C communication)
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Adafruit_BMP085.h&lt;/code&gt; (BMP180 sensor driver)
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  📊 Serial Monitor Output
&lt;/h2&gt;

&lt;p&gt;Sensor Data:&lt;br&gt;
LM35 Temperature: 24.44 °C&lt;br&gt;
BMP180 Temperature: 26.10 °C&lt;br&gt;
Temperature Difference (BMP-LM35): 1.66 °C&lt;br&gt;
BMP180 Pressure: 879.85 hPa&lt;br&gt;
BMP180 Altitude: 1174.28 meters&lt;/p&gt;




&lt;h2&gt;
  
  
  🔎 Observations &amp;amp; Analysis
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Temperature Difference (1.66°C):&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;BMP180 tends to read higher due to &lt;strong&gt;internal heat from pressure sensing&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;LM35 is &lt;strong&gt;more reliable&lt;/strong&gt; for ambient temperature.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pressure &amp;amp; Altitude:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Lower pressure (879.85 hPa) indicates &lt;strong&gt;higher altitude (1174m)&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Useful for &lt;strong&gt;weather tracking or elevation-based projects&lt;/strong&gt;.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  After hours of running LM35, i found that its get more and more accurate comparing to my other pro sensor.
&lt;/h2&gt;

&lt;p&gt;I wrote most of this blog by myself and a little help of AI. Thanks!&lt;/p&gt;

</description>
      <category>iot</category>
      <category>esp8266</category>
      <category>arduino</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
