Upload Arduino sketch binary via Node-Red usb?

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.

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?

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

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.

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.

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...

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.

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...

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

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

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

Feel free to implement it and contribute it back !

1 Like

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

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

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