# Upload Arduino sketch binary via Node-Red usb?

**URL:** <https://discourse.nodered.org/t/upload-arduino-sketch-binary-via-node-red-usb/38554>\
**Category:** General\
**Created:** [4 January 2021 22:54 UTC](https://discourse.nodered.org/t/upload-arduino-sketch-binary-via-node-red-usb/38554 "2021-01-04T22:54:45Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![m\_elias](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@m\_elias](https://discourse.nodered.org/u/m_elias)\
**Post date:** [4 January 2021 22:54 UTC](https://discourse.nodered.org/t/upload-arduino-sketch-binary-via-node-red-usb/38554/1 "2021-01-04T22:54:45Z")

</div>

I have an Arduino Uno connected via usb to my oPi One running Node-Red 1.2.6. The Arduino runs a modified Firmata example sketch and I use node-red-node-arduino to send/receive data to/from the Arduino etc. Is it difficult to use Node-Red to upload a new sketch binary instead of having to plug the Arduino into my desktop each time?

I'm thinking there's two components to solve here:  
1st: How to get the binary onto my oPi or how to retrieve it.  
2nd: How to do the actual upload. If there's no existing, convenient node for that then I think I'll just keep doing what I'm doing.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [4 January 2021 23:45 UTC](https://discourse.nodered.org/t/upload-arduino-sketch-binary-via-node-red-usb/38554/2 "2021-01-04T23:45:44Z")

</div>

Presumably there is a command line loader for loading firmware? If so, you can simply execute it using an exec node.

To get the binary onto the oPi, there are all sorts of ways. Where is it coming from?

---

<div class="post-metadata">

**Author:** ![m\_elias](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@m\_elias](https://discourse.nodered.org/u/m_elias)\
**Post date:** [5 January 2021 00:26 UTC](https://discourse.nodered.org/t/upload-arduino-sketch-binary-via-node-red-usb/38554/3 "2021-01-05T00:26:05Z")

</div>

I was hoping to avoid learning the command line. I'm running the official ide on Windows, on the same network.

---

<div class="post-metadata">

**Author:** ![m\_elias](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@m\_elias](https://discourse.nodered.org/u/m_elias)\
**Post date:** [5 January 2021 01:57 UTC](https://discourse.nodered.org/t/upload-arduino-sketch-binary-via-node-red-usb/38554/4 "2021-01-05T01:57:21Z")

</div>

On further consideration, it would probably be worth the effort to figure it out. I'm using an oPi One running armbian. I don't want to compile, just upload.

---

<div class="post-metadata">

**Author:** ![Bobo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bobo/32/8401_2.png) [@Bobo](https://discourse.nodered.org/u/Bobo)\
**Post date:** [5 January 2021 02:06 UTC](https://discourse.nodered.org/t/upload-arduino-sketch-binary-via-node-red-usb/38554/5 "2021-01-05T02:06:54Z")

</div>

I use mqtt to upload new firmware to esp devices, using just 4 nodes. The new firmware sits on my web server, and gets uploaded via ssh from VS Code. The whole process is quite simple.

I would imagine the whole process would be the same using an arduino. Hope this gives you some ideas from where to start.

Addendum: Sorry, just noticed your requirement for usb delivery, so the above won't be of much help.

---

<div class="post-metadata">

**Author:** ![m\_elias](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@m\_elias](https://discourse.nodered.org/u/m_elias)\
**Post date:** [5 January 2021 03:11 UTC](https://discourse.nodered.org/t/upload-arduino-sketch-binary-via-node-red-usb/38554/6 "2021-01-05T03:11:30Z")

</div>

Yeah. Looks like I'll have to take a look at the sketch upload output from the ide on my windows machine for clues as to how to configure avrdude on my oPi.

Any suggestions on getting the compiled file from Windows to the oPi? Network share? I could copy the file to my local web server...

---

<div class="post-metadata">

**Author:** ![Bobo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bobo/32/8401_2.png) [@Bobo](https://discourse.nodered.org/u/Bobo)\
**Post date:** [5 January 2021 05:26 UTC](https://discourse.nodered.org/t/upload-arduino-sketch-binary-via-node-red-usb/38554/7 "2021-01-05T05:26:50Z")

</div>

> [@m\_elias](#):
>
> I could copy the file to my local web server...

That's the way I do it. From memory you can configure PlatformIO to automagically (ssh) send the file after compile using a webhook.

Then on the arduino side send an mqtt msg to it to let it know there is new firmware to pick up.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [5 January 2021 09:36 UTC](https://discourse.nodered.org/t/upload-arduino-sketch-binary-via-node-red-usb/38554/8 "2021-01-05T09:36:55Z")

</div>

Do note that the serial port can't be shared - so if your flow is running (ie Node-RED is stared and connected to the arduino) then you can't also grab it for upload use, as the arduino node has held it already. So you would need to stop Node-RED - then upload - then restart Node-RED, which obviously means it can't be done by Node-RED itself...

---

<div class="post-metadata">

**Author:** ![m\_elias](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@m\_elias](https://discourse.nodered.org/u/m_elias)\
**Post date:** [5 January 2021 13:03 UTC](https://discourse.nodered.org/t/upload-arduino-sketch-binary-via-node-red-usb/38554/9 "2021-01-05T13:03:05Z")

</div>

Should I be able to release the serial port in the node configuration?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [5 January 2021 13:42 UTC](https://discourse.nodered.org/t/upload-arduino-sketch-binary-via-node-red-usb/38554/10 "2021-01-05T13:42:16Z")

</div>

no - (well - only if you re-configure it to point to a new/dummy one and re-deploy)

---

<div class="post-metadata">

**Author:** ![m\_elias](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@m\_elias](https://discourse.nodered.org/u/m_elias)\
**Post date:** [5 January 2021 20:43 UTC](https://discourse.nodered.org/t/upload-arduino-sketch-binary-via-node-red-usb/38554/11 "2021-01-05T20:43:07Z")

</div>

Would be awesome then if node-red-node-arduino could support the upload/flashing ability...

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [5 January 2021 20:52 UTC](https://discourse.nodered.org/t/upload-arduino-sketch-binary-via-node-red-usb/38554/12 "2021-01-05T20:52:21Z")

</div>

Feel free to implement it and contribute it back !

---

<div class="post-metadata">

**Author:** ![m\_elias](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@m\_elias](https://discourse.nodered.org/u/m_elias)\
**Post date:** [7 January 2021 17:31 UTC](https://discourse.nodered.org/t/upload-arduino-sketch-binary-via-node-red-usb/38554/13 "2021-01-07T17:31:48Z")

</div>

That's a great idea but unfortunately a learning curve I'm not interested in at this time.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [7 January 2021 17:44 UTC](https://discourse.nodered.org/t/upload-arduino-sketch-binary-via-node-red-usb/38554/14 "2021-01-07T17:44:21Z")

</div>

No Problem... looks like your back to doing it manually then 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [8 March 2021 17:44 UTC](https://discourse.nodered.org/t/upload-arduino-sketch-binary-via-node-red-usb/38554/15 "2021-03-08T17:44:22Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
