ESP NOW provided sensor datas to ESP32 and Matlab serial communication
25 次查看(过去 30 天)
显示 更早的评论
Hello,
I have a project in which im gathering RSSI values with different technologies, like UWB, 433 MHz radio signals and also ESP NOW protocol RSSI values. All my gathered datas are sent to an ESP32 via ESP NOW protocol and i'd like to send these datas towards my PC via serial communication, or anyting that could work. I tried to read the serial port many different ways and always the same error appears. I dont get any error messages, the datas simply dont arrive at the port, or the Matlab cant read them. The interesting part is, that sometimes a few data arreives at the port and i can read them, but this is a very rare event. In addition, my Matlab code works fine with simple Serial.print arduino codes without ESP NOW parts, the problem only appears if there is an ESP NOW receiving part in my code. I dont really know what the problem could be, but it seems to me like a data conversion issue, but dont know. I hope someone has already faced an issue like this and could help me solve this. If someone knows a solution in which there isnt any ESP NOW sending part and serial communication, just a ThingSpeak or a Webserver solution to send float datas, that could help me a lot too.
Here is my Matlab code:
clear all;
if ~isempty(instrfind)
fclose(instrfind);
delete(instrfind);
end
delete(instrfind({'Port'},{'COM3'}));
esp = serialport('COM3',9600,'DataBits',8,'StopBits',1,'Parity','none');
fopen(esp);
disp(esp);
% 30 másodperces várakozási idő beállítva, ennyi időt vár a kód 2 adat
% beérkezés között mielőtt hibát okoz.
esp.Timeout=30;
values=zeros();
% folyamatos futást tesz lehetővé, az i nullázása csak tesztelés
% valamiért minden 151. beérkezett érték helyére NaN-t ír
for i=1:80
a=esp.readline;
% hogyha nem akar működni így sem, akkor meg kell próbálni stringé
% alakítani az elküldendő adatokat az arduino IDE-ben, ha úgy sem, akkor
% byte-ba vagy bitbe
values(i,1)=str2double(a);
disp(values(i,1));
end
csvwrite('testfle.csv',values);
i=0;
0 个评论
采纳的回答
Christopher Stapels
2022-10-31
You can only update every 15 seconds with a free license, but you can use the bulk update endpoint to get a higher density of points. Here is some sample code for the bulk update. The allotments for the camput wide license with respect to ThingSpeak are described here.
Here is a bridge solution for ESP now and WiFi.
更多回答(2 个)
Manjunatha Vankadari Gopalakrishna
2022-11-3
Hi,
With the latest version of MATLAB, you can use the arduino command to connect to ESP32 boards.
Please refer to the following links, this will help you in your workflow,
https://in.mathworks.com/help/supportpkg/arduinoio/ug/configure-setup-for-esp32-hardware.html
https://in.mathworks.com/help/supportpkg/arduinoio/ug/connect-to-arduino-hardware.html
Thanks,
Manjunatha
0 个评论
Christopher Stapels
2022-10-29
Are you able to run a WiFi client at the same time as the ESP NOW? You could connect to a WiFi network to send the values to ThingSpeak and then switch back to the NOW communication.
社区
更多回答在 ThingSpeak Community
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 WiFi 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!