• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

"Send Sensor Reading via Email (IFTTT)" project in "MicroPython for ESP32 and ESP8266":

Q&A Forum › Category: ESP8266 › "Send Sensor Reading via Email (IFTTT)" project in "MicroPython for ESP32 and ESP8266":
0 Vote Up Vote Down
jean-francois.teilhac asked 6 years ago

Hello,
“Send Sensor Reading via Email (IFTTT)” project in “MicroPython for ESP32 and ESP8266” works OK with ESP32 but it looks ESP8266 lacks memory. 
Download OK exec(open(“BME280.py”).read(),globals()) 
Memory error : memory allocation failed, allocationg 9984 bytes (BME280.py 10k on windows)
I re-Burned firmware to clear and defrag memory, checked with gc.collect() and micropython.mem_info(1) 
placed BME280.py in a “module” subdirectory and kept only boot.py in the workspace 
but there is still the same Memory error : memory allocation failed, allocationg 9984 bytes 
Has anyone done this project on a ESP8266 ?

Question Tags: memory allocation failed
4 Answers
0 Vote Up Vote Down
jean-francois.teilhac answered 6 years ago

This is the BME280.py for ESP8266 -> https://github.com/mchobby/esp8266-upy/blob/master/bme280-bmp280/bme280.py
The one on Random Nerd Tutorial works only for ESP32 -> https://github.com/RuiSantosdotme/ESPMicroPython/
blob/master/code/WiFi/HTTP_Client_IFTTT_BME280/BME280.py
 

0 Vote Up Vote Down
Rui Santos Staff answered 6 years ago

Hello Jean, if you see the message “Download OK”. You can ignore that warning message saying “memory allocation failed” and simply restarting your ESP8266 should make it work.
Can you see if it’s working for you?

0 Vote Up Vote Down
jean-francois.teilhac answered 6 years ago

Hello Rui,
We must have different ESP8266 because simply restarting mine doesn’t work !
My ESP8266 only works with :
https://github.com/mchobby/esp8266-upy/blob/master/bme280-bmp280/bme280.py
which is a bme280 intended for the MicroPython and esp8266 boards (explained line 7).
To make this “new” bme280.py file work with our boot.py file one must :

  • first correct the “new”‘ BME280.py file the default address which is 0x76 instead of 0x77 (the opposite of what is written line 39) BME280_I2CADDR = 0x76 and BMP180_I2CADDR = 0x76

 

  • than change a few lines in our boot.py file which are :

                           result=bme.values
                           temp = result[0]
                           pres = result[1]
                           hum = result[2]
                           instead of :
                           temp = bme.temperature
                           hum = bme.humidity
                           pres = bme.pressure
The “new” BME280 has no attibutes “temperature”, “pressure” and “humidity”.
But there is an attribute “values” which returns our three expected results in an array.
Regards
JFT
 
 
 

0 Vote Up Vote Down
Rui Santos Staff answered 6 years ago

Why are you using that library? I recommend using this exact file for BME280.py: https://github.com/RuiSantosdotme/ESP-MicroPython/blob/master/code/WiFi/HTTP_Client_IFTTT_BME280/BME280.py
The library that I use in the eBook uses less spaces to save memory and it has no comments, so it works with the ESP8266…

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.