ESP NOW provided sensor datas to ESP32 and Matlab serial communication
25 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Nagy
el 27 de Oct. de 2022
Respondida: Manjunatha Vankadari Gopalakrishna
el 3 de Nov. de 2022
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 comentarios
Respuesta aceptada
Christopher Stapels
el 31 de Oct. de 2022
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.
Más respuestas (2)
Manjunatha Vankadari Gopalakrishna
el 3 de Nov. de 2022
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 comentarios
Christopher Stapels
el 29 de Oct. de 2022
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.
Comunidades de usuarios
Más respuestas en ThingSpeak Community
Ver también
Categorías
Más información sobre WiFi en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!