High VoltagesAsim Zulfiqar
Published

Arduino Real-Time Plotting with MATLAB

Arduino and Python-based project that will help us read the sensor values and plot it on MATLAB.

BeginnerFull instructions provided1 hour36,341

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1

Software apps and online services

MATLAB
MATLAB

Story

Read more

Schematics

Circuit

Code

Matlab Code

MATLAB
clc

global a;

if ~isempty(instafind)
fclose(instrfind);
delete(instrfind);
end

% The above if-condition will help you find the COM port.

a= arduino();
%make "a" object of arduino

interv = 200;
%defining time

init_time = 1;
%initial time

x=0;

while (init_time<interv)
  b=readVoltage(a,'A0');
%reading voltages from pin A0 , reads voltages not adc value ,
%voltages = (ADC*5)/1024
  x=[x,b];
  plot(x)
  grid ON
  init_time=init_time+1;
  drawnow
end

%the above loop will run for 200 values, if you want to run it for more time change the interv value  
  

Credits

High Voltages

High Voltages

12 projects • 49 followers
High Voltages is all about electronics and computer engineering. We are skilled in the embedded system, IoT, Python, and circuit design.
Asim Zulfiqar

Asim Zulfiqar

11 projects • 28 followers

Comments