Best way to "store" user-selected settings on photon

I will have some photon-enabled LED Lamps the user can interact with using their smartphones. There will also be different modes the user can select (like changing color by moving the hands above the lamp).

The question is how to store the selected modes on the photon. i came up with the following ideas:

  1. Use Particle.function() to set the mode. Downside: will not survive a reboot, obviously
  2. Save a “SettingsString” on a Server and acquire it with a webhook request. That way the users settings could be retreived on every boot and the user could still “set” it via his smartphone by calling a particle.function.

Are there any obvious alternatives i overlooked?

The Photon and Core have EEPROM memory available. Data written to this memory survives a reboot. So the general approach is to have your Photon’s firmware behave as follows:

  • When the user sets a Photon-controlled LED lamp by calling a function on the Photon. as well as turning the lamp off/on as the user requested, also store the user setting in the Photon’s EEPROM…
  • When the Photon reboots, read the last user setting from the EEPROM and initialise the lamp off/on state using the setting.

Search in the documentation from “EEPROM” and the associated and EEPROM.write functions.


There now are even more convenient functions to store/retrieve data of different - even custom - datatypes to/from EEPROM: EEPROM.put() / EEPROM.get()


just reading the docs now - exactly what i needed. Thanks @ScruffR @philipq

1 Like

Sorry to hijack this thread - but as its so recent, I wanted to put in my EEPROM ‘issues’.
I also use the EEPROM (only 3 locations) on a photon.

Seems to work on one photon (here under my control) but a remote one is losing its values (reverting back to 255).

Looks like there might be some condition which would cause a photon to wipe its EEPROM ???.

Powering down, or even reset button does NOT cause mine to lose its data, but another photon, taken on-site only today, already lost its settings. I can rewrite them remotely (exposed function) but am worried about what conditions cause it to wipe :-((.

If the dev team have any ideas please - I will investigate.

NB Both photons seem to be on 0.4.6 (as far as I can tell remotely :-O).


You already got a reply there
EEPROM values wiped

Sorry - that wasn’t there when I last looked ;-)).