TC
ToggleIn this complete tutorial, you will learn how to download and install MATLAB R2026a on Windows 11 from scratch — and then go further by building a real, working real-time IR sensor monitoring project using an Arduino UNO and MATLAB’s live plot capabilities.
This guide is perfect for engineering students, embedded systems beginners, and anyone who wants to use MATLAB as a powerful data visualization layer on top of physical sensors.
What you’ll have at the end: MATLAB R2026a fully installed and running on Windows 11, with a live graph showing your IR sensor readings in real time — all powered by an Arduino UNO.
Before downloading MATLAB R2026a, make sure your PC meets these minimum specifications:
Make sure Windows 11 is fully updated before installing MATLAB. Outdated system drivers can cause toolbox installation failures.
MathWorks provides MATLAB R2026a as a free trial or via institutional/student license. Follow these steps to download it officially:
Go to the official MathWorks website: mathworks.com → Click on “Get MATLAB” or “Try MATLAB” on the top menu.
Create a free MathWorks account (or sign in if you already have one). Students can use a university email for a free academic license.
Select your license type: Trial, Student, Home, or Professional. For beginners, the 30-day free trial includes all toolboxes.
Click “Download for Windows” — the installer file (approx. 1–2 GB) will begin downloading. Save it to your Downloads folder.
Pro Tip: If you’re a student, visit your university’s software portal first. Many universities provide MATLAB free of charge through MathWorks Campus licenses.
Once the installer is downloaded, follow these steps carefully for a clean installation:
Right-click the downloaded .exe installer and select “Run as Administrator” to avoid permission errors during setup.
The MathWorks installer will open. Sign in with your MathWorks account to validate your license automatically.
On the Product Selection screen, make sure to check: MATLAB, Simulink, Signal Processing Toolbox, and the MATLAB Support Package for Arduino Hardware.
Choose your install directory (default: C:\Program Files\MATLAB\R2026a) and click Begin Install. The installation takes 15–30 minutes depending on your connection.
When complete, click Finish. MATLAB will prompt you to activate your license — follow the on-screen activation wizard.
Launch MATLAB from the desktop shortcut. If it opens to the MATLAB Command Window, installation was successful! 🎉
Windows Defender alert? Click “More info” → “Run anyway”. The MathWorks installer is safe — Windows flags it because it’s a large unsigned executable from the internet.
For the real-time sensor monitoring project, gather the following components:
The IR sensor module has 3 pins: VCC, GND, and OUT. Connect them to your Arduino UNO as follows:
| IR Sensor Pin | Arduino UNO Pin | Wire Color (suggestion) |
|---|---|---|
| VCC (+) | 5V | 🔴 Red |
| GND (−) | GND | ⚫ Black |
| OUT (Signal) | Digital Pin 7 | 🟡 Yellow |
Double-check your connections before powering on. Reversing VCC and GND can permanently damage the IR sensor module.
Upload this sketch to your Arduino UNO using the Arduino IDE. It reads the IR sensor and sends the value over serial to MATLAB:
// IR Sensor Real-Time Monitoring for MATLAB // Schematic World — youtube.com/@SchematicWorld const int sensorPin = 7; // IR sensor OUT → Digital Pin 7 int sensorValue = 0; void setup() { Serial.begin(9600); // Match this in MATLAB pinMode(sensorPin, INPUT); } void loop() { sensorValue = digitalRead(sensorPin); Serial.println(sensorValue); // Send 0 or 1 to MATLAB delay(100); // 100ms = 10 readings/second }
The IR sensor outputs a LOW (0) signal when an object is detected in front of it, and a HIGH (1) signal when no object is detected. The Arduino reads this value every 100ms and sends it over the serial port at 9600 baud. MATLAB reads this stream and plots it in real time.
After uploading, open the Serial Monitor in Arduino IDE and set baud to 9600. You should see a stream of 0s and 1s. If yes — your wiring is correct and you’re ready for MATLAB!
Before running the MATLAB code, install the required support package and identify your COM port:
In MATLAB, go to Home → Add-Ons → Get Hardware Support Packages. Search for “MATLAB Support Package for Arduino Hardware” and install it.
Connect your Arduino UNO via USB. Open Device Manager on Windows → Ports (COM & LPT). Note your COM port number (e.g., COM4, COM5).
In MATLAB Command Window, type serialportlist to confirm MATLAB can see your Arduino’s port.
% Run this in MATLAB to confirm your COM port serialportlist % Expected output example: % ans = "COM4"
This is the main MATLAB script. It opens the serial port, reads IR sensor data from Arduino, and plots it as a live updating graph:
% ===================================================== % Real-Time IR Sensor Monitoring via Arduino + MATLAB % Schematic World — youtube.com/@SchematicWorld % ===================================================== %% 1. Setup Serial Connection clear; clc; close all; comPort = 'COM4'; % ← Change to YOUR COM port baudRate = 9600; s = serialport(comPort, baudRate); configureTerminator(s, 'LF'); disp('Serial port connected. Reading sensor...'); %% 2. Prepare Live Plot maxPoints = 100; % Scroll window size dataBuffer = zeros(1, maxPoints); timeBuffer = zeros(1, maxPoints); figure('Name', 'Real-Time IR Sensor — Schematic World', ... 'NumberTitle', 'off', 'Color', [0.05 0.07 0.12]); h = plot(timeBuffer, dataBuffer, '-o', ... 'Color', [0 0.78 1], ... 'LineWidth', 2, ... 'MarkerSize', 4); ylim([-0.2 1.2]); xlabel('Time (samples)'); ylabel('Sensor Output (0=Object / 1=Clear)'); title('IR Sensor Real-Time Data'); grid on; %% 3. Live Reading Loop t = 0; while true rawLine = readline(s); val = str2double(strtrim(rawLine)); if ~isnan(val) t = t + 1; dataBuffer = [dataBuffer(2:end), val]; timeBuffer = [timeBuffer(2:end), t]; h.XData = timeBuffer; h.YData = dataBuffer; xlim([timeBuffer(1), timeBuffer(end) + 1]); drawnow limitrate; end end % To stop: press Ctrl+C in MATLAB, then run: % clear s
Change COM port: On line 8, replace 'COM4' with your actual port number found in Device Manager (e.g., 'COM3', 'COM6'). Press Ctrl+C to stop the live loop.
Once both sketches are running, MATLAB will display a real-time scrolling graph of your IR sensor values:
Congratulations! If your graph is updating live — you have successfully completed the MATLAB R2026a installation AND the real-time Arduino sensor monitoring project. You can now extend this to analog sensors, temperature sensors, or multiple channels.
Serial port busy error: Close Arduino IDE’s Serial Monitor before running MATLAB — both cannot share the port simultaneously.
Graph not updating: Make sure drawnow limitrate is inside the loop and your baud rates match in both Arduino and MATLAB (9600).
NaN values appearing: Add a small delay in Arduino (delay(50)) and flush the buffer with flush(s) before the loop in MATLAB.
You’ve installed MATLAB R2026a on Windows 11 and built a complete real-time sensor monitoring project with Arduino. Share your results in the comments on YouTube!
Watch on Schematic World ↗