Faster execution and more RAM

I have an application that is running very well on a Proton, however, I wish to speed it up and also access more RAM as I am approaching the limits of the Proton.

What platform would the community advise to use to overcome these limitations (with the minimum of porting headaches of course)?

I prefer not to switch to a Linux board due to the learning curve of getting started plus I do not need extensive graphics and a fancy display.

You might want to check out the Adafruit Feather lineup. More specifically, the ESP32 board has 240MHz clock and 512kB RAM.

Also, this Atmel-based board… it only runs at 120MHz (same as Photon) but there’s no overhead for the FreeRTOS or Particle cloud.


I agree with @ninjatill. The Adafruit Feather footprint is what the new Particle Mesh family uses and there are lots of shields available from Adafruit. However, if you are using Particle-specific code, you WILL have a substantial rewrite of your code since the ESP32 is not supported with any Particle firmware.


Thank you @peekay123 and @ninjatill.

How does the ESP32 board compare to the new mesh-based Particle boards?

Compare?.. well, off the top of my head, the new mesh boards run at 60MHz (vs 240MHz for ESP32), and have a lot of RAM available… something like 4MB (compared to 512K on the ESP32) I can’t compare RAM specs since there’s a difference in flash and SRAM. In fact the Argon has an ESP32 chip on it but only to handle WiFi, not user code. The mesh devices conform to the Adafruit Feather specification so if you buy an ESP32 FeatherBoard from Adafruit, the pin-out should be compatible.

I think the biggest issue you might encounter is support. Even the Adafruit ESP32 page says it is for Development purposes and doesn’t have a lot of documentation. Adafruit says it best:

"Please note: The ESP32 is still targeted to developers. Not all of the peripherals are fully documented with example code, and there are some bugs still being found and fixed. We got all of our Featherwings working under Arduino IDE, so you can expect things like I2C and SPI and analog reads to work. But other elements are still under development. For that reason, we recommend this Feather for makers who have some experience with microcontroller programming, and not as a first dev board."

The mesh devices, on the other hand, will probably be code-compatible with all the other Particle devices, they will have access to the Particle cloud and have the full support of Particle via support tickets and this forum. You may get some support with the ESP32 feather from Adafruit but how much I can’t say. The mesh devices can also talk to each other with minimal code… The ESP32 you will have to cobble together your own communication method.

1 Like

Thank you @ninjatill. Per your advice, as my main concern is RAM, I will stick with the new Particle boards.

@Jimmie, how much RAM do you need exactly?

I have a large array which needs to be kept in core. Currently, my program is taking almost 70 KB of RAM. I need about double that amount and also preferably twice the speed.

@Jimmie Would using either flash or SD card memory via SPI be feasible. I have measured the access speed with SPI_FULL_SPEED and using DMA mode SDFat library and can get read/write of 3Mbyte/sec using a photon. You might be able to then page parts of your array into RAM and do your calculations there then page them out to SD card? Not ideal but would allow you to have very large arrays.

Thank you @armor. Yes, indeed this is a possibility. I already have an SPI SD card but I am not using it for the array.

Perhaps the only downside is that the system is installed in a hard to reach location so reducing components is a plus.


Would you like to say what is in your array?

If it is variable text in a fixed length field, depending on the data, you could use some clever techniques to reduce RAM by using a different data structure - reduce space, but increase search time.

1 Like

@Jimmie, I agree with @UMD that there may be ways to optimize your storage. You can also explore using an SPI FRAM which is fast, non-volatile and non-mechanical like an SD.

Thank you @umd and @peekay123.

The array is an int array. It is only used once so sorting will not help. Also it is checked as each item is inserted so using linked lists and other data structures may not help.

As I just need a bit more RAM, I am hoping the mesh-based boards will take care of this issue.

On the speed front, not being an electronics engineer, why has the ESP32 not been selected for the new boards given its clear edge in processing speeds?

Not knowing your actual data, do you really need 32bit integers?
If you go for int16_t (+/- 32676) instead of int (+/- 2147483647) you can save half the memory with just that.

1 Like

@Jimmie, the ESP32 is a WiFi/BLE device with 2 cores (plus a low power processing unit). Though Espressif has introduced WiFi mesh, it is not low power. The device as a whole was not designed for low power operation but would be a great Photon Gen 2 IMO. Particle chose a very low power Nordic nRF82540 processor which supports the IEEE 802.15.4 (2.4GHz) protocol as well as BLE. Mesh is implemented on 802.15.4 using OpenThead. This processor forms the core of every Particle mesh device with the Xenon being a low power edge device using only the Nordic chip. The Boron and Argon add WiFi and 2G/3G or LTE-M1 in order to act as gateways for the mesh.

1 Like

Thank you @Scruff . DEFINITELY this is worth while trying and will try it.

Your advice saved another 11KB. Thanks again.

Thank you @peekay123 for the response. I was baffled when I say the speed specs on the ESP32 …