# USB connection to MQTT and Node-red

**URL:** <https://discourse.nodered.org/t/usb-connection-to-mqtt-and-node-red/488>\
**Category:** General\
**Created:** [30 May 2018 10:30 UTC](https://discourse.nodered.org/t/usb-connection-to-mqtt-and-node-red/488 "2018-05-30T10:30:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![hary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hary/32/12340_2.png) [@hary](https://discourse.nodered.org/u/hary)\
**Post date:** [30 May 2018 10:30 UTC](https://discourse.nodered.org/t/usb-connection-to-mqtt-and-node-red/488/1 "2018-05-30T10:30:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [30 May 2018 10:39 UTC](https://discourse.nodered.org/t/usb-connection-to-mqtt-and-node-red/488/2 "2018-05-30T10:39:03Z")

</div>

I would seriously just use an ESP8266 for the job.

---

<div class="post-metadata">

**Author:** ![asandford](https://avatars.discourse-cdn.com/v4/letter/a/eb8c5e/32.png) [@asandford](https://discourse.nodered.org/u/asandford)\
**Post date:** [30 May 2018 11:03 UTC](https://discourse.nodered.org/t/usb-connection-to-mqtt-and-node-red/488/3 "2018-05-30T11:03:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [30 May 2018 13:45 UTC](https://discourse.nodered.org/t/usb-connection-to-mqtt-and-node-red/488/4 "2018-05-30T13:45:41Z")

</div>

> [@ghayne](#):
>
> I would seriously just use an ESP8266 for the job.

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 [GitHub - arendst/Tasmota: Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at](https://github.com/arendst/Sonoff-Tasmota/wiki/PID-Control-with-Sonoff-Devices)

---

<div class="post-metadata">

**Author:** ![SteveMann](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stevemann/32/3810_2.png) [@SteveMann](https://discourse.nodered.org/u/SteveMann)\
**Post date:** [30 May 2018 22:42 UTC](https://discourse.nodered.org/t/usb-connection-to-mqtt-and-node-red/488/5 "2018-05-30T22:42:02Z")

</div>

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](https://www.arduino.cc/en/Reference/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?)

---

<div class="post-metadata">

**Author:** ![hary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hary/32/12340_2.png) [@hary](https://discourse.nodered.org/u/hary)\
**Post date:** [14 June 2018 10:07 UTC](https://discourse.nodered.org/t/usb-connection-to-mqtt-and-node-red/488/6 "2018-06-14T10:07:58Z")

</div>

```auto
code here ?
```

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