You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MicroDiff is a lightweight, hardware-integrated text analysis engine designed specifically for memory-constrained embedded systems. It performs real-time comparison of text strings (such as system configuration plans) using a highly optimized Longest Common Subsequence (LCS) algorithm.
5
9
6
-
Bridging the gap between theoretical computer science and bare-metal mechatronics, this system processes data with extreme memory efficiency and makes physical actuation decisions based on textual similarity percentages. This project was developed to demonstrate advanced algorithmic principles in applied engineering contexts as part of academic coursework at Amirkabir University of Technology.
10
+
Bridging the gap between theoretical computer science and bare-metal mechatronics, this system processes data with extreme memory efficiency and makes physical actuation decisions based on textual similarity percentages.
11
+
12
+
### 📺 Live Demo & Output
13
+
Here is the execution of the optimized engine running inside the Wokwi simulation environment, successfully analyzing file differences and triggering a mechatronic lock response:
14
+
15
+

7
16
8
17
## 🧠 Engineering Analysis: Space Optimization
9
-
The standard dynamic programming implementation of the LCS algorithm requires a 2D matrix, resulting in a space complexity of $O(m \times n)$. On a standard microcontroller with severely limited SRAM (e.g., 2KB), this approach immediately results in a stack overflow or memory crash for even moderately sized texts.
18
+
The standard dynamic programming implementation of the LCS algorithm requires a 2D matrix, resulting in a space complexity of `O(m * n)`. On a standard microcontroller with severely limited SRAM (e.g., 2KB), this approach immediately results in a stack overflow for large texts.
10
19
11
20
**The Solution:**
12
-
MicroDiff implements a bitwise space-optimized approach. By recognizing that the calculation only ever requires the current and previous rows of the DP matrix, the algorithm continuously toggles between two rows using bitwise AND (`i & 1`). This drastically reduces the memory footprint.
21
+
MicroDiff implements a bitwise space-optimized approach. By recognizing that the calculation only ever requires the current and previous rows of the DP matrix, the algorithm continuously toggles between two rows using bitwise AND (`i & 1`).
22
+
***Time Complexity:**`O(m * n)`
23
+
***Space Complexity:**`O(min(m, n))`
13
24
14
-
***Time Complexity:** $O(m \times n)$
15
-
***Space Complexity:** $O(\min(m, n))$
25
+
*Read the full mathematical breakdown in our [Algorithm Notes](docs/algorithm_notes.md).*
16
26
17
27
## ⚙️ Hardware Architecture
18
28
The system architecture relies on minimal GPIO usage by leveraging serial communication protocols.
19
-
20
29
***Processing Unit:** Arduino Uno (ATmega328P) showcasing aggressive memory management.
21
30
***Display Output:** 16x2 LCD operating over the **I2C protocol** to display analysis progress and match percentage.
22
31
***Physical Actuator:** PWM-controlled Servo Motor acting as a mechatronic gate/lock that physically reacts if the file variance exceeds a defined safety threshold.
23
-
***Data Pipeline:** Designed to read distinct data sets (e.g., `plan5` vs `plan6`).
24
32
25
33
## 📂 Repository Structure
26
34
*`src/`: Contains the core C++ logic (`main.ino`) featuring the optimized algorithm.
27
35
*`simulation/`: Includes the `diagram.json` mapping for rapid reproduction in Wokwi.
28
-
*`data/`: Sample text targets utilized for difference analysis.
29
-
*`docs/`: Project documentation and architecture details.
36
+
*`data/`: Sample text targets utilized for difference analysis (`plan5_en.txt`, `plan6_en.txt`).
37
+
*`docs/`: Project documentation, algorithmic notes, and architecture details.
30
38
31
39
## 🚀 How to Run (Simulation Environment)
32
40
You can deploy and test this system entirely in the cloud without physical hardware:
33
-
34
41
1. Clone this repository.
35
42
2. Open the [Wokwi Simulator](https://wokwi.com) and create a new Arduino project.
36
43
3. Replace the default code with the contents of `src/main.ino`.
@@ -39,4 +46,4 @@ You can deploy and test this system entirely in the cloud without physical hardw
39
46
6. Run the simulation to observe the text analysis, percentage calculation, and automated servo actuation.
40
47
41
48
---
42
-
*This repository reflects a deep interest in algorithm design, operating system resource constraints, and hardware-level execution.*
49
+
*Developed as part of academic coursework and research at **Amirkabir University of Technology**.*
0 commit comments