botletics / SIM7000-LTE-Shield

Botletics SIM7000 LTE CAT-M1/NB-IoT Shield for Arduino
https://www.botletics.com/products/sim7000-shield
GNU General Public License v3.0
481 stars 216 forks source link

uploading code to Ardunio uno R3 Too much memory is used #127

Open dudemyass opened 5 years ago

dudemyass commented 5 years ago

When i upload the example code IoT_Example | Ardunio 1.8.9 i get a message that 77% of memory has been used and it may cause stability problems. When i open the serial window it finds the fona module registers with the network and stops at that point and does not execute the rest of the code? Nothing has been changed in your code except the apn. When tested with other example LTE it posts to dweet.io if i select option 2 and all other options seem to work correctly only the IoT example is not working. I am using Botletics sim7000A ver 6 and i am in the USA.

botletics commented 5 years ago

A sure-fire fix is to switch to a Mega, but if that isn't an option you could try minimizing the code to only the stuff you need.

alberg79 commented 4 years ago

I have the same issue. Looking at other issues it looks this one #138 "Sim7000 wont send data to IO Adafruit" is the same problem. The Iot_Example is hanging in the moduleSetup function and I did try a Mega along with a Uno. LTE_demo sketch works but MQTT sketch to Adafruit IO does not.
IoT Example lockup

tjdzor commented 4 years ago

I too had been fighting this issue, but figured a couple things out!

Background, trying to make a cellular temperature logger using AdafruitIO for a vacant property that has had some random heating issues. Using a Hologram sim, everything worked fine in the SIM7XXX_LTE_Demo, but would go into a reboot loop or hang if I tried using the AdafruitIO_MQTT_Demo or IoT_Example. Tried the previously mentioned solutions such as adding a battery, bought a Mega to try thinking maybe it was a stability issue. But alas, no love.

So I added some serial outputs and tried commenting sections out to help figure out where it was failing. I found two issues in setup()

It seems to hang @ tempsensor.wake(); I looked at the Adafruit MCP9808 example and sure enough, theres no wake before initializing it. So I commented out that line. (//tempsensor.wake();)

And next, it would fail to find the MCP9808 anyways. It's being started without the i2c address, so adding the address 0x18 fixed it. The address can be checked with an i2c Scanner. And the sensor can be tested with the Adafruit MCP9808 Library/Example if (!tempsensor.begin(0x18)) {

I also set the resolution of the temp sensor to the highest (but also slowest), but that probably isn't necessary. tempsensor.setResolution(3);

Mine has been working flawlessly for a couple days now. Would love to try it on an Uno, but due time constraints its staying on the Mega for the time being.

I really hope this helps some people!

alberg79 commented 4 years ago

Uno too much memory message has nothing to do with the hang in the IoT_Example sketch. As mentioned above the fix is to comment out the tempsensor.wake(); line.