2.42" OLED not working anymore

Please help!

A school project I created was an automated pill dispenser, with a 2.42" OLED display

It worked great a few months ago, and it has not been turned on since. When it was working, to start it up, I would have to plug in the arduino, and the display would not turn on until I pressed the reset button on the arduino nano. Now, whenever I plug in the arduino, sometimes a few pixels light up at the bottom of the screen but after pressing the reset button the screen remains completely off.

Please help, I have a showcase in 3 days and have no idea how it could have just stopped working.

Hi Danny. If you think carefully about it, you should be able to understand that no-one here can help you right now. If you asked us what colour socks you are wearing today, would you expect the forum members to give the correct answer?

3 days might be enough time to find and fix the problem, but you will need to think carefully about what the forum members will need in order to be able to help you.

Start by reading the forum guide in the sticky post at the top of this forum section.

Paul

Apologies, I was in a bit of a panic :smiling_face_with_tear:

Since making the post, I have done some investigating. Firstly, I have swapped out the Arduino being used. Following this, the screen did turn on as intended, however following another power cycle it went back to not working. I have run a couple of I2C scanners on the arduino, and every time it has either not found anything, or given an error on random addresses, as follows:
image

Is this likely to be a faulty screen? I can order a new one and it would arrive tomorrow.

This is the circuit diagram:

Here is the code: (the string of numbers is just for an animation on the display)

#include <Wire.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_GFX.h>
#include <virtuabotixRTC.h>
#include <Servo.h>

virtuabotixRTC myRTC(10, 9, 8);

Servo servo;

#define OLED_WIDTH 128
#define OLED_HEIGHT 64

#define OLED_ADDR   0x3C

Adafruit_SSD1306 display(OLED_WIDTH, OLED_HEIGHT);

int morninghour = 19;
int morningminute = 23;

bool morningalarm = 0;
bool eveningalarm = 0;

int alarmon = 0;

int eveninghour = 21;
int eveningminute = 00;

bool morning = 0;
bool night = 0;
int irsensor = 7;
int buzzer = 6;

#define FRAME_DELAY (42)
#define FRAME_WIDTH (48)
#define FRAME_HEIGHT (48)
#define FRAME_COUNT (sizeof(frames) / sizeof(frames[0]))
const byte PROGMEM frames[][288] = {
  {0,0,0,0,0,0,0,0,0,0,0,0,0,254,0,0,127,0,3,255,0,0,255,192,7,14,0,0,112,224,14,28,0,0,56,112,28,56,31,248,28,56,24,112,255,255,14,24,48,227,224,7,199,12,49,207,0,0,243,140,51,156,0,0,57,204,55,56,0,0,28,236,62,112,0,0,14,124,60,224,0,0,7,60,57,192,0,0,3,156,17,130,0,0,1,136,3,7,0,0,0,192,3,3,128,0,0,192,6,1,192,0,0,96,6,0,224,0,0,96,6,0,112,0,0,96,12,0,56,0,0,48,12,0,28,0,0,48,12,0,14,0,0,48,12,0,7,0,0,48,12,1,255,128,0,48,12,1,255,128,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,6,0,0,0,0,96,6,0,0,0,0,96,6,0,0,0,0,96,3,0,0,0,0,192,3,128,0,0,1,192,1,128,0,0,1,128,0,192,0,0,3,0,0,224,0,0,7,0,0,112,0,0,14,0,0,120,0,0,30,0,0,254,0,0,127,0,1,199,0,0,227,128,3,131,224,7,193,192,7,0,255,255,0,224,6,0,31,248,0,96,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,254,0,0,127,0,3,255,0,0,255,192,7,14,0,0,112,224,14,28,0,0,56,112,28,56,31,248,28,56,24,112,255,255,14,24,48,227,224,7,199,12,49,207,0,0,243,140,51,156,0,0,57,204,55,56,0,0,28,236,62,112,0,0,14,124,60,224,0,0,7,60,57,192,0,0,3,156,17,131,128,0,1,136,3,1,128,0,0,192,3,0,192,0,0,192,6,0,96,0,0,96,6,0,112,0,0,96,6,0,56,0,0,96,12,0,28,0,0,48,12,0,12,0,0,48,12,0,6,0,0,48,12,0,3,0,0,48,12,1,255,128,0,48,12,1,255,128,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,6,0,0,0,0,96,6,0,0,0,0,96,6,0,0,0,0,96,3,0,0,0,0,192,3,128,0,0,1,192,1,128,0,0,1,128,0,192,0,0,3,0,0,224,0,0,7,0,0,112,0,0,14,0,0,120,0,0,30,0,0,254,0,0,127,0,1,199,0,0,227,128,3,131,224,7,193,192,7,0,255,255,0,224,6,0,31,248,0,96,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,254,0,0,127,0,3,255,0,0,255,192,7,14,0,0,112,224,14,28,0,0,56,112,28,56,31,248,28,56,24,112,255,255,14,24,48,227,224,7,199,12,49,207,0,0,243,140,51,156,0,0,57,204,55,56,0,0,28,236,62,112,0,0,14,124,60,224,0,0,7,60,57,192,192,0,3,156,17,128,192,0,1,136,3,0,96,0,0,192,3,0,112,0,0,192,6,0,48,0,0,96,6,0,24,0,0,96,6,0,28,0,0,96,12,0,12,0,0,48,12,0,6,0,0,48,12,0,7,0,0,48,12,0,3,0,0,48,12,1,255,128,0,48,12,1,255,128,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,6,0,0,0,0,96,6,0,0,0,0,96,6,0,0,0,0,96,3,0,0,0,0,192,3,128,0,0,1,192,1,128,0,0,1,128,0,192,0,0,3,0,0,224,0,0,7,0,0,112,0,0,14,0,0,120,0,0,30,0,0,254,0,0,127,0,1,199,0,0,227,128,3,131,224,7,193,192,7,0,255,255,0,224,6,0,31,248,0,96,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,254,0,0,127,0,3,255,0,0,255,192,7,14,0,0,112,224,14,28,0,0,56,112,28,56,31,248,28,56,24,112,255,255,14,24,48,227,224,7,199,12,49,207,0,0,243,140,51,156,0,0,57,204,55,56,0,0,28,236,62,112,0,0,14,124,60,224,96,0,7,60,57,192,96,0,3,156,17,128,112,0,1,136,3,0,48,0,0,192,3,0,24,0,0,192,6,0,24,0,0,96,6,0,12,0,0,96,6,0,12,0,0,96,12,0,6,0,0,48,12,0,6,0,0,48,12,0,3,0,0,48,12,0,3,0,0,48,12,1,255,128,0,48,12,1,255,128,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,6,0,0,0,0,96,6,0,0,0,0,96,6,0,0,0,0,96,3,0,0,0,0,192,3,128,0,0,1,192,1,128,0,0,1,128,0,192,0,0,3,0,0,224,0,0,7,0,0,112,0,0,14,0,0,120,0,0,30,0,0,254,0,0,127,0,1,199,0,0,227,128,3,131,224,7,193,192,7,0,255,255,0,224,6,0,31,248,0,96,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,254,0,0,127,0,3,255,0,0,255,192,7,14,0,0,112,224,14,28,0,0,56,112,28,56,31,248,28,56,24,112,255,255,14,24,48,227,224,7,199,12,49,207,0,0,243,140,51,156,0,0,57,204,55,56,0,0,28,236,62,112,0,0,14,124,60,224,48,0,7,60,57,192,48,0,3,156,17,128,24,0,1,136,3,0,24,0,0,192,3,0,12,0,0,192,6,0,12,0,0,96,6,0,12,0,0,96,6,0,6,0,0,96,12,0,6,0,0,48,12,0,3,0,0,48,12,0,3,0,0,48,12,0,3,0,0,48,12,1,255,128,0,48,12,1,255,128,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,6,0,0,0,0,96,6,0,0,0,0,96,6,0,0,0,0,96,3,0,0,0,0,192,3,128,0,0,1,192,1,128,0,0,1,128,0,192,0,0,3,0,0,224,0,0,7,0,0,112,0,0,14,0,0,120,0,0,30,0,0,254,0,0,127,0,1,199,0,0,227,128,3,131,224,7,193,192,7,0,255,255,0,224,6,0,31,248,0,96,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,254,0,0,127,0,3,255,0,0,255,192,7,14,0,0,112,224,14,28,0,0,56,112,28,56,31,248,28,56,24,112,255,255,14,24,48,227,224,7,199,12,49,207,0,0,243,140,51,156,0,0,57,204,55,56,0,0,28,236,62,112,24,0,14,124,60,224,24,0,7,60,57,192,12,0,3,156,17,128,12,0,1,136,3,0,12,0,0,192,3,0,6,0,0,192,6,0,6,0,0,96,6,0,6,0,0,96,6,0,6,0,0,96,12,0,3,0,0,48,12,0,3,0,0,48,12,0,3,0,0,48,12,0,1,128,0,48,12,1,255,128,0,48,12,1,255,128,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,6,0,0,0,0,96,6,0,0,0,0,96,6,0,0,0,0,96,3,0,0,0,0,192,3,128,0,0,1,192,1,128,0,0,1,128,0,192,0,0,3,0,0,224,0,0,7,0,0,112,0,0,14,0,0,120,0,0,30,0,0,254,0,0,127,0,1,199,0,0,227,128,3,131,224,7,193,192,7,0,255,255,0,224,6,0,31,248,0,96,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252,0,0,0,0,3,255,0,0,248,0,3,195,192,3,252,0,0,224,192,15,24,0,0,112,96,28,48,31,248,56,48,56,96,255,255,28,48,48,227,224,7,207,24,97,199,0,0,227,152,99,158,0,0,121,216,99,56,0,0,28,248,102,112,12,0,14,112,108,224,12,0,7,48,124,192,6,0,3,0,121,128,6,0,1,128,115,128,6,0,1,192,35,0,6,0,0,192,6,0,6,0,0,96,6,0,3,0,0,96,6,0,3,0,0,96,12,0,3,0,0,48,12,0,3,0,0,48,12,0,1,0,0,48,12,0,1,128,0,48,12,1,255,128,0,48,12,1,255,128,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,6,0,0,0,0,96,6,0,0,0,0,96,6,0,0,0,0,96,3,0,0,0,0,192,3,0,0,0,0,192,1,128,0,0,1,128,1,192,0,0,3,128,0,224,0,0,7,0,0,112,0,0,14,0,0,120,0,0,30,0,0,252,0,0,63,0,1,207,0,0,243,128,3,131,224,7,193,192,7,0,255,255,0,224,6,0,31,248,0,96,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,248,0,0,0,0,7,254,0,0,0,0,7,7,128,0,0,0,3,129,192,7,248,0,0,224,192,15,240,0,0,112,96,28,112,63,252,56,96,56,225,255,255,142,48,112,195,192,3,199,48,97,143,0,0,243,176,195,156,0,0,56,240,199,56,2,0,28,112,198,96,6,0,6,48,204,224,2,0,7,0,221,192,3,0,3,128,249,128,3,0,1,128,115,0,3,0,0,192,99,0,3,0,0,192,38,0,3,0,0,96,6,0,3,0,0,96,6,0,3,0,0,96,12,0,1,0,0,48,12,0,1,128,0,48,12,0,1,128,0,48,12,0,1,128,0,48,12,1,255,128,0,48,12,0,255,128,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,6,0,0,0,0,96,6,0,0,0,0,96,7,0,0,0,0,224,3,0,0,0,0,192,3,128,0,0,1,192,1,128,0,0,1,128,0,192,0,0,3,0,0,96,0,0,6,0,0,112,0,0,14,0,0,120,0,0,30,0,0,238,0,0,119,0,1,199,128,1,227,128,3,129,240,15,129,192,7,0,127,254,0,224,6,0,15,240,0,96},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,254,0,0,127,128,3,255,0,0,255,192,7,14,0,0,112,224,12,28,0,0,56,48,24,56,63,252,28,24,24,113,255,255,142,24,48,227,192,3,199,12,49,207,0,0,243,140,51,156,0,0,57,204,55,56,1,0,28,236,62,96,3,0,6,124,60,224,3,0,7,60,57,192,3,0,3,156,17,128,3,0,1,136,3,0,3,0,0,192,3,0,1,0,0,192,6,0,1,128,0,96,6,0,1,128,0,96,6,0,1,128,0,96,12,0,1,128,0,48,12,0,1,128,0,48,12,0,1,128,0,48,12,0,1,128,0,48,12,1,255,128,0,48,12,0,255,128,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,6,0,0,0,0,96,6,0,0,0,0,96,7,0,0,0,0,224,3,0,0,0,0,192,3,128,0,0,1,192,1,128,0,0,1,128,0,192,0,0,3,0,0,96,0,0,6,0,0,112,0,0,14,0,0,120,0,0,30,0,0,238,0,0,119,0,1,199,128,1,227,128,3,129,240,15,129,192,7,0,127,254,0,224,6,0,15,240,0,96,0,0,0,0,0,0},
  {0,31,0,0,0,0,0,127,224,0,0,0,1,224,224,0,0,0,3,129,192,0,0,0,7,7,0,0,31,224,6,14,0,0,15,240,6,28,63,252,14,56,12,113,254,127,135,28,12,227,192,3,195,14,13,207,0,0,241,134,15,28,0,0,56,195,14,56,1,0,28,227,12,96,1,128,6,99,0,224,1,128,7,51,1,192,1,128,3,155,1,128,1,128,1,159,3,0,1,128,0,206,3,0,1,128,0,198,6,0,1,128,0,96,6,0,1,128,0,96,6,0,1,128,0,96,12,0,1,128,0,48,12,0,1,128,0,48,12,0,1,128,0,48,12,0,1,128,0,48,12,1,255,128,0,48,12,0,255,128,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,6,0,0,0,0,96,6,0,0,0,0,96,7,0,0,0,0,224,3,0,0,0,0,192,3,128,0,0,1,192,1,128,0,0,1,128,0,192,0,0,3,0,0,96,0,0,6,0,0,112,0,0,14,0,0,120,0,0,30,0,0,206,0,0,115,0,1,135,128,1,225,128,3,1,240,15,128,192,6,0,127,254,0,96,4,0,7,224,0,32,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,254,0,0,127,128,3,255,0,0,255,192,7,14,0,0,112,224,12,28,0,0,56,48,24,56,63,252,28,24,24,113,255,255,142,24,48,227,192,3,199,12,49,207,0,0,243,140,51,156,0,0,57,204,55,56,1,128,28,236,62,96,1,128,6,124,60,224,1,128,7,60,57,192,1,128,3,156,17,128,1,128,1,136,3,0,1,128,0,192,3,0,1,128,0,192,6,0,1,128,0,96,6,0,1,128,0,96,6,0,1,128,0,96,12,0,1,128,0,48,12,0,1,128,0,48,12,0,1,128,0,48,12,0,1,128,0,48,12,1,255,128,0,48,12,0,255,128,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,6,0,0,0,0,96,6,0,0,0,0,96,7,0,0,0,0,224,3,0,0,0,0,192,3,128,0,0,1,192,1,128,0,0,1,128,0,192,0,0,3,0,0,96,0,0,6,0,0,112,0,0,14,0,0,120,0,0,30,0,0,238,0,0,119,0,1,199,128,1,227,128,3,129,240,15,129,192,7,0,127,254,0,224,6,0,15,240,0,96,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,248,0,0,0,0,7,254,0,0,0,0,7,7,128,0,0,0,3,129,192,7,248,0,0,224,192,15,240,0,0,112,96,28,112,63,252,56,96,56,225,255,255,142,48,112,195,192,3,199,48,97,143,0,0,243,176,195,156,0,0,56,240,199,56,1,128,28,112,198,96,1,128,6,48,204,224,1,128,7,0,221,192,1,128,3,128,249,128,1,128,1,128,115,0,1,128,0,192,99,0,1,128,0,192,38,0,1,128,0,96,6,0,1,128,0,96,6,0,1,128,0,96,12,0,1,128,0,48,12,0,1,128,0,48,12,0,1,128,0,48,12,0,1,128,0,48,12,1,255,128,0,48,12,0,255,128,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,6,0,0,0,0,96,6,0,0,0,0,96,7,0,0,0,0,224,3,0,0,0,0,192,3,128,0,0,1,192,1,128,0,0,1,128,0,192,0,0,3,0,0,96,0,0,6,0,0,112,0,0,14,0,0,120,0,0,30,0,0,238,0,0,119,0,1,199,128,1,227,128,3,129,240,15,129,192,7,0,127,254,0,224,6,0,15,240,0,96},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,254,0,0,127,128,3,255,0,0,255,192,7,14,0,0,112,224,12,28,0,0,56,48,24,56,63,252,28,24,24,113,255,255,142,24,48,227,192,3,199,12,49,207,0,0,243,140,51,156,0,0,57,204,55,56,1,128,28,236,62,96,1,128,6,124,60,224,1,128,7,60,57,192,1,128,3,156,17,128,1,128,1,136,3,0,1,128,0,192,3,0,1,128,0,192,6,0,1,128,0,96,6,0,1,128,0,96,6,0,1,128,0,96,12,0,1,128,0,48,12,0,1,128,0,48,12,0,1,128,0,48,12,0,1,128,0,48,12,1,255,128,0,48,12,0,255,128,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,6,0,0,0,0,96,6,0,0,0,0,96,7,0,0,0,0,224,3,0,0,0,0,192,3,128,0,0,1,192,1,128,0,0,1,128,0,192,0,0,3,0,0,96,0,0,6,0,0,112,0,0,14,0,0,120,0,0,30,0,0,238,0,0,119,0,1,199,128,1,227,128,3,129,240,15,129,192,7,0,127,254,0,224,6,0,15,240,0,96,0,0,0,0,0,0},
  {0,31,0,0,0,0,0,127,224,0,0,0,1,224,224,0,0,0,3,129,192,0,0,0,7,7,0,0,31,224,6,14,0,0,15,240,6,28,63,252,14,56,12,113,254,127,135,28,12,227,192,3,195,14,13,207,0,0,241,134,15,28,0,0,56,195,14,56,1,128,28,227,12,96,1,128,6,99,0,224,1,128,7,51,1,192,1,128,3,155,1,128,1,128,1,159,3,0,1,128,0,206,3,0,1,128,0,198,6,0,1,128,0,96,6,0,1,128,0,96,6,0,1,128,0,96,12,0,1,128,0,48,12,0,1,128,0,48,12,0,1,128,0,48,12,0,1,128,0,48,12,1,255,128,0,48,12,0,255,128,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,6,0,0,0,0,96,6,0,0,0,0,96,7,0,0,0,0,224,3,0,0,0,0,192,3,128,0,0,1,192,1,128,0,0,1,128,0,192,0,0,3,0,0,96,0,0,6,0,0,112,0,0,14,0,0,120,0,0,30,0,0,206,0,0,115,0,1,135,128,1,225,128,3,1,240,15,128,192,6,0,127,254,0,96,4,0,7,224,0,32,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,254,0,0,127,128,3,255,0,0,255,192,7,14,0,0,112,224,12,28,0,0,56,48,24,56,63,252,28,24,24,113,255,255,142,24,48,227,192,3,199,12,49,207,0,0,243,140,51,156,0,0,57,204,55,56,1,128,28,236,62,96,1,128,6,124,60,224,1,128,7,60,57,192,1,128,3,156,17,128,1,128,1,136,3,0,1,128,0,192,3,0,1,128,0,192,6,0,1,128,0,96,6,0,1,128,0,96,6,0,1,128,0,96,12,0,1,128,0,48,12,0,1,128,0,48,12,0,1,128,0,48,12,0,1,128,0,48,12,1,255,128,0,48,12,0,255,128,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,6,0,0,0,0,96,6,0,0,0,0,96,7,0,0,0,0,224,3,0,0,0,0,192,3,128,0,0,1,192,1,128,0,0,1,128,0,192,0,0,3,0,0,96,0,0,6,0,0,112,0,0,14,0,0,120,0,0,30,0,0,238,0,0,119,0,1,199,128,1,227,128,3,129,240,15,129,192,7,0,127,254,0,224,6,0,15,240,0,96,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,248,0,0,0,0,7,254,0,0,0,0,7,7,128,0,0,0,3,129,192,7,248,0,0,224,192,15,240,0,0,112,96,28,112,63,252,56,96,56,225,255,255,142,48,112,195,192,3,199,48,97,143,0,0,243,176,195,156,0,0,56,240,199,56,1,128,28,112,198,96,1,128,6,48,204,224,1,128,7,0,221,192,1,128,3,128,249,128,1,128,1,128,115,0,1,128,0,192,99,0,1,128,0,192,38,0,1,128,0,96,6,0,1,128,0,96,6,0,1,128,0,96,12,0,1,128,0,48,12,0,1,128,0,48,12,0,1,128,0,48,12,0,1,128,0,48,12,1,255,128,0,48,12,0,255,128,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,6,0,0,0,0,96,6,0,0,0,0,96,7,0,0,0,0,224,3,0,0,0,0,192,3,128,0,0,1,192,1,128,0,0,1,128,0,192,0,0,3,0,0,96,0,0,6,0,0,112,0,0,14,0,0,120,0,0,30,0,0,238,0,0,119,0,1,199,128,1,227,128,3,129,240,15,129,192,7,0,127,254,0,224,6,0,15,240,0,96},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,254,0,0,127,128,3,255,0,0,255,192,7,14,0,0,112,224,12,28,0,0,56,48,24,56,63,252,28,24,24,113,255,255,142,24,48,227,192,3,199,12,49,207,0,0,243,140,51,156,0,0,57,204,55,56,1,128,28,236,62,96,1,128,6,124,60,224,1,128,7,60,57,192,1,128,3,156,17,128,1,128,1,136,3,0,1,128,0,192,3,0,1,128,0,192,6,0,1,128,0,96,6,0,1,128,0,96,6,0,1,128,0,96,12,0,1,128,0,48,12,0,1,128,0,48,12,0,1,128,0,48,12,0,1,128,0,48,12,1,255,128,0,48,12,0,255,128,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,6,0,0,0,0,96,6,0,0,0,0,96,7,0,0,0,0,224,3,0,0,0,0,192,3,128,0,0,1,192,1,128,0,0,1,128,0,192,0,0,3,0,0,96,0,0,6,0,0,112,0,0,14,0,0,120,0,0,30,0,0,238,0,0,119,0,1,199,128,1,227,128,3,129,240,15,129,192,7,0,127,254,0,224,6,0,15,240,0,96,0,0,0,0,0,0},
  {0,31,0,0,0,0,0,127,224,0,0,0,1,224,224,0,0,0,3,129,192,0,0,0,7,7,0,0,31,224,6,14,0,0,15,240,6,28,63,252,14,56,12,113,254,127,135,28,12,227,192,3,195,14,13,207,0,0,241,134,15,28,0,0,56,195,14,56,1,128,28,227,12,96,1,128,6,99,0,224,1,128,7,51,1,192,1,128,3,155,1,128,1,128,1,159,3,0,1,128,0,206,3,0,1,128,0,198,6,0,1,128,0,96,6,0,1,128,0,96,6,0,1,128,0,96,12,0,1,128,0,48,12,0,1,128,0,48,12,0,1,128,0,48,12,0,1,128,0,48,12,1,255,128,0,48,12,0,255,128,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,6,0,0,0,0,96,6,0,0,0,0,96,7,0,0,0,0,224,3,0,0,0,0,192,3,128,0,0,1,192,1,128,0,0,1,128,0,192,0,0,3,0,0,96,0,0,6,0,0,112,0,0,14,0,0,120,0,0,30,0,0,206,0,0,115,0,1,135,128,1,225,128,3,1,240,15,128,192,6,0,127,254,0,96,4,0,7,224,0,32,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,254,0,0,127,128,3,255,0,0,255,192,7,14,0,0,112,224,12,28,0,0,56,48,24,56,63,252,28,24,24,113,255,255,142,24,48,227,192,3,199,12,49,207,0,0,243,140,51,156,0,0,57,204,55,56,1,128,28,236,62,96,1,128,6,124,60,224,1,128,7,60,57,192,1,128,3,156,17,128,1,128,1,136,3,0,1,128,0,192,3,0,1,128,0,192,6,0,1,128,0,96,6,0,1,128,0,96,6,0,1,128,0,96,12,0,1,128,0,48,12,0,1,128,0,48,12,0,1,128,0,48,12,0,1,128,0,48,12,1,255,128,0,48,12,0,255,128,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,6,0,0,0,0,96,6,0,0,0,0,96,7,0,0,0,0,224,3,0,0,0,0,192,3,128,0,0,1,192,1,128,0,0,1,128,0,192,0,0,3,0,0,96,0,0,6,0,0,112,0,0,14,0,0,120,0,0,30,0,0,238,0,0,119,0,1,199,128,1,227,128,3,129,240,15,129,192,7,0,127,254,0,224,6,0,15,240,0,96,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,248,0,0,0,0,7,254,0,0,0,0,7,7,128,0,0,0,3,129,192,7,248,0,0,224,192,15,240,0,0,112,96,28,112,63,252,56,96,56,225,255,255,142,48,112,195,192,3,199,48,97,143,0,0,243,176,195,156,0,0,56,240,199,56,0,64,28,112,198,96,0,96,6,48,204,224,0,192,7,0,221,192,0,192,3,128,249,128,0,192,1,128,115,0,0,192,0,192,99,0,0,192,0,192,38,0,0,192,0,96,6,0,0,192,0,96,6,0,0,192,0,96,12,0,0,128,0,48,12,0,1,128,0,48,12,0,1,128,0,48,12,0,1,128,0,48,12,1,255,128,0,48,12,0,255,128,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,6,0,0,0,0,96,6,0,0,0,0,96,7,0,0,0,0,224,3,0,0,0,0,192,3,128,0,0,1,192,1,128,0,0,1,128,0,192,0,0,3,0,0,96,0,0,6,0,0,112,0,0,14,0,0,120,0,0,30,0,0,238,0,0,119,0,1,199,128,1,227,128,3,129,240,15,129,192,7,0,127,254,0,224,6,0,15,240,0,96},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,254,0,0,127,128,3,255,0,0,255,192,7,14,0,0,112,224,12,28,0,0,56,48,24,56,63,252,28,24,24,113,255,255,142,24,48,227,192,3,199,12,49,207,0,0,243,140,51,156,0,0,57,204,55,56,0,0,28,236,62,96,0,4,6,124,60,224,0,12,7,60,57,192,0,12,3,156,17,128,0,12,1,136,3,0,0,24,0,192,3,0,0,24,0,192,6,0,0,48,0,96,6,0,0,48,0,96,6,0,0,96,0,96,12,0,0,96,0,48,12,0,0,192,0,48,12,0,0,192,0,48,12,0,1,192,0,48,12,1,255,128,0,48,12,0,255,128,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,6,0,0,0,0,96,6,0,0,0,0,96,7,0,0,0,0,224,3,0,0,0,0,192,3,128,0,0,1,192,1,128,0,0,1,128,0,192,0,0,3,0,0,96,0,0,6,0,0,112,0,0,14,0,0,120,0,0,30,0,0,238,0,0,119,0,1,199,128,1,227,128,3,129,240,15,129,192,7,0,127,254,0,224,6,0,15,240,0,96,0,0,0,0,0,0},
  {0,31,0,0,0,0,0,127,224,0,0,0,1,224,224,0,0,0,3,129,192,0,0,0,7,7,0,0,31,224,6,14,0,0,15,240,6,28,63,252,14,56,12,113,254,127,135,28,12,227,192,3,195,14,13,207,0,0,241,134,15,28,0,0,56,195,14,56,0,0,28,227,12,96,0,0,6,99,0,224,0,0,7,51,1,192,0,0,3,155,1,128,0,0,1,159,3,0,0,0,96,206,3,0,0,0,224,198,6,0,0,1,192,96,6,0,0,3,128,96,6,0,0,6,0,96,12,0,0,28,0,48,12,0,0,56,0,48,12,0,0,112,0,48,12,0,0,224,0,48,12,1,255,192,0,48,12,0,255,128,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,6,0,0,0,0,96,6,0,0,0,0,96,7,0,0,0,0,224,3,0,0,0,0,192,3,128,0,0,1,192,1,128,0,0,1,128,0,192,0,0,3,0,0,96,0,0,6,0,0,112,0,0,14,0,0,120,0,0,30,0,0,206,0,0,115,0,1,135,128,1,225,128,3,1,240,15,128,192,6,0,127,254,0,96,4,0,7,224,0,32,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,127,128,0,0,0,1,255,192,0,0,0,3,131,128,0,63,128,7,7,0,0,63,224,14,30,0,0,28,112,12,56,63,252,14,56,12,113,254,127,134,28,24,227,192,3,195,14,25,207,0,0,241,134,31,156,0,0,57,198,30,56,0,0,28,230,12,96,0,0,6,118,8,192,0,0,3,54,1,192,0,0,3,158,1,128,0,0,1,142,3,0,0,0,0,204,3,0,0,0,0,196,6,0,0,0,0,96,6,0,0,0,0,96,6,0,0,0,0,96,12,0,0,0,0,48,12,0,0,0,12,48,12,0,0,3,252,48,12,0,0,255,240,48,12,1,255,252,0,48,12,0,255,128,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,14,0,0,0,0,112,6,0,0,0,0,96,6,0,0,0,0,96,7,0,0,0,0,224,3,0,0,0,0,192,1,128,0,0,1,128,1,128,0,0,1,128,0,192,0,0,3,0,0,96,0,0,6,0,0,112,0,0,14,0,0,120,0,0,30,0,0,206,0,0,115,0,1,135,128,1,225,128,3,1,240,15,128,192,6,0,127,254,0,96,4,0,7,224,0,32,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,254,0,0,127,0,3,255,0,0,255,192,7,14,0,0,112,224,14,28,0,0,56,112,28,56,31,248,28,56,24,112,255,255,14,24,48,227,224,7,199,12,49,207,0,0,243,140,51,156,0,0,57,204,55,56,0,0,28,236,62,112,0,0,14,124,60,224,0,0,7,60,57,192,0,0,3,156,17,128,0,0,1,136,3,0,0,0,0,192,3,0,0,0,0,192,6,0,0,0,0,96,6,0,0,0,0,96,6,0,0,0,0,96,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,1,255,128,0,48,12,1,255,240,0,48,12,0,0,124,0,48,12,0,0,31,0,48,12,0,0,3,192,48,12,0,0,0,240,48,6,0,0,0,56,96,6,0,0,0,0,96,6,0,0,0,0,96,3,0,0,0,0,192,3,128,0,0,1,192,1,128,0,0,1,128,0,192,0,0,3,0,0,224,0,0,7,0,0,112,0,0,14,0,0,120,0,0,30,0,0,254,0,0,127,0,1,199,0,0,227,128,3,131,224,7,193,192,7,0,255,255,0,224,6,0,31,248,0,96,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,254,0,0,127,0,3,255,0,0,255,192,7,14,0,0,112,224,14,28,0,0,56,112,28,56,31,248,28,56,24,112,255,255,14,24,48,227,224,7,199,12,49,207,0,0,243,140,51,156,0,0,57,204,55,56,0,0,28,236,62,112,0,0,14,124,60,224,0,0,7,60,57,192,0,0,3,156,17,128,0,0,1,136,3,0,0,0,0,192,3,0,0,0,0,192,6,0,0,0,0,96,6,0,0,0,0,96,6,0,0,0,0,96,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,1,255,128,0,48,12,1,255,128,0,48,12,0,0,192,0,48,12,0,0,192,0,48,12,0,0,96,0,48,12,0,0,96,0,48,6,0,0,48,0,96,6,0,0,56,0,96,6,0,0,24,0,96,3,0,0,28,0,192,3,128,0,12,1,192,1,128,0,14,1,128,0,192,0,6,3,0,0,224,0,6,7,0,0,112,0,0,14,0,0,120,0,0,30,0,0,254,0,0,127,0,1,199,0,0,227,128,3,131,224,7,193,192,7,0,255,255,0,224,6,0,31,248,0,96,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,254,0,0,127,0,3,255,0,0,255,192,7,14,0,0,112,224,14,28,0,0,56,112,28,56,31,248,28,56,24,112,255,255,14,24,48,227,224,7,199,12,49,207,0,0,243,140,51,156,0,0,57,204,55,56,0,0,28,236,62,112,0,0,14,124,60,224,0,0,7,60,57,192,0,0,3,156,17,128,0,0,1,136,3,0,0,0,0,192,3,0,0,0,0,192,6,0,0,0,0,96,6,0,0,0,0,96,6,0,0,0,0,96,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,1,255,128,0,48,12,1,255,128,0,48,12,0,1,128,0,48,12,0,3,0,0,48,12,0,3,0,0,48,12,0,3,0,0,48,6,0,3,0,0,96,6,0,6,0,0,96,6,0,6,0,0,96,3,0,6,0,0,192,3,128,6,0,1,192,1,128,6,0,1,128,0,192,12,0,3,0,0,224,12,0,7,0,0,112,12,0,14,0,0,120,0,0,30,0,0,254,0,0,127,0,1,199,0,0,227,128,3,131,224,7,193,192,7,0,255,255,0,224,6,0,31,248,0,96,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,254,0,0,127,0,3,255,0,0,255,192,7,14,0,0,112,224,14,28,0,0,56,112,28,56,31,248,28,56,24,112,255,255,14,24,48,227,224,7,199,12,49,207,0,0,243,140,51,156,0,0,57,204,55,56,0,0,28,236,62,112,0,0,14,124,60,224,0,0,7,60,57,192,0,0,3,156,17,128,0,0,1,136,3,0,0,0,0,192,3,0,0,0,0,192,6,0,0,0,0,96,6,0,0,0,0,96,6,0,0,0,0,96,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,1,255,128,0,48,12,1,255,128,0,48,12,0,14,0,0,48,12,0,28,0,0,48,12,0,120,0,0,48,12,0,224,0,0,48,6,3,192,0,0,96,6,7,0,0,0,96,6,14,0,0,0,96,3,0,0,0,0,192,3,128,0,0,1,192,1,128,0,0,1,128,0,192,0,0,3,0,0,224,0,0,7,0,0,112,0,0,14,0,0,120,0,0,30,0,0,254,0,0,127,0,1,199,0,0,227,128,3,131,224,7,193,192,7,0,255,255,0,224,6,0,31,248,0,96,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,254,0,0,127,0,3,255,0,0,255,192,7,14,0,0,112,224,14,28,0,0,56,112,28,56,31,248,28,56,24,112,255,255,14,24,48,227,224,7,199,12,49,207,0,0,243,140,51,156,0,0,57,204,55,56,0,0,28,236,62,112,0,0,14,124,60,224,0,0,7,60,57,192,0,0,3,156,17,128,0,0,1,136,3,0,0,0,0,192,3,0,0,0,0,192,6,0,0,0,0,96,6,0,0,0,0,96,6,0,0,0,0,96,12,0,0,0,0,48,12,0,0,0,0,48,12,48,0,0,0,48,12,63,248,0,0,48,12,7,255,128,0,48,12,1,255,128,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,12,0,0,0,0,48,6,0,0,0,0,96,6,0,0,0,0,96,6,0,0,0,0,96,3,0,0,0,0,192,3,128,0,0,1,192,1,128,0,0,1,128,0,192,0,0,3,0,0,224,0,0,7,0,0,112,0,0,14,0,0,120,0,0,30,0,0,254,0,0,127,0,1,199,0,0,227,128,3,131,224,7,193,192,7,0,255,255,0,224,6,0,31,248,0,96,0,0,0,0,0,0,0,0,0,0,0,0}
};

void setup() {

  servo.attach(5);
  pinMode(irsensor, INPUT);
  pinMode(buzzer, OUTPUT);
  display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR);
  display.clearDisplay();


  display.setCursor(0, 0);
  
  display.setTextSize(1.7);
  display.setTextColor(WHITE);
  display.println("Smart Pill Dispenser");
  display.println("by");
  display.println("Danny");

  display.display();

  delay(3000);
  display.clearDisplay();

  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(0, 0);
  display.println("Welcome");

  display.display();
  delay(2000);

  timings();

  delay(4000);

}


void loop() {
  int sensor = digitalRead(irsensor);
  time();

  if ((myRTC.hours == morninghour) and (myRTC.minutes == morningminute)) {
    alarmon = 1;
}

   while (alarmon == 1) {
    alarm();
  }

  if (sensor == 1) {
    if (alarmon == 1){
      delay(100);
          servo.write(20);
          delay(200);
          servo.write(90);
          alarmon = 0;
    }
  
  }
  }
  }
 
  display.display();
  display.clearDisplay();
  delay(10);
  
  
}

void time() {
  display.setTextSize(4);
  display.clearDisplay();
  myRTC.updateTime();
  display.setCursor(0, 0);
  display.print(myRTC.hours);
  display.print(":");
  if (myRTC.minutes >= 10) {
    display.print(myRTC.minutes);
  }
  else {
    display.print("0");
    display.print(myRTC.minutes);
  }
}

void timings() {
  display.clearDisplay();
  display.setCursor(0, 0);
  display.setTextSize(1.7);
  display.print("Wake up: ");
  display.print(morninghour);
  display.print(":");
  display.print(morningminute);
  display.setCursor(0, 20);
  display.setTextSize(1.7);
  display.print("Sleep: ");
  display.print(eveninghour);
  display.print(":");
  display.print(eveningminute);
  display.display();
}

int frame = 0;
void alarm() {

  display.clearDisplay();
  display.drawBitmap(40, 8, frames[frame], FRAME_WIDTH, FRAME_HEIGHT, 1);
  display.display();
  frame = (frame + 1) % FRAME_COUNT;
  //delay(FRAME_DELAY);
  return;
  
}

void sound() {
  tone(6, 1000);
  delay(100);
  noTone(6);
  delay(100);
  tone(6, 1000);
  delay(100);
  noTone(6);
  delay(100);
  tone(6, 1000);
  delay(100);
  noTone(6);
  delay(600);
}

Thank you very much for any help.

Test the OLED by uploading one of the example sketches that came with the Adafruit library.

Do you have any other i2c devices you could use to test the i2c bus? If so, try the scanner sketch with that other i2c device connected and the display not connected and with both connected.

Try adding some pull-up resistors on the i2c wires. 4K7 would be ideal but 10K should also work.

It's not clear if the display shares a common ground with the Nano. If not, that could be the problem.

I tried uploading the Adafruit example; I specified the address to be 0x3C which is what my original program had, as I think I ran an i2c scanner back then and the display came up as this (however the Adafruit program states that 128x64 displays should be 0x3D). With the example running, once again the screen remains black.

Adding pull-up resistors would be very difficult for me here, since I have a custom PCB for the project, and jumper wires from each component just plug into header pins on it.

Regarding the grounding, everything is shared ground; I have an LM7805 voltage regulator circuit integrated into the PCB, and have tried powering the Arduino through that, as well as via USB, to no avail.

I also don't have any more i2c devices to test. I think that, since two different nano's both do not work, it is unlikely to be a board problem. The project worked perfectly a few months ago when I had finished it, so I know that the code is also not the issue. Considering the fact that the i2c scanner fails to detect the display, aren't connections or a faulty screen the most probable cause? I have just gone and ordered another display on Amazon - it will arrive tomorrow.

Can you post a picture of the wiring?

It would be near impossible to see clearly; everything is inside the housing, and the PCB is glued down - there is a great tangle of wires. I could still send a picture if you wish, but what specifically are you looking for? There are two access doors on different sides, so I could try get a clear picture of anything you'd like to see.

I was mainly interested in whether you were relying on jumper wires, or had soldered connections, and in whether or not the connectors were soldered properly to the display, nano, etc. Occasionally someone will come on here with a similar problem and it turns out they bought a nano without headers and were relying on a friction fit of the wiring to the nano instead of actually soldering the wires or headers onto the nano.

I think the problem may be related to how the reset pin on the display is connected

ah, all of the headers are soldered, and each component is connected via jumper wires. I'm thinking of trying to solder it all, but it will be difficult considering the tight space

I've just run the i2c scanner again, and a couple times it did say that it found an i2c device on address 0x3C. However, after that it stopped finding it and hasn't again since. Could this be because of loose connections or a faulty screen?