<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Embedded &amp; Connected - Medium]]></title>
        <description><![CDATA[Embedded &amp; Connected is a publication dedicated to the Internet of Things, embedded systems, and smart technologies. We explore how devices connect, sense, and compute at the edge — sharing ideas, projects, and trends shaping the future of connected innovation. - Medium]]></description>
        <link>https://medium.com/embedded-connected-avinya-intelligence?source=rss----e2b5ee04f7c7---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Embedded &amp;amp; Connected - Medium</title>
            <link>https://medium.com/embedded-connected-avinya-intelligence?source=rss----e2b5ee04f7c7---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 23:25:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/embedded-connected-avinya-intelligence" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[“Data Smoothing Filters in Embedded Systems: A Practical Guide with Code, Formulas & Tips”]]></title>
            <link>https://medium.com/embedded-connected-avinya-intelligence/data-smoothing-filters-in-embedded-systems-a-practical-guide-with-code-formulas-tips-7f4373a2efbb?source=rss----e2b5ee04f7c7---4</link>
            <guid isPermaLink="false">https://medium.com/p/7f4373a2efbb</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[internet-of-things]]></category>
            <category><![CDATA[embedded-systems]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Aniket Fasate]]></dc:creator>
            <pubDate>Mon, 23 Feb 2026 14:56:30 GMT</pubDate>
            <atom:updated>2025-08-10T00:00:21.244Z</atom:updated>
            <content:encoded><![CDATA[<p>In the world of embedded systems, sensors collect data from the physical environment- but that data is often noisy and messy. Electrical interference, hardware imperfections, and environmental factors can cause readings to fluctuate unexpectedly, even if nothing is changing in reality.</p><p>That’s where data smoothing filters step in. These algorithms help clean the data by reducing unwanted noise while preserving important signal characteristics. In this article, we will cover the most common smoothing filters in embedded systems, what they do, their pros and cons, example formulas, real C code snippets you can directly use, and how to pick the right filter for your application.</p><ol><li><strong><em>Moving Average Filter</em> </strong><br>The Moving Average Filter is the simples way to smooth data by averaging a fixed number of recent samples a sliding window.</li></ol><p><em>How it works:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/303/1*a1c79wz3AvZmijgP_-xeiA.png" /></figure><p><em>Where:</em> <br>* x[k] are the input samples,<br>* N is the window size,<br>* y[n] is the smoothed output at time n.</p><p><em>Pros:</em><br>* Very sample to implement.<br>* Effective at filtering out high-frequency noise.</p><p><em>Cons:</em> <br>* Introduces lag(delay in response). <br>* can blur sharp changes or edges in the signal.</p><p><strong><em>Examples C code</em></strong></p><pre>#define N 5  // Window size<br>float buffer[N] = {0};<br>int index = 0;<br>float sum = 0;<br><br>float moving_average(float new_sample) {<br>    sum -= buffer[index];<br>    buffer[index] = new_sample;<br>    sum += new_sample;<br>    <br>    index = (index + 1) % N;<br>    return sum / N;<br>}</pre><p><strong><em>Use Cases:</em></strong> Smoothing temperatures or pressure sensors where quick reaction is not essential.</p><p><strong><em>2. Exponential Moving Average(EMA)</em><br></strong>The Exponential Moving Average gives exponentially decreasing weights to older samples, making it more responsive and memory- efficient.</p><p><em>Formula:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/1*DvSI8AgWPzaLl0zTshdBCA.png" /></figure><p><em>Where: <br>* </em>α controls smoothing (between 0 and 1),<br>* x[n] is the current sample,<br>* y[n-1] is the previous output.</p><p><em>Pros:<br>* </em>Require only one previous output, very low memory use.<br>* Adjustable responsive via α.<br>* Ideal for limited-resources microcontrollers.</p><p><em>Cons:<br>* </em>Slight lag remains.<br>* May be slower to track changes then raw data.</p><p><strong><em>Example C Code:</em></strong></p><pre>float alpha = 0.1f;<br>float ema_last = 0;<br>int initialized = 0;<br><br>float exponential_moving_average(float new_sample) {<br>    if (!initialized) {<br>        ema_last = new_sample;<br>        initialized = 1;<br>    } else {<br>        ema_last = alpha * new_sample + (1 - alpha) * ema_last;<br>    }<br>    return ema_last;<br>}</pre><p><strong><em>Use Cases:</em></strong> Filtering motion sensors, battery voltage smoothing, control loops.</p><p><strong><em>3. Savitzky–Golay Filter</em><br></strong>The Savitzky-golay filter fits a polynomial to data in a sliding window using least squares, preserving peak shapes and signal features better than averages.</p><p><strong><em>Key Idea:</em></strong> Use fixed polynomial coefficients of smooth data without distorting peaks or widths.<br>Example coefficients for a window size 5 and quadratic fit:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/327/1*0zxqN1W4q03dHf-q9gudjw.png" /></figure><p><strong>Example C Code:</strong></p><pre>#define N 5<br>float sg_coeffs[N] = {-3.0f/35, 12.0f/35, 17.0f/35, 12.0f/35, -3.0f/35};<br>float sg_buffer[N] = {0};<br>int sg_index = 0;<br>int sg_samples = 0;<br><br>float savitzky_golay(float new_sample) {<br>    sg_buffer[sg_index] = new_sample;<br>    sg_index = (sg_index + 1) % N;<br>    if (sg_samples &lt; N) sg_samples++;<br><br>    if (sg_samples &lt; N) return new_sample;<br><br>    float result = 0;<br>    for (int i = 0; i &lt; N; i++) {<br>        int buf_index = (sg_index + i) % N;<br>        result += sg_coeffs[i] * sg_buffer[buf_index];<br>    }<br>    return result;<br>}</pre><p><em>Pros:</em> <br>* Excellent features preservation.<br>* Reduces noise without blurring.</p><p><em>Cons:<br>* </em>Higher CPU cost.<br>* More memory and complexity.</p><p><strong><em>Use Cases:</em></strong> ECG, EEG, spectroscopy, or any application requiring signal fidelity.</p><p><strong>4. DC Blocking Filter <br></strong>Constant Offsets (DC component) in signal can cause drift or bias. A DC Blocking Filter removes this offset, focusing on changes.</p><p><em>Formula:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/477/1*ebgloaSM3x_zH6Aj84dUrA.png" /></figure><p>where R is close to but less than 1(e.g 0.995).</p><p><strong>Example C Code:</strong></p><pre>float R = 0.995f;<br>float prev_input = 0;<br>float prev_output = 0;<br><br>float dc_blocking_filter(float new_sample) {<br>    float y = new_sample - prev_input + R * prev_output;<br>    prev_input = new_sample;<br>    prev_output = y;<br>    return y;<br>}</pre><p><em>Pros:<br>* </em>Removes signals bias and drift. <br>* Pairs well with smoothing filters like EMA.</p><p><em>Cons:</em><br>* Does not reduce random noise.</p><p><strong><em>Use Cases:</em></strong> Audio processing, accelerometer zero-bias correction.</p><p><strong>Choosing the Right Filter</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*utB8h6t90wYGsP43UDS3Gw.png" /></figure><p><strong><em>Tips for Embedded Engineers</em></strong><br>* For ultra-constrained MCUs(e.g 8 bit AVR), implement filters using integer or fixed-point math to avoid slow floating-point operations.<br>* Often, combining a DC Blocker with EMA yields effective results — removing offsets and smoothing noise with minimal computational cost. <br>* Tune parameters like window size, <em>α</em>, and R according to your sensor dynamics and noise characteristics. <br>* Always validate filters with both simulated and real sensor data to ensure performance meets your system requirements.</p><p><strong><em>Thank you so much for taking the time to read my blog!</em></strong><em><br>I truly appreciate your interest. I’m currently exploring opportunities for collaboration in </em><strong><em>Research and Development</em></strong><em> across the fields of </em><strong><em>Internet of Things (IoT)</em></strong><em>, </em><strong><em>Embedded Systems</em></strong><em>, and </em><strong><em>Machine Learning</em></strong><em>.</em></p><p><em>If you’re working in these areas or have a shared interest, I’d love to connect and explore how we can collaborate.<br>Feel free to reach out to me on </em><a href="https://www.linkedin.com/in/aniketfasate27/"><strong><em>LinkedIn.</em></strong></a></p><p><em>Looking forward to meaningful connections and innovative projects!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7f4373a2efbb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/embedded-connected-avinya-intelligence/data-smoothing-filters-in-embedded-systems-a-practical-guide-with-code-formulas-tips-7f4373a2efbb">“Data Smoothing Filters in Embedded Systems: A Practical Guide with Code, Formulas &amp; Tips”</a> was originally published in <a href="https://medium.com/embedded-connected-avinya-intelligence">Embedded &amp; Connected</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“Understanding the “volatile” Keyword in Embedded C: The Most Misused Modifier Explained”]]></title>
            <link>https://medium.com/embedded-connected-avinya-intelligence/understanding-the-volatile-keyword-in-embedded-c-the-most-misused-modifier-explained-91f6ddc29bb1?source=rss----e2b5ee04f7c7---4</link>
            <guid isPermaLink="false">https://medium.com/p/91f6ddc29bb1</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[internet-of-things]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[embedded-systems]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Aniket Fasate]]></dc:creator>
            <pubDate>Sun, 12 Oct 2025 02:13:16 GMT</pubDate>
            <atom:updated>2025-10-12T02:13:12.259Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jSpyqul8WtuvM6zcpxgMfw.png" /><figcaption>author generated this image using genAI</figcaption></figure><h4><strong>Understanding the Volatile Variable: Why and When to Use It</strong></h4><p>In the world of programming, especially embedded system and low-level development, the keyword volatile is a small but powerful tool. It plays a crucial role in ensuring correct program behavior when dealing with variables whose values can unexpectedly change outside the control of the code the compiler sees. But why is this keyword needed, how does it work exactly, and when should you use it? This blog post digs deep into these questions with practical insights.</p><p><strong>What Does volatile Mean? <br></strong>A variable marked as volatile tells the compiler:<br>“Hey, this value can change at any time, without you knowing. So, aways read it fresh from memory and never optimize accesses by caching or recording them.”</p><p>By Default, compilers code to run faster. For example, when looping over a variable, the compiler might decide to keep its value in a register which is faster type of storage instead of repeatedly reading it from memory. This is usually beneficial but can cause problems if the value can be changed outside the program flow, such as by hardware or another thread.</p><p><strong>Why do we need Volatile?</strong></p><p>In embedded systems, volatile is absolutely critical because many variables don’t just change as a result of your own code execution.</p><ul><li><strong>Memory-mapped hardware registers:</strong> Microcontrollers often map hardware peripherals (like timers, sensors, communications, controllers) to specific memory addresses. The contents of these addresses can change independently of you program. Declaring such pointers or variables as volatile ensures the CPU fetches the fresh value every time.</li><li><strong>Interrupt Service Routine(ISR)</strong>: Imagine you have a flag set by an interrupt handler to notify the main program something happened. If the flag is not volatile, the compiler might optimize the ‘waiting loop’ and never see the flags update.</li><li><strong>Multithreaded Programming: </strong>In systems with multiple threads or cores, a variable can be changed by one thread while another reads it . Without volatile, the reading thread might cache the value and never observe the update.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/1*URI-Jkfm1YuD6Zh29u7sZw.png" /><figcaption><a href="https://www.javacodegeeks.com/2018/03/volatile-java-works-example-volatile-keyword-java.html">How Volatile in Java works? Example of volatile keyword in Java — Java Code Geeks</a></figcaption></figure><p><strong>How volatile Works Under the Hood<br></strong>When a variable is declared as volatile, the compiler inserts additional instructions to:</p><ul><li>Always write the variables current value to memory after any update.</li><li>Always read the current value from memory before using it.</li></ul><p>This prevents the compiler’s optimizer from assuming the variable value says unchanged unless the program explicitly writes it.</p><pre>volatile int sensor_flag;<br>while (!sensor_flag) {<br>    // Wait here until hardware or ISR sets sensor_flag<br>}</pre><p>Without volatile, the compiler might read sensor_flag once and optimize the while loops as an infinite loop since no code inside modifies the variable from its perspective.</p><p><strong>Important Considerations</strong></p><ul><li><strong>Volatile != Atomicity: </strong>Declaring a variable volatile does not protect against race conditions or concurrent access issues. It only prevents compiler optimizations. For atomic operations or proper synchronization, other primitives (like mutexes or atomic types) are needed.</li><li><strong>Performance Impact: </strong>Overuse of volatile can lead to less efficient code because if forces frequent memory accesses, which are slower than register or cache accesses.</li><li><strong>Platform Specifics: </strong>Behavior of volatile and memory models can vary between languages (C/C++, Java, C#) and hardware architectures. Understanding your specific platforms memory model is crucial.</li></ul><p>Practical Use Casses</p><ol><li><strong>Hardware I/O Registers Access:</strong></li></ol><pre>#define STATUS_REG (*(volatile uint32_t*)0x40001000)<br>uint32_t status = STATUS_REG;  // Always reads fresh hardware status<br></pre><p>2. <strong>Flag Set by Interrupt</strong></p><pre>volatile int data_ready = 0;<br><br>void ISR_data_received() {<br>    data_ready = 1;  // ISR sets flag<br>}<br><br>int main() {<br>    while (!data_ready) {<br>        // Wait for ISR to set the flag<br>    }<br>    // Proceed with processing<br>}</pre><p>3. <strong>Multithreaded Flag(C# Example)</strong></p><pre>volatile bool stopRequested = false;<br><br>void WorkerThread() {<br>    while (!stopRequested) {<br>        // Do work<br>    }<br>}</pre><p><strong><em>Thank you so much for taking the time to read my blog!</em></strong><em><br>I truly appreciate your interest. I’m currently exploring opportunities for collaboration in </em><strong><em>Research and Development</em></strong><em> across the fields of </em><strong><em>Internet of Things (IoT)</em></strong><em>, </em><strong><em>Embedded Systems</em></strong><em>, and </em><strong><em>Machine Learning</em></strong><em>.</em></p><p><em>If you’re working in these areas or have a shared interest, I’d love to connect and explore how we can collaborate.<br>Feel free to reach out to me on </em><a href="https://www.linkedin.com/in/aniketfasate27/"><strong><em>LinkedIn.</em></strong></a></p><p><em>Looking forward to meaningful connections and innovative projects!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91f6ddc29bb1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/embedded-connected-avinya-intelligence/understanding-the-volatile-keyword-in-embedded-c-the-most-misused-modifier-explained-91f6ddc29bb1">“Understanding the “volatile” Keyword in Embedded C: The Most Misused Modifier Explained”</a> was originally published in <a href="https://medium.com/embedded-connected-avinya-intelligence">Embedded &amp; Connected</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Motion Sensors: MPU-6050 and MPU-9250]]></title>
            <link>https://medium.com/embedded-connected-avinya-intelligence/motion-sensors-mpu-6050-and-mpu9250-e86467e9a237?source=rss----e2b5ee04f7c7---4</link>
            <guid isPermaLink="false">https://medium.com/p/e86467e9a237</guid>
            <category><![CDATA[mpu9250]]></category>
            <category><![CDATA[embedded-systems]]></category>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[sensors]]></category>
            <category><![CDATA[mpu6050]]></category>
            <dc:creator><![CDATA[Aniket Fasate]]></dc:creator>
            <pubDate>Sun, 10 Aug 2025 15:36:52 GMT</pubDate>
            <atom:updated>2025-06-08T19:02:53.054Z</atom:updated>
            <content:encoded><![CDATA[<h3>“Mastering Motion Sensing: A Comprehensive Guide to the MPU6050 and MPU9250”</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*wItL8xoQfLCx6qNiMYbGDQ.jpeg" /><figcaption>Source: google.com</figcaption></figure><h4>Accelerometer</h4><p>When the object goes from idle state to any velocity, to measure that non-gravitational acceleration a compact device used is accelerometer. It has a Cystal&#39;s that respond to that vibration associated with such movement and it goes under stress. Due to stress condition a voltage is generated which is responsible for acceleration reading. An accelerator is an electromechanical device. widely used in the</p><ol><li>Condition monitoring (fans, pumps, motors, compressors and other machinery).</li><li>Electronic Devices (Mobiles, tablets, drones and many more).</li><li>Structure testing (Buildings, Bridges, Monuments and many more).</li><li>Navigation systems.</li><li>Product testing (vehicles).</li></ol><p>There are several types of accelerometers depending on technology types to sense and output changes velocity and acceleration.</p><p><strong>1. Capacitive MEMS accelerometer:</strong> These type of accelerometer uses a microelectromechanical system to measure the changes in capacitance caused by the acceleration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*V9iGmQvGn7OxHe3Ye4s4mw.jpeg" /><figcaption>Source: google.com</figcaption></figure><p><strong>2. Piezoresistive accelerometer: </strong>these types of accelerometers use a strain gauge to measure the change in resistance caused by acceleration. These sensors are not the best for measuring low-frequency impacts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*GSUMZlMjw2h6QI5IGFHddw.png" /><figcaption>Source: google.com</figcaption></figure><p><strong>3. Piezoelectric accelerometer:</strong> These type of sensor uses a piezoelectric crystal to generate an electric charge proportional to acceleration. These types of accelerometers are highly effective at measuring shocks and vibrations. Piezoelectric accelerometers are better than piezoresistive accelerometers because of able to measure low-frequency impacts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/1*LZJgQBsxG8KFBCwozFay2A.png" /><figcaption>Source: google.com</figcaption></figure><h4>Gyroscope</h4><p>Gyroscope uses the principle of angular momentum, in which we detect the rotation of the object around an axis will tend to resist any change in the orientation of that axis. It is mainely used for measuring or maintaining orientation and angular velocity. It is commonly used in various applications such as navigation, robotics, aviation and electronics.</p><ol><li>Aviation and aerospace: In aircraft and spacecraft gyroscopes are used to maintain orientation and stability and to control autopilot. In aircraft to help the pilot maintain orientation and stability, even in turbulent conditions.</li><li>Robotics: In robots&#39; gyroscope is to provide directional cues, maintain position and navigation system. In drones Gyroscope ae used to help them maintain their orientation and stability while flying.</li><li>Consumer Electronics: In consumer electronics gyroscopes are mostly used in smartphones and other consumer electronics devices to detect orientation and movement. Gyroscopes are responsible for some smart features that are available in electronic devices such as automatic screen rotation, motion control in games, and augmented reality.</li><li>Industrial Applications: In industry Self-driving cars are popular and gyroscopes are used in self-driving cars to help them maintain their orientation and stability. This is essential for cars to be able to navigate safely and avoid obstacles.</li><li>Navigation: Gyroscope are used in navigation systems to track and balance and to provide directional cues. For the navigation and stabilization of large boats and satellites gyroscopes are used.</li></ol><p>There are different types of gyroscopes, but the most common ones include</p><ol><li><strong>Mechanical gyroscopes:</strong> This type of gyroscope consists of a spinning wheel or disk mounted on a set of gimbals, which allows it to rotate freely in multiple axes. The disc or wheel is mounted on a gimbal, which allows it to freely in any direction. Mechanical gyroscopes are used in a variety of applications such as submarines, aircraft and submarines. There are two main types of mechanical gyroscope are rate gyroscopes and integrating gyroscopes.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/533/1*MtuT-Xsk3eIiuudl7Adjhw.png" /><figcaption>Mechanical gyroscope</figcaption></figure><p>2. <strong>Optical gyroscope:</strong> optical gyroscopes are used light to measure rotational motion. They work by splitting a beam of light into two beams and sending them in opposite directions around a closed loop. If the loop is rotating, the two beams will travel different distances and return to the start point at different times. The difference in the arrival times of the two beams is a measure of the rotational rate of the loop. Optical Gyroscope are more accurate and less susceptible to drift than mechanical gyroscopes. There are two main types of optical gyroscope ring laser gyroscope and fiber optic gyroscope.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SLbiq5tSd9uBe9qg8kI28g.jpeg" /><figcaption>Source: Google.com</figcaption></figure><p><strong>3. Micro-electromechanical systems (MEMS): </strong>MEMS gyroscopes are very small and lightweight gyroscopes that are made using microfabrication techniques. They use a variety of different operating principles, but they all work by measuring the Coriolis force, which is a force that acts on a moving object in a rotating reference frame. MEMS gyroscopes are relatively inexpensive and are becoming increasingly common in consumer electronics devices. However, they are not as accurate as optical gyroscopes. Which type of gyroscope is best for a particular application depends on the specific requirements of the application. For example, if the application requires high accuracy and reliability, then an optical gyroscope would be the best choice. If the application requires a small and lightweight gyroscope, then a MEMS gyroscope would be the best choice.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*0ZwscK1R0t9Wi8klrMNJmw.jpeg" /><figcaption>Source: Google.com</figcaption></figure><p>In this Blog we will discuss two different types MEMS Accelerometer and gyroscope motion sensor which are widely used in the DIY project.</p><h3><strong>MPU-6050</strong></h3><p>The MPU 6050 is an Inertial Measurement unit (IMU) is a 3- axis accelerometer and 3 -axis gyroscope. Additionally, this module also measures chip ambient temperature. The MPU-6050 is a very popular IMU due to its small size, low power consumption, high accuracy, and reliability. It is also very affordable, making it a good choice for a wide range of applications like Robotics, Wearable Devices, Consumer electronics, Virtual reality, Industrial automation and many more.</p><h4>Accelerometer</h4><p>The accelerometer in the MPU-6050 is a 3-axis MEMS accelerometer that can measure acceleration in the X, Y, and Z directions. It has a full-scale range of ±2g, ±4g, ±8g, or ±16g. The accelerometer uses a capacitive sensing element to measure acceleration. The sensing element consists of a movable mass that is suspended between two fixed plates. When the accelerometer is accelerated, the movable mass displaces, which changes the capacitance between the plates. This change in capacitance is converted to an electrical signal, which is then digitized by the MPU-6050’s ADC.</p><p>The MPU-6050 accelerometer has a number of features that make it a good choice for a wide range of applications. It is very small and lightweight, measuring just 4x4x0.9mm. It is also very low power, consuming just 3mA. The MPU-6050 accelerometer is also very accurate and reliable, with a typical acceleration error of just 2%.</p><h4>Gyroscope</h4><p>The gyroscope in the MPU-6050 is a 3-axis MEMS gyroscope that measures the rotational velocity of the device around the X, Y, and Z axes. It has a programmable full-scale range of ±250°/s, ±500°/s, ±1000°/s, and ±2000°/s. The output data is in the form of 16-bit digital values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*T2VqyKuU1AWRqLzjMp_VZQ.png" /><figcaption>Source Google.com</figcaption></figure><h4><strong>MPU-6050 Pinout</strong></h4><ul><li><strong>Vin</strong> — this is the power pin. Since the sensor chip uses 3 VDC, we have included a voltage regulator on board that will take 3–5VDC and safely convert it down. To power the board, give it the same power as the logic level of your microcontroller — e.g. for a 5V microcontroller like Arduino, use 5V</li><li><strong>GND</strong> — common ground for power and logic</li><li><strong>SCL </strong>— I2C clock pin, connect to your microcontroller’s I2C clock line. This pin is level shifted so you can use 3–5V logic, and there’s a <strong>10K pullup</strong> on this pin.</li><li><strong>SDA </strong>-I2C data pin, connect to your microcontroller’s I2C data line. This pin is level shifted so you can use 3–5V logic, and there’s a 1<strong>0K pullup</strong> on this pin.</li><li><strong>INT </strong>-This is the interrupt pin. You can set up the MPU-6050 to pull this low when certain conditions are met such as new measurement data being available.</li><li><strong>AD0</strong> — I2C Address pin. Pulling this pin high or bridging the solder jumper on the back will change the I2C address from <strong>0x68</strong> to <strong>0x69</strong></li><li><strong>FS, SCE, SDE, CLKIN</strong> — Pins for advanced users to connect the MPU-6050 to another sensor.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*GjI6NkQQuqilQ_9K7KRmhg.jpeg" /><figcaption>Source: google.com</figcaption></figure><h4><strong>Block Diagram</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*n6cSVhLt3g2MNKys_vY-eg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*C58UlLAUvahQiwpCi1Fleg.jpeg" /><figcaption>Source: google.com</figcaption></figure><h3>MPU-6050 Key Features</h3><ul><li>Built-in I2C sensor bus which is used to provide gyroscope, accelerometer, and temperature sensor data to other devices such as microcontrollers.</li><li>Onboard pull-up resistor so we do not need to connect external pull resistors which are a requirement for the I2C bus interface.</li><li>User Programmable gyroscope and accelerometer with the help of 16-bit analog to digital converter.</li><li>1024 Byte FIFO buffer to provide data to the connected microcontroller in high speed and enters the low power mode afterwards.</li><li>Built-in temperature sensor.</li></ul><h4><strong>How access MPU-6050 using ESP32</strong></h4><p>We have already seen the pin configuration of the MPU 6050. Now we will see how we can gather 6 axis data using ESP32 and MPU6050.</p><p>Communication between ESP32 and MPU6050 is happen using I2C protocol. It is half duplex communication protocol. In which poly two wires are involved for the exchange of the data. I2C protocol is mostly used for the short range of communication.</p><p><strong>Serial Data (SDA) </strong>— Transfer of data takes place through this pin.<br><strong>Serial Clock (SCL) </strong>— It carries the clock signal</p><p>For more information about I2C protocols you can go through my communication protocols blog.</p><p>The I2C protocol has a number of advantages, including:</p><ul><li>It is a simple and easy-to-implement protocol.</li><li>It is a low-cost protocol, requiring only two wires to communicate.</li><li>It is a versatile protocol that can be used to communicate with a wide variety of devices.</li><li>It is a scalable protocol that can support up to 127 devices on a single bus.</li></ul><h4><strong>Circuit Diagram</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*p2sdArSR9rjHY3Au2WaJnQ.png" /><figcaption>Source: google.com</figcaption></figure><h4><strong>Pin Connection</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*aUebbIePdah5ZjOASnzl4w.png" /></figure><h4>Programming for MPU-6050</h4><p>Programming the MPU 6050 using esp32 there are two ways. In which we can use the Adafruit library and other using raw code. So, if you want to use adafruit library then I am sharing the link with in which you will find the step process.</p><p><a href="https://randomnerdtutorials.com/esp32-mpu-6050-accelerometer-gyroscope-arduino/">ESP32 MPU-6050 Accelerometer and Gyroscope (Arduino) | Random Nerd Tutorials</a></p><p>I prefer another way which is by using the raw code. In which we will get the raw data rather than process data. On raw data you can do any data process.</p><pre>#include&lt;Wire.h&gt;<br><br>const int MPU_ADDR = 0x68; // I2C address of the MPU-6050<br>int16_t AcX, AcY, AcZ, Tmp, GyX, GyY, GyZ;<br><br>void setup() {<br>   Serial.begin(115200);<br>   Wire.begin(21, 22, 100000); // sda, scl, clock speed<br>   Wire.beginTransmission(MPU_ADDR);<br>   Wire.write(0x6B);  // PWR_MGMT_1 register<br>   Wire.write(0);     // set to zero (wakes up the MPU−6050)<br>   Wire.endTransmission(true);<br>   Serial.println(&quot;Setup complete&quot;);<br>}<br><br>void loop() {<br>   Wire.beginTransmission(MPU_ADDR);<br>   Wire.write(0x3B);  // starting with register 0x3B (ACCEL_XOUT_H)<br>   Wire.endTransmission(true);<br>   Wire.beginTransmission(MPU_ADDR);<br>   Wire.requestFrom(MPU_ADDR, 14, true); // request a total of 14 registers<br>   AcX = Wire.read() −− 8 | Wire.read(); // 0x3B (ACCEL_XOUT_H) &amp; 0x3C (ACCEL_XOUT_L)<br>   AcY = Wire.read() −− 8 | Wire.read(); // 0x3D (ACCEL_YOUT_H) &amp; 0x3E (ACCEL_YOUT_L)<br>   AcZ = Wire.read() −− 8 | Wire.read(); // 0x3F (ACCEL_ZOUT_H) &amp; 0x40 (ACCEL_ZOUT_L)<br>   Tmp = Wire.read() −− 8 | Wire.read(); // 0x41 (TEMP_OUT_H) &amp;  0x42 (TEMP_OUT_L)<br>   GyX = Wire.read() −− 8 | Wire.read(); // 0x3B (ACCEL_XOUT_H) &amp; 0x3C (ACCEL_XOUT_L)<br>   GyY = Wire.read() −− 8 | Wire.read(); // 0x3D (ACCEL_YOUT_H) &amp; 0x3E (ACCEL_YOUT_L)<br>   GyZ = Wire.read() −− 8 | Wire.read(); // 0x3F (ACCEL_ZOUT_H) &amp; 0x40 (ACCEL_ZOUT_L)<br><br><br>   Serial.print(AcX); Serial.print(&quot; , &quot;);<br>   Serial.print(AcY); Serial.print(&quot; , &quot;);<br>   Serial.print(AcZ); Serial.print(&quot; , &quot;);<br>   Serial.print(GyX); Serial.print(&quot; , &quot;);<br>   Serial.print(GyY); Serial.print(&quot; , &quot;);<br>   Serial.print(GyZ); Serial.print(&quot;\n&quot;);<br>}</pre><p>These code for the 6- axis data gather using MPU6050. I have done multiple operations using this code and found some interesting results.</p><ol><li>Only with a 3-axis accelerometer will you get 1 kHz of frequency. For a single channel you will get 2.4 kHz of frequency. Above this frequency you will get the data but the data with repeated values. One more thing I would like to add, if the length of the connecting wires is above 1m then the results will be different.</li><li>Only with a 3- axis gyroscope will you get 4 kHz of frequency. For a single channel you will get 7.2kHz of frequency. Above this frequency you will get the data but the data with repeated values. One more thing I would like to add, if the length of the connecting wires is above 1m then the results will be different.</li><li>If you gather all 6-axis channel data together then the frequency you will get is 1kHz. Here also connecting wires length not more than 1 m condition is applied.</li></ol><p>For more information you can go through the data sheet. Here I am sharing the link of the data sheet.</p><p><a href="https://invensense.tdk.com/wp-content/uploads/2015/02/MPU-6000-Datasheet1.pdf">MPU-6000-Datasheet1.pdf (tdk.com)</a></p><h3>Application</h3><ol><li>Gyroscope and Accelerometer: The MPU-6050 can be used to measure angular velocity and acceleration. It’s commonly employed in applications that require motion detection, such as gaming controllers and virtual reality devices.</li><li>Inertial Measurement Units (IMUs): IMUs that consist of a combination of accelerometers and gyroscopes like the MPU-6050 are used in robotics, drones, and other autonomous systems to estimate orientation, track movement, and stabilize the device.</li><li>Motion Tracking: The MPU-6050 can be used for motion tracking and gesture recognition in applications like wearable devices and sports activity trackers.</li><li>Digital Pedometers: The accelerometer in the MPU-6050 can be used to count steps and track physical activity, making it suitable for fitness and health monitoring applications.</li><li>Quadcopters and Drones: MPU-6050 is used in quadcopters and drones for stabilization and attitude estimation. It helps keep the aircraft level and steady during flight.</li><li>Virtual Reality (VR) and Augmented Reality (AR): MPU-6050 can be used in VR and AR headsets to track the movement of the user’s head and provide a more immersive experience.</li><li>Gesture Control: It is employed in gesture control applications, such as controlling a computer or home automation devices with hand movements.</li><li>Electronic Compass: By combining the accelerometer and gyroscope data, the MPU-6050 can serve as an electronic compass, providing heading and orientation information for navigation systems.</li><li>Telemetry in Sports: It is used in sports equipment, such as golf clubs and tennis rackets, to measure and analyze performance data, including swing speed and motion patterns.</li><li>Vibration Monitoring: The accelerometer in the MPU-6050 can be used to monitor and analyze vibrations in industrial machinery, vehicles, and buildings for predictive maintenance and safety purposes.</li><li>Human-Machine Interfaces: The MPU-6050 can be used to create innovative human-machine interfaces, enabling control of machines or devices through body movements or gestures.</li><li>Research and Development: Researchers and hobbyists use the MPU-6050 for various projects, from robotics and autonomous vehicles to experiments in physics and biomechanics.</li></ol><h3>MPU 9250</h3><p>MPU-9250 is a multi-chip module (MCM) consisting of two dies integrated into a single QFN package. One die houses the 3-Axis gyroscope and the 3-Axis accelerometer. The other die houses the AK8963 3-Axis magnetometer from Asahi Kasei Microdevices Corporation. Hence, the MPU-9250 is a 9-axis Motion Tracking device that combines a 3-axis gyroscope, 3-axis accelerometer, 3-axis magnetometer and a Digital Motion Processor™ (DMP) all in a small 3x3x1mm package available as a pin-compatible upgrade from the MPU6515. With its dedicated I2C sensor bus, the MPU-9250 directly provides complete 9-axis Motion Fusion™ output. The MPU-9250 Motion Tracking device, with its 9-axis integration, on-chip Motion Fusion™, and runtime calibration firmware, enables manufacturers to eliminate the costly and complex selection, qualification, and system level integration of discrete devices, guaranteeing optimal motion performance for consumers. MPU-9250 is also designed to interface with multiple non-inertial digital sensors, such as pressure sensors, on its auxiliary I2C port.</p><h4><strong>Accelerometer</strong></h4><p>The MPU-9250 is able to measure acceleration using its on-chip accelerometer with four programmable full-scale ranges of ±2g, ±4g, ±8g and ±16g that can set. The integrated 16-bit ADCs simultaneously sample the 3 axes of movement (X, Y, Z). The X, Y and Z are relative to how the chip sits on the module as shown to the right and will ultimately be dependent on the orientation of the module in your project. Initial calibration tolerance is ±3% with non-linearity typically 0.5%.</p><h4><strong>Gyroscope</strong></h4><p>The MPU-9250 can measure rotation using its on-chip gyroscope with four programmable full-scale ranges of ±250°/s, ±500°/s, ±1000°/s and ±2000°/s that can be set by the user. The integrated 16-bit ADCs simultaneously sample the 3 axis of rotation around the X, Y and Z axes. The sample rate can be adjusted from 3.9 to 8000 samples per second. The axis of rotation is relative to the X, Y and Z shown to the right.</p><h4><strong>Magnetometer</strong></h4><p>The MPU-9250 chip includes the AK8963 magnetometer die that can measure compass direction that allows the device to know its orientation relative to the magnetic north similar to how a hand-held compass works. The integrated 16-bit ADCs simultaneously sample the 3 axis of movement (X, Y, Z). The axis are X, Y and Z are the same as shown to the right for the accel and gyro except that the Z-axis is reversed. +Z is in the direction going down toward earth.</p><h4><strong>Temperature</strong></h4><p>The MPU-9250 can measure temperature over the range of -40 to 85°C. The measurement is of the diet itself and will typically be near ambient. This temperature can be used to offset the calibration of the accelerometer, gyroscope and magnetometer or can provide a general indication of the ambient temperature and temperature changes. Accuracy is about ±1°Cover the entire range.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/332/1*LVJJRAH3zBBI5egcwkW8PA.jpeg" /></figure><p>We can access the MPU 9250 by using different networking protocols like I2C and SPI.</p><h4>Pin Configuration</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/1*7_SCJy3V3qJL-sQ3WE9F8w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/507/1*J0xnsSqa3rdHGf9DMstyqw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*6Q_yyaco5daGWBg5UO1Frw.jpeg" /></figure><h4><strong>Interfacing using I2C protocol</strong></h4><p>Communication between MPU 9250 and ESP32 we can do it by using I2C protocols. I2C supports two different addresses 0x68 and 0x69.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/1*x5n1l3EpOwr4J0zfFnNl_g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*E--i_E5IC_4KV_PHVbv0HQ.jpeg" /></figure><pre>#include &lt;Wire.h&gt;<br>#include &lt;MPU9250.h&gt;<br><br>MPU9250 imu;<br><br>void setup() {<br>  Wire.begin();<br>  Serial.begin(115200);<br>  <br>  imu.setWire(&amp;Wire);<br>  imu.begin();<br>  <br>  if (!imu.begin()) {<br>    Serial.println(&quot;Failed to initialize MPU-9250. Check your connections.&quot;);<br>    while (1);<br>  }<br>  <br>  imu.calibrateGyro();<br>  imu.setThreshold(3);<br>  <br>  Serial.println(&quot;MPU-9250 initialized and calibrated.&quot;);<br>}<br><br>void loop() {<br>  imu.readSensor();<br>  <br>  Serial.print(&quot;AccX: &quot;); Serial.print(imu.getAccX());<br>  Serial.print(&quot;  AccY: &quot;); Serial.print(imu.getAccY());<br>  Serial.print(&quot;  AccZ: &quot;); Serial.print(imu.getAccZ());<br>  Serial.print(&quot;  GyroX: &quot;); Serial.print(imu.getGyroX());<br>  Serial.print(&quot;  GyroY: &quot;); Serial.print(imu.getGyroY());<br>  Serial.print(&quot;  GyroZ: &quot;); Serial.print(imu.getGyroZ());<br>  Serial.print(&quot;  MagX: &quot;); Serial.print(imu.getMagX());<br>  Serial.print(&quot;  MagY: &quot;); Serial.print(imu.getMagY());<br>  Serial.print(&quot;  MagZ: &quot;); Serial.println(imu.getMagZ());<br>  <br>  delay(1000);<br>}</pre><p>The maximum frequency you can get with an ESP32 and MPU9250 is 1000 Hz for the gyroscope and accelerometer, and 100 Hz for the magnetometer.</p><h3><strong>Interfacing using SPI protocol</strong></h3><p>Interfacing an ESP32 with an MPU-9250 using the SPI (Serial Peripheral Interface) protocol is possible, but it’s a bit more complex compared to using I2C.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*WKim_AjzMVLMsa-ywJK-cQ.png" /></figure><p>The CS pin is optional, but it is recommended to use it to avoid conflicts with other devices on the SPI bus. Once the connections are made, you can use the ESP32 to read and write data to the MPU-9250 using SPI. The MPU-9250 library for ESP32 provides a high-level interface to the sensor, making it easy to read and write data from the sensor.</p><pre>#include &lt;Wire.h&gt;<br>#include &lt;MPU9250.h&gt;<br><br>#define MPU_CS 5<br>#define MPU_INT 14<br><br>MPU9250 mpu9250(MPU_CS, MPU_INT);<br><br>void setup() {<br>  Serial.begin(115200);<br>  mpu9250.initialize();<br>}<br><br>void loop() {<br>  // Read the accelerometer data<br>  float ax, ay, az;<br>  mpu9250.readAccelerometer(ax, ay, az);<br><br>  // Read the gyroscope data<br>  float gx, gy, gz;<br>  mpu9250.readGyroscope(gx, gy, gz);<br><br>  // Read the magnetometer data<br>  float mx, my, mz;<br>  mpu9250.readMagnetometer(mx, my, mz);<br><br>  // Print the sensor data to the serial port<br>  Serial.print(&quot;ax = &quot;);<br>  Serial.print(ax);<br>  Serial.print(&quot;, ay = &quot;);<br>  Serial.print(ay);<br>  Serial.print(&quot;, az = &quot;);<br>  Serial.println(az);<br><br>  Serial.print(&quot;gx = &quot;);<br>  Serial.print(gx);<br>  Serial.print(&quot;, gy = &quot;);<br>  Serial.print(gy);<br>  Serial.print(&quot;, gz = &quot;);<br>  Serial.println(gz);<br><br>  Serial.print(&quot;mx = &quot;);<br>  Serial.print(mx);<br>  Serial.print(&quot;, my = &quot;);<br>  Serial.print(my);<br>  Serial.print(&quot;, mz = &quot;);<br>  Serial.println(mz);<br><br>  delay(100);<br></pre><p>As compared to the I2C protocol we will get the Higher frequency by using SPI protocol. Here we will get 4 kHz accelerometer frequency, 8 kHz gyroscope frequency and 100 Hz magnetometer. The result may change according to the condition and controller.</p><h4>observation</h4><ul><li>I2C is ideal for projects with limited pins and where multiple devices need to share a single bus, but it might not be the best choice for high-speed applications.</li><li>SPI is suitable for projects requiring fast data transfer, precise timing, and full-duplex communication but may be more complex and require additional pins. It is typically used when connecting a single master to one or more slave devices.</li></ul><h4><strong>Application of MPU 9250</strong></h4><ol><li>Inertial Measurement Units (IMUs): The MPU-9250 is used as a key component in IMUs to measure orientation, acceleration, and angular velocity. It is used in robotics, drones, and other autonomous systems for motion tracking and orientation estimation.</li><li>Navigation and Positioning: It can be used for dead reckoning in navigation systems, indoor positioning, and vehicle tracking. Combining accelerometer and gyroscope data with magnetometer readings can provide heading information.</li><li>Augmented Reality (AR) and Virtual Reality (VR): MPU-9250 sensors are used in AR and VR headsets to track head movement and provide an immersive experience.</li><li>Motion Capture and Animation: The sensor can be used in motion capture systems to track the movement of human or animal subjects for animation, biomechanics, and sports analysis.</li><li>Gaming Controllers: The MPU-9250 is employed in gaming controllers to detect user movements and gestures, providing a more interactive gaming experience.</li><li>Wearable Devices: It’s used in wearable technology like smartwatches and fitness trackers to measure activity, orientation, and detect motion.</li><li>Gesture Recognition: The sensor can be used to detect and recognize hand and body gestures for controlling various devices and applications.</li><li>Stabilization and Gimbal Control: Drones, cameras, and gimbals use the MPU-9250 for stabilization and smooth control of pitch, roll, and yaw.</li><li>Indoor Navigation: In combination with Wi-Fi or other positioning systems, the MPU-9250 can be used for indoor navigation and localization.</li><li>IoT Devices: It’s used in IoT (Internet of Things) applications for detecting motion, orientation, and magnetic field data in smart home and industrial automation.</li><li>Vibration and Impact Monitoring: In industrial settings, the MPU-9250 can be used to monitor and analyze vibrations and impacts in machinery and structures for predictive maintenance.</li><li>Geophysical Surveys: The magnetometer in the MPU-9250 can be used in geophysical surveys for measuring changes in the Earth’s magnetic field, useful in geological and environmental studies.</li><li>Aerospace and Satellite Applications: It can be used in aerospace applications, such as cubesat and small satellite missions, to assist in attitude control and orientation determination.</li><li>Health Monitoring: In healthcare, it can be used for monitoring patient movement and posture, especially in applications related to physical therapy and rehabilitation.</li><li>Research and Prototyping: Researchers, hobbyists, and students use the MPU-9250 for various projects in areas such as robotics, physics, and sensor fusion research.</li></ol><h3>Comparison Between MPU 6050 and MPU 9250</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AuPecgBab-HLkCbj0Xs0VQ.png" /></figure><h4>Advantages of MPU-9250 over MPU-6050</h4><ul><li>Magnetometer for compass heading measurement</li><li>Lower noise floor for more accurate sensor data</li><li>Wider supply voltage range for more versatility</li></ul><blockquote><strong>Thank you so much for taking the time to read my blog!</strong><br>I truly appreciate your interest. I’m currently exploring opportunities for collaboration in <strong>Research and Development</strong> across the fields of <strong>Internet of Things (IoT)</strong>, <strong>Embedded Systems</strong>, and <strong>Machine Learning</strong>.</blockquote><blockquote>If you’re working in these areas or have a shared interest, I’d love to connect and explore how we can collaborate.<br>Feel free to reach out to me on <a href="https://www.linkedin.com/in/aniketfasate27/">LinkedIn.</a></blockquote><blockquote>Looking forward to meaningful connections and innovative projects!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e86467e9a237" width="1" height="1" alt=""><hr><p><a href="https://medium.com/embedded-connected-avinya-intelligence/motion-sensors-mpu-6050-and-mpu9250-e86467e9a237">Motion Sensors: MPU-6050 and MPU-9250</a> was originally published in <a href="https://medium.com/embedded-connected-avinya-intelligence">Embedded &amp; Connected</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“Navigating Key Development Methodologies: Bottom-up, Top-down, Meet-in-the-middle, and Platform”]]></title>
            <link>https://medium.com/embedded-connected-avinya-intelligence/navigating-key-development-methodologies-bottom-up-top-down-meet-in-the-middle-and-platform-d08242e6f432?source=rss----e2b5ee04f7c7---4</link>
            <guid isPermaLink="false">https://medium.com/p/d08242e6f432</guid>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[electronics]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[internet-of-things]]></category>
            <dc:creator><![CDATA[Aniket Fasate]]></dc:creator>
            <pubDate>Thu, 10 Jul 2025 18:16:50 GMT</pubDate>
            <atom:updated>2025-06-08T17:47:16.249Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QHNm-nn1Gh1-uY-WCVYFDQ.png" /><figcaption>Author generated image using GenAI</figcaption></figure><p>Modern Software development — and product development in general require structured methodologies to manage complexity, ensure quality, and deliver on time. Four such methodologies commonly discussed are Bottom-up, Top-down, Meet-in-the-Middle, and Platform-based approaches. Each has its own strengths, weaknesses, and ideal use cases. In this blog, we will explore each approach in detail and help you decide which might best fit the needs of your project.</p><blockquote><strong>The Bottom-up Approach</strong></blockquote><p><strong>Understanding Bottom-up<br></strong>The Bottom-up design (or development) approach starts with smaller components or modules. These individual parts — often self-contained and reusable — are built independently and then integrated into large subsystems. Eventually, they all come together to form the final project.</p><p><strong>Key Characteristics:</strong></p><ol><li>Component-focused: Emphasizes creating detailed and robust modules.</li><li>Reusability: Encourages writing code or creating components that can be reused across different parts of the system ( or even different projects).</li><li>Early and incremental Testing: Since modules are built in isolation, they can be tested early and often.</li><li>Emergent Behavior: The overall system behavior emerges when modules are integrated — this is where unforeseen interactions can surface.</li></ol><p><strong>Pros:</strong></p><ol><li>Modularity and Reusability: A strong modular design can save time in future projects.</li><li>Early Bug Detection: Components are tested independently, allowing you to catch errors long before final integration.</li><li>Flexibility: Changes in one module do not necessarily disrupt the entire system.</li></ol><p><strong>Cons:</strong></p><ol><li>Integration Complexities: Bringing everything together near the end can reveal compatibility or architectural issues.</li><li>Loss of Big Picture: Focusing too intensely on small pieces might overshadow broader system requirements early on.</li></ol><p><strong>Typical Use Cases:</strong></p><ol><li>Library/Framework Development: Building highly reusable components for multiple applications.</li><li>Agile, Iterative projects: Teams can handle individual features or modules, then plug them into a cohesive product.</li></ol><pre>                         +-------------------+<br>                         |    Final App      |<br>                         +-------------------+<br>                                 ^<br>                                 |<br>                         +-------------------+<br>                         |   Integration     |<br>                         +-------------------+<br>                                 ^<br>                                 |<br>                +----------------+----------------+<br>                |                                 |<br>       +-------------------+             +-------------------+<br>       |   Subsystem A     |             |   Subsystem B     |<br>       +-------------------+             +-------------------+<br>                 ^     ^                           ^     ^<br>                 |     |                           |     |<br>           +---------+ +---------+           +---------+ +---------+<br>           |  M1.1   | |  M1.2   |           |  M2.1   | |  M2.2   |<br>           +---------+ +---------+           +---------+ +---------+</pre><blockquote><strong>The Top — down Approach</strong></blockquote><p><strong>Understanding Top-down<br></strong>Top-down designs is the classic big-picture-first methodology. You begin by defining high-level system requirements and architecture. Once the overall structure is laid out, you gradually decompose it into smaller subsystems, modules, or features.</p><p><strong><em>Key Characteristics</em></strong></p><ol><li>Holistic Planning: Establishes an overarching blueprint early on.</li><li>Hierarchy of Subsystems: Breaks the system into major subsystems, then dives deeper into details design.</li><li>Vision-driven: Ensures the final product aligns with strategic goals and requirements from the outset.</li></ol><p><strong><em>Pros</em></strong></p><ol><li>Clear Vision: You have a well-defined roadmap for the entire system, which can align all stakeholders.</li><li>System-wide Consistency: Architectural decisions are made upfront, reducing duplicated effort and incompatible designs.</li><li>Better at Handling Complex Requirements: Large-scale enterprise systems often require thorough planning to mitigate risks.</li></ol><p><strong><em>Cons</em></strong></p><ol><li>Risk of Over-engineering: A detailed upfront design may overcomplicate solutions, especially if requirements change.</li><li>Long Initial Phase: You might spend a significant amount of time designing before any tangible product emerges.</li><li>Less Adaptive: If major changes come in mind-development, reworking the top-down plan can be costly.</li></ol><p><strong>Typical Use Cases</strong></p><ol><li>Enterprise-level Systems: Banking, healthcare, or mission-critical applications with strict requirements.</li><li>Waterfall-like Environments: Where requirements are set in stone early and changes are minimal.</li></ol><pre>                        +-----------------------------------+<br>                        |  High-Level Goals &amp; Requirements   |<br>                        +-----------------------------------+<br>                                      |<br>                                      v<br>                        +-----------------------------------+<br>                        |   System Design &amp; Architecture     |<br>                        +-----------------------------------+<br>                                      |<br>                                      v<br>                  +-------------------+-------------------+<br>                  |                                       |<br>        +----------------------+                  +----------------------+<br>        |   Subsystem A        |                  |   Subsystem B        |<br>        |  (Detailed design)   |                  |  (Detailed design)   |<br>        +----------------------+                  +----------------------+<br>                  |                                       |<br>                  v                                       v<br>        +----------------------+                  +----------------------+<br>        |   Modules A1, A2    |                  |   Modules B1, B2     |<br>        |  (Further breakdown)|                  |  (Further breakdown) |<br>        +----------------------+                  +----------------------+<br>                  |                                       |<br>                  +-------------------+--------------------+<br>                                      |<br>                                      v<br>                           +--------------------------+<br>                           |   Implementation &amp; Test  |<br>                           +--------------------------+<br>                                      |<br>                                      v<br>                           +--------------------------+<br>                           |      Final System        |<br>                           +--------------------------+</pre><blockquote><strong>The Meet-in-the-miiddle Approcach</strong></blockquote><p><strong>Understanding Meet-in-the-middle<br></strong>Meet-in-the-middle sometimes referred to as middle-out-is a hybrid approach that merges the best of both Top-down and Bottom-up. here, you define broad architectural guidelines(top-down) and, in parallel, build individual components (bottom-up). These two development streams repeatedly sync up to refine and adjust the design.</p><p><strong><em>Key Characteristics</em></strong></p><ol><li><strong>Iterative Collaboration: </strong>High-level architecture and low-level components evolve together through constant feedback.</li><li>Balance View: Strikes a compromise between detailed component development and overall system design.</li><li>Adaptive: If a low-level module exposes new constraints, the architecture can be updated causing major disruptions.</li></ol><p><strong><em>Pros</em></strong></p><ol><li><strong>Early Prototyping:</strong> You can quickly build parts of the system even while the overall architecture is still in flux.</li><li><strong>Reduced Risk at integration:</strong> Frequent alignment means fewer surprises when combining different pieces.</li><li><strong>Highly Flexible: </strong>Adapts better to changing requirements than a strictly top-down approach.</li></ol><p><strong><em>Cons</em></strong></p><ol><li>Requires Strong Coordination: Communication between architects (top-down) and engineers (bottom-up) is critical.</li><li>Skilled Teams Needed: This approach demands team members who can efficiently manage dependencies and complexities.</li></ol><p><strong>Typical Use Cases</strong></p><ol><li>Rapidly Evolving Products: Startups or agile teams that anticipate frequent pivots.</li><li>Complex Software Projects: Large systems that benefit from both strategic vision and modular incremental development.</li></ol><pre>                      +---------------------------------+<br>                      |    High-Level System Design     |<br>                      |  (Overall Architecture &amp; Goals) |<br>                      +---------------------------------+<br>                                 |          <br>                          (Top-down guidance)<br>                                 |<br>                +----------------+----------------+<br>                |                                 |<br>                v                                 v<br>         +----------------+               +----------------+<br>         | Subsystem A    |               | Subsystem B    |<br>         | (Architectural |               | (Architectural |<br>         |  Breakdown)    |               |  Breakdown)    |<br>         +----------------+               +----------------+<br>                ^                                 ^<br>                |        (Middle Layer:           |<br>                |   Integration &amp; Feedback)       |<br>                v                                 v<br>         +----------------+               +----------------+<br>         |  Module A.1   |               |  Module B.1   |<br>         | (Bottom-up    |               | (Bottom-up    |<br>         |  Implementation)              |  Implementation)<br>         +----------------+               +----------------+<br>                |                                 |<br>                v                                 v<br>         +----------------+               +----------------+<br>         |  Module A.2   |               |  Module B.2   |<br>         | (Bottom-up    |               | (Bottom-up    |<br>         |  Implementation)              |  Implementation)<br>         +----------------+               +----------------+<br><br></pre><blockquote><strong>Platform-based Approach</strong></blockquote><p>Understanding Platform-based Methodology<br>The platform-based methodology focuses on creating or leveraging a platform a functional layer that provides reusable services, frameworks, or APIs upon which you build various applications or services. These platforms often standardize essential features like authentication, data storage, messaging, and more.</p><p><strong>Key Characteristics</strong></p><ol><li>Core services and Libraries: The Platform hosts shared functionalities (e.g Logging, payment, user management)</li><li>Extensibility: A well-defined interface (API/SDK) allows developers to innovate without rebuilding the core.</li><li>Standardization: Centralizes best practices and ensures consistent implementations across multiple products.</li></ol><p><strong>Pros</strong></p><ol><li>Accelerated Development: By relying on existing platform services, teams can focus on unique business logic instead or reinventing the wheel.</li><li>Consistency and Quality: Centralized updates and governance mean improvements or fixes benefit all platform consumers simultaneously.</li><li>Scalability: As the business grows, the platform can expand its services efficiently.</li></ol><p><strong>Cons</strong></p><ol><li>Initial Investment: Building a robust platform requires significant upfront resources.</li><li>Single Point Of Failure: If the problem has a major outage or bug, all documentation can become a considerable task.</li></ol><p><strong>Typical Use Cases</strong></p><ol><li><strong>Cloud Platforms:</strong> AWS, Azure, and GCP offering compute, database, analytics, and more.</li><li><strong>Enterprise Platforms:</strong> Companies building an internal “app store” of core services for all business units.</li><li><strong>Microcservices Ecosystems:</strong> Where each service is a building block in a larger platform.</li></ol><pre>          +--------------------------------------------------+<br>          |                  Shared Platform                 |<br>          |--------------------------------------------------|<br>          |  Common Services:                                |<br>          |    • Authentication                              |<br>          |    • Data Storage / Database                     |<br>          |    • Logging &amp; Monitoring                        |<br>          |    • Messaging / Queueing                        |<br>          |    • Payment Processing                          |<br>          |    • API Gateway / Service Registry              |<br>          +--------------------------------------------------+<br>              ^               ^                      ^<br>              |               |                      |<br>      +-------+-------+   +---+---+              +---+---+<br>      |   Application |   |  Micro- |    ...     | Web    |<br>      |       A       |   | Service |            | Client |<br>      +---------------+   +---------+            +--------+</pre><blockquote><strong>Choosing the Right Methodology</strong></blockquote><p>With so many methodologies available, how do you decide which is best for your project? Here are a few guiding questions</p><ol><li>are your requirements stable or constantly evolving?</li></ol><ul><li><strong>Stable:</strong> A top-down approach or a detailed platform strategy might be suitable.</li><li><strong>Evolving:</strong> Bottom-up or meet-in-the-middle can better accommodate shifts mid-project.</li></ul><p>2. How large and distributed is your team?</p><ul><li><strong>Large and distributed:</strong> A meet-in-the-middle or platform-based approach can help manage complexity and maintain consistency.</li><li><strong>Smaller/Focused: </strong>Bottom-up or top-down can be simpler to coordinate with a small centralized team.</li></ul><p>3. Do you need to build reusable components across multiple projects?</p><ul><li>if yes, consider a platform approach to centralize common functionalities.</li><li>if not, a simpler bottom-up approach for a one-off product might suffice.</li></ul><p>4. What is your timeline and budget?</p><ul><li><strong>Short timeline:</strong> A bottom-up approach may yield faster results in the early stages.</li><li><strong>Longer Timeline: </strong>A tip-down or platform approach can ensure a scalable, well-structured solution over time.</li></ul><blockquote><strong>Final Thoughts</strong></blockquote><p>Each Methodology- bottom-up, Top-down, Meet-in-the-middle, and Platform-based comes with trade-offs that shape your project&#39;s architecture, time-to-market, and long-term maintainability. In many real-world scenarios, you will use a blend of these strategies to adapt to evolving requirements, resource constraints, and team dynamics.</p><ul><li><strong>Bottom-up</strong> shines when building robust, reusable modules.</li><li><strong>Top-down</strong> ensures you never lose sight of the bigger picture.</li><li><strong>Meet-in-the-middle</strong> merges the strengths of both, offering flexibility and architectural coherence.</li><li><strong>Platform-based</strong> development helps establish a reusable foundation, accelerating future projects and ensuring consistency.</li></ul><blockquote><strong>Refrences</strong></blockquote><ul><li><em>Software Architecture in Practice</em> (3rd Edition) by Len Bass, Paul Clements, and Rick Kazman (Addison-Wesley, 2012)</li><li><em>Fundamentals of Software Architecture: An Engineering Approach</em> by Mark Richards and Neal Ford (O’Reilly, 2020)</li><li><em>The Mythical Man-Month: Essays on Software Engineering</em> by Frederick P. Brooks Jr. (Addison-Wesley, 1995)</li><li><em>Clean Architecture: A Craftsman’s Guide to Software Structure and Design</em> by Robert C. Martin (Pearson, 2017)</li><li><em>Software Engineering</em> (10th Edition) by Ian Sommerville (Pearson, 2015) — Discusses top-down vs. bottom-up approaches and other SDLC models in detail.</li><li><em>The Mythical Man-Month: Essays on Software Engineering</em> by Frederick P. Brooks Jr. (Addison-Wesley, 1995)</li><li><a href="https://www.geeksforgeeks.org/difference-between-bottom-up-model-and-top-down-model/">Difference between Bottom-Up Model and Top-Down Model — GeeksforGeeks</a></li></ul><p><strong>Thank you so much for taking the time to read my blog!</strong><br>I truly appreciate your interest. I’m currently exploring opportunities for collaboration in <strong>Research and Development</strong> across the fields of <strong>Internet of Things (IoT)</strong>, <strong>Embedded Systems</strong>, and <strong>Machine Learning</strong>.</p><p>If you’re working in these areas or have a shared interest, I’d love to connect and explore how we can collaborate.<br>Feel free to reach out to me on <a href="https://www.linkedin.com/in/aniketfasate27/">LinkedIn.</a></p><p>Looking forward to meaningful connections and innovative projects!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d08242e6f432" width="1" height="1" alt=""><hr><p><a href="https://medium.com/embedded-connected-avinya-intelligence/navigating-key-development-methodologies-bottom-up-top-down-meet-in-the-middle-and-platform-d08242e6f432">“Navigating Key Development Methodologies: Bottom-up, Top-down, Meet-in-the-middle, and Platform”</a> was originally published in <a href="https://medium.com/embedded-connected-avinya-intelligence">Embedded &amp; Connected</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“Modeling vs. Programming: Navigating the Tools That Shape Our Digital World”]]></title>
            <link>https://medium.com/embedded-connected-avinya-intelligence/modeling-vs-programming-navigating-the-tools-that-shape-our-digital-world-de1ca3e17b91?source=rss----e2b5ee04f7c7---4</link>
            <guid isPermaLink="false">https://medium.com/p/de1ca3e17b91</guid>
            <category><![CDATA[embedded-systems]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[internet-of-things]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Aniket Fasate]]></dc:creator>
            <pubDate>Thu, 10 Jul 2025 18:15:43 GMT</pubDate>
            <atom:updated>2025-07-10T18:15:45.611Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tlloqvZjH-TG6XkxqLcfdw.png" /><figcaption>Author generated image using AI</figcaption></figure><p>In the vast landscape of technology and design, two tools stands as pillars of innovation: modeling and programming languages. Each serves a unique purpose, from abstracting complexities to implementing tangible solutions. This post deleves into these essential tools, highlighting their deifference and interconnected roles.</p><blockquote><strong>What is modeling?</strong></blockquote><p>Imagine you are an architetc. Before the first brick is laid, you need a blue print. This is what modling does for engineers and designers — it creates a blueprint of complex systems. By representing parts of reality in simpler, manageable forms, modeling allows for experimentation and simulation without the cost or risk of real world consequences.</p><p><strong><em>Purpose of Modeling: <br>* Risk Reduction: </em></strong>Testing design virtually to avoid costly errors during physical production. <br>* <strong><em>Efficiency: Allows</em></strong> for rapid prototyping and iteration, adapting design quickly based on results from model testing.</p><p><strong><em>Tools and Scenarios for Modeling:<br>* Matlab/Simulink: </em></strong>A favorite in academia and industry for it robust capabilities in simulating dynamic and designing control algorithms. <br>* <strong><em>CAD Software: </em></strong>Essential in mechanical engineering for visualizing in three dimensions allowing for detailed examination before manufacturing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*qRdMxCCem4UsoJXZ2dXCTg.jpeg" /><figcaption>source: google.com</figcaption></figure><blockquote><strong>What is Programming languages?</strong></blockquote><p>While a model might show you that could happen in theory, programming lanaguages are all about action — they make things happen . These languages are the builders, turning the ‘blueprints’ from models into operational software and systems.</p><p><strong><em>Uses of Programming Languages: <br>* Software Developement: </em></strong>From apps on your phone to complex operating systems. <br>* <strong><em>System Control: </em></strong>Diurectly controlling hardware, like robots or smart devices, to perform specific tasks.</p><p><strong><em>Examples<br>* Python: </em></strong>Celebrated for its simplicity and versatility in task ranging from web development to machine learning. <br>* <strong><em>C++: </em></strong>Known for its power in performance crittical applications like game development or systems programming.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WWyKN8jjLzjWd9yeNyeS9A.png" /><figcaption>Source: google.com</figcaption></figure><blockquote><strong>Key Difference between modeling and programming Languages</strong></blockquote><p><strong><em>Focus Areas: <br>* Modeling: </em></strong>Thinks about possibilities, focusing on abstract simulations and predications. <br> * <strong><em>Programming : </em></strong>Deals with realities, focusing on concrete implementations and operations.</p><p><strong><em>Tools and Applications:<br>* Modeling Tools: </em></strong>Specialized applications like ANSYS for physical simulations, or Revit for building information modeling. <br>* <strong><em>Programming Tools:</em></strong> Integrated development environments (IDE’S) Like Eclipse or visual Studio, which help developers write, test, and deploy code.</p><p><strong><em>Outcomes:<br>* Modeling: </em></strong>Aims<strong><em> </em></strong>to predict and optimize, often used in testing and planning stages.<br>* Programming: Aims to execute and operate, turning theoretical models into real world applications.</p><p><strong><em>Why Both are Essential: </em></strong><br>The synergy between modeling and programming is where true innovations blossoms. Modeling provides a sandbox to foresee and enhance the behavior of systems under various conditions. Programming brings these enhancements to life, ensuring they perform as intended in their final form.</p><p><strong><em>Interdependence Example: <br>* Aerospace: </em></strong>Models simulate flight conditions that programing then uses to ensure aircraft operate safely under those conditions. <br>* <strong><em>Automotive:</em></strong> Crash simulations via models inform the programming of in-car safety systems, directly impacting vehicle design and passenger safety.</p><p><strong><em>Conclusion:<br></em></strong>The dance between modeling and programming is intricate. While modeling maps out potential realities, programming breathes life into these visions, creating the tangible technologies that shape our world. Understanding both fields not only enrich not only enriches your technical prowess but also broadens your impact on future innovations.</p><blockquote><strong>Thank you so much for taking the time to read my blog!</strong><br>I truly appreciate your interest. I’m currently exploring opportunities for collaboration in <strong>Research and Development</strong> across the fields of <strong>Internet of Things (IoT)</strong>, <strong>Embedded Systems</strong>, and <strong>Machine Learning</strong>.</blockquote><blockquote>If you’re working in these areas or have a shared interest, I’d love to connect and explore how we can collaborate.<br>Feel free to reach out to me on <a href="https://www.linkedin.com/in/aniketfasate27/">LinkedIn.</a></blockquote><blockquote>Looking forward to meaningful connections and innovative projects!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de1ca3e17b91" width="1" height="1" alt=""><hr><p><a href="https://medium.com/embedded-connected-avinya-intelligence/modeling-vs-programming-navigating-the-tools-that-shape-our-digital-world-de1ca3e17b91">“Modeling vs. Programming: Navigating the Tools That Shape Our Digital World”</a> was originally published in <a href="https://medium.com/embedded-connected-avinya-intelligence">Embedded &amp; Connected</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“PyTorch Gradients Demystified: A Step-by-Step Tutorial”]]></title>
            <link>https://medium.com/embedded-connected-avinya-intelligence/gradient-by-pytorch-99417440b7c5?source=rss----e2b5ee04f7c7---4</link>
            <guid isPermaLink="false">https://medium.com/p/99417440b7c5</guid>
            <dc:creator><![CDATA[Aniket Fasate]]></dc:creator>
            <pubDate>Fri, 27 Jun 2025 15:24:33 GMT</pubDate>
            <atom:updated>2025-06-08T19:14:20.225Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_mFa8q-HXsWSaIVAI_RTwA.png" /><figcaption>Autor generated Image using GenAI</figcaption></figure><p>The term “gradient” generally refers to the gradients used in deep learning models and neural networks. Gradients play a fundamental role in training AI models and optimizing their performance.</p><p>Deep learning models, including neural networks, are often trained using gradient-based optimization algorithms, such as stochastic gradient descent (SGD) or its variants. These algorithms utilize the gradients of a loss function with respect to the model’s parameters to update the parameters iteratively.</p><p>The loss function measures the discrepancy between the model’s predicted output and the desired output. The gradients of the loss function with respect to the model’s parameters, such as weights and biases, indicate the direction and magnitude of the changes needed to minimize the loss. By moving the parameters in the opposite direction of the gradients, the model gradually improves its predictions.</p><p>The gradients are typically computed through a process called backpropagation, which calculates the gradient of the loss function with respect to each parameter in the network. Backpropagation efficiently propagates the error from the output layer to the input layer, applying the chain rule of calculus to compute the gradients layer by layer.</p><p>In PyTorch, gradients are an integral part of automatic differentiation, which is a key feature provided by the framework. Automatic differentiation allows you to compute gradients of tensors with respect to other tensors, enabling efficient and convenient gradient-based optimization in neural network training.</p><p>PyTorch provides a mechanism called the `autograd` package for automatic differentiation. When you create a tensor in PyTorch and perform mathematical operations on it, PyTorch keeps track of the operations and builds a computational graph. This graph retains the history of operations, which is later used to compute the gradients.</p><p>To compute gradients using PyTorch, you need to enable gradient tracking for the tensors involved. This is typically done by setting the `requires_grad` attribute of a tensor to `True`.</p><pre>import torch<br>x = torch.randn(5, requires_grad=True)<br>print(x)<br>y = x + 2<br>print(y)<br><br>z = y*y*2 <br>z = z.mean() #for mean backward <br>print(z)<br><br><br>z.backward() #dz/dx<br># jacobin matrix with partial derivatives and the we multiply with gradeint vector.<br># Its also calle the chain rule <br>print(x.grad)<br># Sinc our Z is a scaler value we dont have to used agument here for the backward function.</pre><pre>tensor([-1.0328, -1.9608, -0.1143,  0.4928, -0.1418], requires_grad=True)<br>tensor([0.9672, 0.0392, 1.8857, 2.4928, 1.8582], grad_fn=&lt;AddBackward0&gt;)<br>tensor(5.6639, grad_fn=&lt;MeanBackward0&gt;)<br>tensor([0.7737, 0.0314, 1.5086, 1.9942, 1.4866])</pre><pre>#  If Z has more than one value<br>x = torch.randn(5, requires_grad=True)<br>print(x)<br>y = x + 2<br>print(y)<br><br>z = y*y*2<br>print(z)<br>v = torch.tensor([0.1, 1.0, 0.001,0.1,0.001], dtype=torch.float32) #<br>z.backward(v) #dz/dx<br>print(x.grad)<br></pre><pre>tensor([ 1.6220,  0.9297,  0.4727,  0.5040, -0.6454], requires_grad=True)<br>tensor([3.6220, 2.9297, 2.4727, 2.5040, 1.3546], grad_fn=&lt;AddBackward0&gt;)<br>tensor([26.2384, 17.1668, 12.2280, 12.5402,  3.6700], grad_fn=&lt;MulBackward0&gt;)<br>tensor([1.4488e+00, 1.1719e+01, 9.8906e-03, 1.0016e+00, 5.4185e-03])</pre><pre># how to prevent the pytorch to tracking the history and calculating the gredeint FM attribute<br># so some times during our training our lopp when we want to update our weights <br># then this operation should not be part of the gradeint computation<br><br>x = torch.randn(5, requires_grad=True)<br>print(x)<br><br>#we have three option to do <br># x.requires_grad_(False) #option 1<br># x.detach() #option 2<br># with torch.no_grad(): #option 3<br><br>x.requires_grad_(False)<br>print(x)<br><br>y = x.detach()<br>print(y)<br><br>with torch.no_grad():<br>    y = x + 2<br>    print(y)</pre><pre>tensor([-0.0779, -0.3162,  1.4544,  0.9580, -0.7873], requires_grad=True)<br>tensor([-0.0779, -0.3162,  1.4544,  0.9580, -0.7873])<br>tensor([-0.0779, -0.3162,  1.4544,  0.9580, -0.7873])<br>tensor([1.9221, 1.6838, 3.4544, 2.9580, 1.2127])</pre><pre># Creating Dummy training example <br>weights = torch.ones(4, requires_grad = True) #creating weights<br>for epoch in range(3): <br>    model_output = (weights*3).sum()<br><br>    model_output.backward()<br><br>    print(weights.grad)<br>    # training loop iteration of 1: tensor([3., 3., 3., 3.])<br>    # training loop iteration of 2: tensor([6., 6., 6., 6.])<br>    # training loop iteration of 3: tensor([9., 9., 9., 9.])<br>    # now our weights or our gradeints are clearly incorrect <br>    # so before doing the next iteration <br>    # We must empyt the gradeint<br><br>    weights.grad.zero_()</pre><pre>tensor([3., 3., 3., 3.])<br>tensor([3., 3., 3., 3.])<br>tensor([3., 3., 3., 3.])</pre><pre># Pytorch built in optimizer lets say we have the optimzer from the torch optimization<br>weights = torch.ones(4, requires_grad = True) #creating weights<br>optimizer = torch.optim.SGD(weights, lr=0.01)<br>optimizer.stop()<br>optimizer.zero_grad()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yLYRnVM0mOCr4eUEIXzd4A.jpeg" /></figure><blockquote><strong>Thank you so much for taking the time to read my blog!</strong><br>I truly appreciate your interest. I’m currently exploring opportunities for collaboration in <strong>Research and Development</strong> across the fields of <strong>Internet of Things (IoT)</strong>, <strong>Embedded Systems</strong>, and <strong>Machine Learning</strong>.</blockquote><blockquote>If you’re working in these areas or have a shared interest, I’d love to connect and explore how we can collaborate.<br>Feel free to reach out to me on <a href="https://www.linkedin.com/in/aniketfasate27/">LinkedIn.</a></blockquote><blockquote>Looking forward to meaningful connections and innovative projects!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=99417440b7c5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/embedded-connected-avinya-intelligence/gradient-by-pytorch-99417440b7c5">“PyTorch Gradients Demystified: A Step-by-Step Tutorial”</a> was originally published in <a href="https://medium.com/embedded-connected-avinya-intelligence">Embedded &amp; Connected</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>