SdCard v4 out of memory on Seeduino v4.2

I have a project with several grove sensor modules.
It has :

  1. Seeduino v4.2
  2. Grove base hat V2
  3. Oled display v1.2. I2c
  4. Precision Rtc i2c
  5. Temp/humi/pressure/gas sensor BME680 i2c
  6. Dust sensor HM3301 I2C
  7. Blue LED
  8. SD card v4 with a 32 Gb SDHC card

I got 1 - 7 all working in code before adding 8. The SD card is mounted on top of the seeduino, and base hat is sitting on top so I can access the 4 x I2c connectors and 1 digital port.

I need the SD card to record data readings from the sensors. It is essential.
When I added example code for the SD Card I got an “out of memory” error from the compiler. Global variables not leaving enough space for local variables.
Clearly the 2K of memory isn’t enough, probably because SD Card needs to read the card, volume and FAT into (global) heap memory. This ought to be documented.
If you try to run the SD card on Uno/seeduino v4.2 then you won’t have much memory for anything else. It uses 1.2kbytes of ram out of 2k available on the heap.

So I need more memory …
Looking at available options, it seems like a Seeduino Mega 2560 with 8K of RAM might be better.
According to wiki documentation my base hat v2 is compatible with seeeduino mega. I don’t know how it does that, since i2c pinouts are different…
If its true then I don’t need to change anything else. Just plug in the Mega board in place of the seeduino v4.2 board. Is it true ?

Questions:

  • Please can you doubly confirm that all 4 i2c connectors on base hat v2 will work on seeduino mega 2560 without extra wiring.

  • Is there a base hat for Mega 2560 that has more than 3 x i2C connectors ?
    -Can the SD card v4 work thru I2C interface ?
    -Does the SD card v4 support 32 GB sdhc cards or not ? ( documentation is inconsistent )

Thanks for reading.
Can you help ?

(I made corrections to this post after checking compatibility of base shield v2 in wiki documentation. A lot of my questions disappeared …)

Ok. No responses so far, but today I went shopping for seeeduino mega.
Along the way I found announcement for “WIO Terminal product”.
Looks like I might be able to use it with my grove sensors. I need to discard the seeeduino 4.2 and Grove base sheild V2 and Sd card v2 and oled display and blue led. But WIO terminal has onboard SD card and much greater ram, so it will work better and faster.
I can re use the precision rtc, bme680, hm3301 sensor shields and I can add GPS.
So I need only 3 i2c ports.
Could add a grove i2c hub and/or Grove x2 connector cable to expand the number of i2c ports available.
I could add the wio battery box too, but I have already purchased a 3rd party 3400 mAH battery yesterday.
I want to add a grove gps to complete my project. It uses serial uart connection. Can it connect directly to multifunction grove connector on wio terminal (not the i2c port) ?

Next problem is an enclosure.
I have created a separate post about enclosure questions.