Effacer les filtres
Effacer les filtres

How to determine peaks of an analog signal from Arduino ?

1 vue (au cours des 30 derniers jours)
HARVIN RAJ
HARVIN RAJ le 13 Fév 2021
Modifié(e) : Shubham Khatri le 22 Fév 2021
Hi, I need help to read analog signal from a sensor connected to Arduino and then count the number of peaks of the analog signal. I want to display the number of peaks of the analog signal as it's output. How can I use MATLAB to determine the peaks of the analog signal and count the number of peaks for 1 minute (timer). Thank you.

Réponses (1)

Shubham Khatri
Shubham Khatri le 21 Fév 2021
Modifié(e) : Shubham Khatri le 22 Fév 2021
Hello,
You can read the signal from aurdino. I have attached the code below.
c=60;
while(c>0)
c=c-1;
readvalue = readvalue +1;
pause(1)
For index = 1:readvalue
analog(index) = readVoltage(a, 'A0');
Allvalues=analog(index) +Allvalues;
pause(0.1);
end
plot(index, Allvalues*5/1023)
yLabel('Volatge')
xLabel('time')
You can also visit the documentaion for readVoltage here.
To find the peaks within the signal you can use findpeak. For more information, please refer to the documentation link here.
Hope it helps

Catégories

En savoir plus sur Arduino Hardware dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by