<?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: Muhammad Ali Mustafa</title>
    <description>The latest articles on Forem by Muhammad Ali Mustafa (@muhammad-ali-mustafa).</description>
    <link>https://forem.com/muhammad-ali-mustafa</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%2F3682467%2F463fa7f2-50a8-431e-8d0e-534a391c3ea4.jpg</url>
      <title>Forem: Muhammad Ali Mustafa</title>
      <link>https://forem.com/muhammad-ali-mustafa</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/muhammad-ali-mustafa"/>
    <language>en</language>
    <item>
      <title>How I Competed and Won the First Module at NERC — Pakistan’s Premier Robotics Contest</title>
      <dc:creator>Muhammad Ali Mustafa</dc:creator>
      <pubDate>Sat, 31 Jan 2026 21:01:09 +0000</pubDate>
      <link>https://forem.com/muhammad-ali-mustafa/how-i-competed-and-won-the-first-module-at-nerc-pakistans-premier-robotics-contest-4m6f</link>
      <guid>https://forem.com/muhammad-ali-mustafa/how-i-competed-and-won-the-first-module-at-nerc-pakistans-premier-robotics-contest-4m6f</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;The National Engineering Robotics Contest (NERC) is one of Pakistan’s most prestigious robotics competitions. Organized annually at NUST College of Electrical &amp;amp; Mechanical Engineering (CEME), NERC brings together engineering students from across the country to test their skills in robotics, logic building, and real-time problem solving.&lt;/p&gt;

&lt;p&gt;Participating in Mini NERC and winning the first module was a defining moment in my robotics journey. This article shares what NERC is about, what the competition demands, and what I learned from the experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is NERC?
&lt;/h2&gt;

&lt;p&gt;The National Engineering Robotics Contest (NERC) is a large-scale robotics event designed to promote innovation, teamwork, and practical engineering skills.&lt;/p&gt;

&lt;p&gt;It features multiple categories, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Autonomous and semi-autonomous robots&lt;/li&gt;
&lt;li&gt;Line following and navigation challenges&lt;/li&gt;
&lt;li&gt;Competitive robot battles and races&lt;/li&gt;
&lt;li&gt;Task-based and logic-driven challenges&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each category pushes teams to design robots that are not only functional, but reliable under pressure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mini NERC: My Entry into Competitive Robotics
&lt;/h2&gt;

&lt;p&gt;Mini NERC serves as a smaller but intense version of the main competition. It introduces participants to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Competition rules and scoring&lt;/li&gt;
&lt;li&gt;Real-time performance evaluation&lt;/li&gt;
&lt;li&gt;Hardware and logic constraints&lt;/li&gt;
&lt;li&gt;Time and stress management&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For me, Mini NERC was the first time I truly experienced robotics outside a lab environment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding the First Module
&lt;/h2&gt;

&lt;p&gt;The first module focused on fundamental robotics skills, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Accurate line following&lt;/li&gt;
&lt;li&gt;Handling turns and junctions&lt;/li&gt;
&lt;li&gt;Stable motion control&lt;/li&gt;
&lt;li&gt;Logical decision-making&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Although it looked simple, even small logic errors could lead to complete failure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Our Approach
&lt;/h2&gt;

&lt;p&gt;Instead of chasing maximum speed, we focused on structured and predictable logic.&lt;/p&gt;

&lt;p&gt;Key design choices:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Clear sensor state definitions&lt;/li&gt;
&lt;li&gt;Priority-based decision handling&lt;/li&gt;
&lt;li&gt;Controlled speed for stability&lt;/li&gt;
&lt;li&gt;Extensive testing under realistic conditions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This allowed our robot to behave consistently throughout the run.&lt;/p&gt;

&lt;h2&gt;
  
  
  Challenges We Faced
&lt;/h2&gt;

&lt;p&gt;Some of the challenges we encountered were:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sensor noise causing false detections&lt;/li&gt;
&lt;li&gt;Timing mismatches during turns&lt;/li&gt;
&lt;li&gt;Minor alignment errors at higher speeds&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We addressed these by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Adding debouncing logic&lt;/li&gt;
&lt;li&gt;Simplifying control flow&lt;/li&gt;
&lt;li&gt;Tuning delays carefully&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These changes significantly improved reliability.&lt;/p&gt;

&lt;h2&gt;
  
  
  Winning the First Module
&lt;/h2&gt;

&lt;p&gt;During the final run, the robot:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Followed the line smoothly&lt;/li&gt;
&lt;li&gt;Handled junctions without confusion&lt;/li&gt;
&lt;li&gt;Completed the module reliably&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Securing first position in the first module of Mini NERC validated our focus on clean logic and preparation.&lt;/p&gt;

&lt;h2&gt;
  
  
  What NERC Taught Me
&lt;/h2&gt;

&lt;p&gt;Participating in NERC taught me that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Robotics is more about thinking than hardware&lt;/li&gt;
&lt;li&gt;Simple, clean logic outperforms complex systems&lt;/li&gt;
&lt;li&gt;Reliability matters more than aggressive performance&lt;/li&gt;
&lt;li&gt;Team coordination is as important as technical skill&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These lessons now guide how I approach all robotics and embedded systems projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why NERC Matters for Engineering Students
&lt;/h2&gt;

&lt;p&gt;NERC provides students with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Real-world engineering challenges&lt;/li&gt;
&lt;li&gt;Exposure to competitive robotics&lt;/li&gt;
&lt;li&gt;Opportunities to learn under pressure&lt;/li&gt;
&lt;li&gt;A platform to showcase skills and creativity&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It bridges the gap between academic learning and practical engineering.&lt;/p&gt;

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

&lt;p&gt;Winning the first module at Mini NERC was more than a competition victory — it was a learning milestone.&lt;/p&gt;

&lt;p&gt;NERC strengthened my foundation in robotic logic, embedded systems, and decision-making, and motivated me to continue exploring advanced robotics and autonomous systems.&lt;/p&gt;

</description>
      <category>robotics</category>
      <category>mechatronics</category>
      <category>embedded</category>
    </item>
    <item>
      <title>From Sensors to Decision: Logic Building in a Line Following Robot</title>
      <dc:creator>Muhammad Ali Mustafa</dc:creator>
      <pubDate>Sun, 28 Dec 2025 17:05:34 +0000</pubDate>
      <link>https://forem.com/muhammad-ali-mustafa/from-sensors-to-decision-logic-building-in-a-line-following-robot-27ap</link>
      <guid>https://forem.com/muhammad-ali-mustafa/from-sensors-to-decision-logic-building-in-a-line-following-robot-27ap</guid>
      <description>&lt;p&gt;&lt;em&gt;Originally published on Medium: &lt;a href="https://medium.com/@muhammad-ali-mustafa/from-sensors-to-decisions-logic-building-in-a-line-following-robot-2c15f9d0d324" rel="noopener noreferrer"&gt;https://medium.com/@muhammad-ali-mustafa/from-sensors-to-decisions-logic-building-in-a-line-following-robot-2c15f9d0d324&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;When people hear “line following robot,” they often imagine a simple system that just follows a black line. I used to think the same. But while building my own line following robot using &lt;strong&gt;Arduino Mega&lt;/strong&gt;, I realized that the real challenge wasn’t the motors or sensors — it was &lt;strong&gt;logic building&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This project taught me how raw sensor signals are transformed into decisions, actions, and controlled motion.&lt;/p&gt;




&lt;h2&gt;
  
  
  Understanding the Problem
&lt;/h2&gt;

&lt;p&gt;At a basic level, a line following robot must:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Detect a line using sensors&lt;/li&gt;
&lt;li&gt;Decide how to move based on sensor input&lt;/li&gt;
&lt;li&gt;Handle junctions, turns, and special conditions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In reality, this means dealing with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Noisy sensor data&lt;/li&gt;
&lt;li&gt;Timing issues&lt;/li&gt;
&lt;li&gt;Multiple conditions happening at once&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That’s where &lt;strong&gt;structured logic&lt;/strong&gt; becomes essential.&lt;/p&gt;




&lt;h2&gt;
  
  
  Sensor Setup and Input Interpretation
&lt;/h2&gt;

&lt;p&gt;My robot uses:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Front IR sensors&lt;/strong&gt; for line alignment&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Middle sensors&lt;/strong&gt; for junction detection&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TCS3200 color sensor&lt;/strong&gt; for color-based decision making&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead of treating each sensor independently, I grouped sensor states into &lt;strong&gt;logical conditions&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;On-line&lt;/li&gt;
&lt;li&gt;Slight deviation&lt;/li&gt;
&lt;li&gt;Junction detected&lt;/li&gt;
&lt;li&gt;Color-triggered condition&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This made the control flow much cleaner and easier to debug.&lt;/p&gt;




&lt;h2&gt;
  
  
  From Conditions to Decisions
&lt;/h2&gt;

&lt;p&gt;Once sensor states were defined, the next step was mapping them to actions.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If both front sensors detect white → &lt;strong&gt;move forward&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;If left detects black → &lt;strong&gt;steer left&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;If right detects black → &lt;strong&gt;steer right&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At junctions, I used:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Counters&lt;/li&gt;
&lt;li&gt;Debouncing logic&lt;/li&gt;
&lt;li&gt;Timed delays&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This allowed the robot to distinguish between &lt;strong&gt;normal line crossings&lt;/strong&gt; and &lt;strong&gt;actual junctions&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Handling Junctions with Counters
&lt;/h2&gt;

&lt;p&gt;A key learning point was &lt;strong&gt;junction counting&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Instead of hardcoding turns, I used a &lt;strong&gt;counter-based approach&lt;/strong&gt;, where:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Each detected junction increments a counter&lt;/li&gt;
&lt;li&gt;Specific counter values trigger specific actions (turn left, turn right, stop, etc.)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This made the path &lt;strong&gt;programmable and scalable&lt;/strong&gt; without changing the hardware.&lt;/p&gt;




&lt;h2&gt;
  
  
  Adding Conditional Logic with Color Detection
&lt;/h2&gt;

&lt;p&gt;To make the system more intelligent, I integrated a &lt;strong&gt;color sensor&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;At certain junctions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The robot checks for a specific color&lt;/li&gt;
&lt;li&gt;Based on detection, it alters its future path&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This introduced the idea of &lt;strong&gt;decision dependency&lt;/strong&gt;, where earlier sensor input affects later behavior — a very important concept in robotics and control systems.&lt;/p&gt;




&lt;h2&gt;
  
  
  Challenges Faced
&lt;/h2&gt;

&lt;p&gt;Some real-world problems I encountered:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;False junction detection due to sensor noise&lt;/li&gt;
&lt;li&gt;Timing mismatches between movement and detection&lt;/li&gt;
&lt;li&gt;Overlapping conditions causing unpredictable behavior&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Solving these required:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Better debouncing&lt;/li&gt;
&lt;li&gt;Clear priority rules&lt;/li&gt;
&lt;li&gt;Breaking complex logic into smaller functions&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  What This Project Taught Me
&lt;/h2&gt;

&lt;p&gt;This project helped me understand that robotics is less about hardware and more about &lt;strong&gt;structured thinking&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I learned:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How to design &lt;strong&gt;decision trees&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;How sensors translate into &lt;strong&gt;logic&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;How small timing errors affect &lt;strong&gt;system behavior&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Why &lt;strong&gt;clean, readable logic&lt;/strong&gt; is critical in embedded systems&lt;/li&gt;
&lt;/ul&gt;




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

&lt;p&gt;Building a line following robot was not just a beginner robotics project — it was an introduction to &lt;strong&gt;decision-making systems&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;From sensors to decisions, every step required &lt;strong&gt;logical clarity&lt;/strong&gt;. This experience strengthened my foundation in embedded systems, robotics, and control-oriented thinking, and motivated me to explore more complex autonomous systems.&lt;/p&gt;




&lt;p&gt;I plan to continue improving this system by adding &lt;strong&gt;PID control&lt;/strong&gt; and better &lt;strong&gt;sensor fusion techniques&lt;/strong&gt; in future iterations.&lt;/p&gt;

</description>
      <category>programming</category>
    </item>
  </channel>
</rss>
