Photon "Flashable" Variable Table

I’m a newbie and just bought a photon to start playing with. Haven’t received it yet. I’ve searched the forums for discussions about this topic and probably am not searching for the right terms/ideas, or possibly I’m totally out of the ballpark with this question.

I am planning a Pool Controller project based on a project by @bscuderi : Pool Controller Samsung SmartThings

I am wondering if there is a way to “flash” a portion of the Photon memory for updates to “only” a variable table used by the user firmware. In this particular project, an example might be to update the pool pump schedules (put into a table), without updating the entire Photon user firmware program. It seems that this might be possible for data within the reserved DCT memory portion of the Phantom, but there is not a lot of space there. Can this be accomplished with the Photon in other portions of the memory map…particularly the user portions?

Another option might be to add a FRAM chip via the I2C interface to store program variables which might need updating in this fashion. Is there another way?

I hope this question makes sense as I am in the exploratory stages of this project and as I said, have not even received my photon yet. Thanks.

1 Like

@Jonpcar, the DCT space is not available. However, depending on the size of your data, you could use emulated EEPROM (2KB) or, as you pointed out, an external FRAM or SPI flash chip. How much data are you talking about?

1 Like

I think “emulated eeprom” is the term I was lacking knowledge of, haha. For my purposes 2KB would be plenty but not positive yet. I hadn’t gone through the firmware sections of the photon yet and I see there is some documentation there about the eeprom. When I start using it, I am sure I will have more questions. Thanks @peekay123!

@Jonpcar, create a structure for your schedule data, like a DB record. You can read and write the full structure to EEPROM easily with EEPROM.put() and EEPROM.get() functions, making it easy to manage multiple “records”.

With my project I just reflash the whole firmware if I change the schedule. Clunky I know but I don’t change the permentant auto schedule often. I just use my smart home controller to put it in manual and override for short term changes as needed. I would definitely be interested in what you learn with this. Because if I can store a couple of variables that would survive after a power cycle I would be very happy. As I could store valve state into there as well as last pool Light color and retrieve it after a power outage. Right now my method is to activate the valves to the limit switches in my setup so I can get a known position from the start of the program.

@bscuderi, there are projects on this forum, including pool projects, that use EEPROM to store settings and data. You can use Particle.function() to send new settings to your device.
Another method is to use retained variables that persist through a reset and, with the use of a backup battery on Vbat, will persist even when power is removed. Do a forum search to discover!

1 Like