• 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

Trouble with OLED, DHT11, SD Card as data logger.

Q&A Forum › Category: Arduino › Trouble with OLED, DHT11, SD Card as data logger.
0 Vote Up Vote Down
Robert Gillespie asked 4 years ago

Hi:
I have a working version of DHT11, an OLED (I2C connected) and and UNO.  I also have a working version of a Jeremy Blum data logger sketch (I used a TMP36 and a photoresistor as inputs then).  I’m trying to use the DHT11 and OLED sketch as the basis and I’m trying to add elements of the Blum sketch so that I can data log to an SD card.  The first line I put in the DHT11 sketch from the Blum sketch is “#include <SD.h> //SD Card Library from Arduino.cc ”  The code compiles and uploads but upon execution I get the following output from the Serial Monitor.
This is the code before I add the line.

#include “DHT.h”
/*#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
*/
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <SD.h> //SD Card Library from Arduino.cc
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

The error is get is:

SSD1306 Allocation failed.

I hope that you can help.
Bob

Question Tags: Data Logger, DHT!!, OLED, SD card
6 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi.
What are the connections between your OLED and your board?
Did you try to run a sample sketch and see if it works? https://randomnerdtutorials.com/guide-for-oled-display-with-arduino/
You can also run an I2C scanner sketch to see if the board is finding your I2C device: https://raw.githubusercontent.com/RuiSantosdotme/Random-Nerd-Tutorials/master/Projects/LCD_I2C/I2C_Scanner.ino
Regards,
Sara

0 Vote Up Vote Down
Robert Gillespie answered 4 years ago

Hi Sara:
I have a successful OLED DHT11 sketch working.  I have a successful SD card storing data from a photocell and a temperature transistor in another sketch.  Both working well.  I’ve tried the I2C scanner and it found the DHT11 as expected and the SD card does not use I2c.  Bottom line is that I think it is the memory not being sufficient.  I have dropped the OLED and will add a photocell voltage divider to add to the DHT11s output and I will add a flashing LED to let the observer know that the circuit is capturing data.  Thanks for your input.
Bob

0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi Bob.
Were you able to solve your issue?
Regards,
Sara

0 Vote Up Vote Down
Robert Gillespie answered 4 years ago

Hi Sara;
A friend, William Lucid, compiled the sketch using Arduino IDE 2.0 and the compilation output storage requirements for the sketch on the Uno.  The Uno simply does not have the memory for the OLED, DHT11, SD card.  Will have to move to another platform.  I’ll probably try the ESP32 or the ESP8266.  Thanks for following up on my dilemma.
Bob
 

0 Vote Up Vote Down
Robert Gillespie answered 4 years ago

Hi Sara;
A friend, William Lucid, compiled the sketch using Arduino IDE 2.0 and the compilation output storage requirements for the sketch on the Uno.  The Uno simply does not have the memory for the OLED, DHT11, SD card.  Will have to move to another platform.  I’ll probably try the ESP32 or the ESP8266.  Thanks for following up on my dilemma.
Bob
 

0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Ok.
Good luck with your project.
Regards,
Sara

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

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition 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.