Firmware update method for end-users (Feature Request?)

If I design a product based on Photon, I want my customers to take a provided .BIN and easily update the firmware on their device.

There are useful ways for developers to update firmware but they require the installation and use of command line tools. The paid “Organization” dashboard component provides a simple way of deploying firmware to a fleet of devices, but my company can’t yet justify the expense and it removes control from the end-user.

If a simple windows/OS X GUI tool isn’t possible (something like Teensy Loader would be ideal), perhaps an option could be added to the basic dashboard to upload a .BIN and update the firmware on a device. This could go in the “…” menu above “Unclaim Device.”


You can make a very simple “upload and flash” utility using the JavaScript SDK. Then you’d only have to figure out how to authorize people to flash their own devices.

1 Like

@Moors7, I wonder if a customized device updater would not also work:

Thanks! I hadn’t considered either of these options.

@Moors7 I already have an embedded web server running on the Photon with access to the DeviceID. Do you think it’s possible to simply run the Javascript SDK locally on the device with a form to upload the .bin file? I could also upload the .bin to SD, which is connected to the Photon, and then access it from there if necessary.

EDIT: No, wait it needs node.js. Scratch that idea.

The SDK doesn’t need Node.js. Considering Node.js is JS, it’ll work on the browser as well.
That said, not sure if it’s possible to do it all on the Photon. Give it a shot…?

Thanks @Moors7. I have zero experience with JavaScript but I spent the last few hours hacking away. I’m just working in Windows for now. I finally have something that runs, and even tries to successfully send firmware, but nothing occurs on the Photon. The data returned from particle.flashDevice() says, “error: Nothing to do?” The .bin is in the same folder as the .html file.

Here’s my code… any suggestions?

I just read this other thread with the same problem. @bryce can you say if a local particle-api-js is required for flashing, or should the code above work simply with the jsdelivr embed?

That other thread was about using it from Node.js.

You can flash from a browser, but the file must be available in the browser context. It cannot read off your file system like that. In order to make the files available, you will need a form input. Try adding this to your html:

  <input type="file" id="file_to_flash" />

Modify your javascript to this:

var flashFile = document.getElementById('file_to_flash').files[0];
var flashPr = particle.flashDevice({ deviceId: deviceIdentifier,
        files: { file1: flashFile }),
        auth: accessToken });

OMG it works! It works! :smile:

Thanks @bryce. Of course, what you said makes perfect sense but it would have taken me hours to figure out the code you shared. Many thanks.

Question: If I compile against the latest firmware and someone tries to install the .BIN on a Photon running older firmware, what happens? Does the healer kick in and they get automatically updated?

Any idea about the firmware question, @bryce?

Yes, the healer would update their system modules to the required versions.

1 Like