USB connection to MQTT and Node-red

#1

Hi.

I woudl like to use an Arduino linked to a computer and use node-red for the IHM with my code running on the Arduino (PID regulator and datalogger). I would like to use node-red to launch the program on the Arduino with proper parameters, then, retrieve datas (time and température) from the Arduino to node-red and fill a datafile

I was thinking to go with MQTT (witch I previously did with an ESP8266 trough WiFi network), but as my Arduino doesn’t have WiFi neither ethernet, I was thinking to use usb connection instead but I’m stuck and not able to find proper information.

Any advices or link would be appreciated.

#2

I would seriously just use an ESP8266 for the job.

#3

Arduino’s USB ports usually get identified as a serial port when plugged into a PC/Pi. You can ‘talk’ to your sketch using the serial node.

#4

In case you want to consider this route there is a PID algorithm available for the Sonoff-Tasmotta software for ESP8266 devices which is based on the same algorithm as node-red-contrib-pid.
See https://github.com/arendst/Sonoff-Tasmota/wiki/PID-Control-with-Sonoff-Devices

#5

I haven’t gotten it to work yet, but there’s several tutorials on the web for using an ESP8266 on the Arduino to give it a WiFi connection. There’s also the overpriced WiFi shield.

I have used the SoftwareSerial library to give my Arduino Uno a second serial port for the Nextion display.

But, it’s likely easier to just use an esp8266.

(What’s an IHM?)

#6
code here ?

yes seems to work !
sorry for disturbing, this was a try !