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
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
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
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
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