Build an RFID access control console that displays real-time status and control information on a compact OLED screen. This Arduino-based system combines a 128x64 SSD1306 display with a PS2 joystick module to create an interactive interface for monitoring and managing access points.
The guide includes a complete wiring diagram showing how to connect the OLED display via I2C and the joystick module to the Arduino Uno, a full parts list, ready-to-upload firmware with serial communication support, and step-by-step assembly instructions. Builders will learn how to interface multiple input devices with an Arduino while managing a small display in a space-constrained design.
Wiring diagram
Gather all the parts
Assemble it in 2 steps
1. اتصال نمایشگر
«USB را جدا کن. فقط اگر OLED با ۳٫۳ ولت کار میکند و مقاومتهای خطوط SDA و SCL روی ماژول به همان ۳٫۳ ولت وصلاند، VCC را به 3.3V، GND را به زمین، SDA را به A4 و SCL را به A5 وصل کن. برای ماژول نامشخص، مستقیم وصل نکن.»
2. اتصال جویاستیک
«۵V به ۵V، GND به GND، VRX به A0، VRY به A1 و SW به D2. سپس USB را وصل کن و Deploy را بزن. کارتخوان وصل نمیشود.»
Review all connections
1. Connections between "oled" and "Arduino"
2. Connections between "joy" and "Arduino"
Deploy the firmware
#include <Arduino.h>
#include <U8g2lib.h>
#include <avr/pgmspace.h>
U8G2_SSD1306_128X64_NONAME_1_SW_I2C screen(U8G2_R0,A5,A4);
uint8_t gpio(u8x8_t *u,uint8_t m,uint8_t a,void *p){
if(m==U8X8_MSG_GPIO_AND_DELAY_INIT) return 1;
if(m==U8X8_MSG_GPIO_I2C_CLOCK || m==U8X8_MSG_GPIO_I2C_DATA){
uint8_t pin=m==U8X8_MSG_GPIO_I2C_CLOCK?A5:A4;
digitalWrite(pin,LOW); pinMode(pin,a?INPUT:OUTPUT); return 1;
}
return u8x8_gpio_and_delay_arduino(u,m,a,p);
}
#include "labels.h"
char values[5][24]={"--","--","--","--","--"}, line[25];
uint8_t pos,page; bool held,pressed,dirty=true,blank;
uint32_t last[5],tick;
extern char __heap_start,*__brkval;
int ram(){char x; return &x-(__brkval?__brkval:&__heap_start);}
void label(uint8_t n,int y){char b[48]; strcpy_P(b,(PGM_P)pgm_read_ptr(&labels[n])); screen.setFont(u8g2_font_cu12_t_arabic); screen.drawUTF8(124-screen.getUTF8Width(b),y,b);}
void value(const char *s,int y){screen.setFont(u8g2_font_6x12_tr); screen.drawStr(4,y,s);}
const char *get(uint8_t i,uint32_t t){return last[i] && t-last[i]< (i<2?10000UL:240000UL)?values[i]:"--";}
void setup(){pinMode(2,INPUT_PULLUP); Serial.begin(115200); screen.getU8x8()->gpio_and_delay_cb=gpio; screen.begin();}
void loop(){
uint32_t t=millis();
while(Serial.available()){
int c=Serial.read(); if(c=='\r')continue;
if(c=='\n'){if(pos>=2 && pos<sizeof(line) && line[0]>='0' && line[0]<='4'){uint8_t i=line[0]-'0';line[pos]=0;if(strcmp(values[i],line+1)){strcpy(values[i],line+1);dirty=true;} if(!last[i] || !strcmp(get(i,t),"--"))dirty=true;last[i]=t;}pos=0;}
else if(pos<sizeof(line)){line[pos++]=c;}
}
int x=analogRead(A0); if(x>400 && x<624)held=false;
if(!held && (x<250 || x>774)){held=true;page=(page+(x>774?1:4))%5;dirty=true;}
bool sw=!digitalRead(2); static uint32_t button; if(sw && !pressed && t-button>250){button=t;blank=!blank;screen.setPowerSave(blank);dirty=true;} pressed=sw;
static uint8_t expired; uint8_t mask=0; for(uint8_t i=0;i<5;i++) if(!strcmp(get(i,t),"--"))mask|=1<<i; if(mask!=expired){expired=mask;dirty=true;}
if(page==3 && t/1000!=tick){tick=t/1000;dirty=true;}
if(page==4 && t/200!=tick){tick=t/200;dirty=true;}
if(!dirty || blank)return; dirty=false;
char a[22],b[22]; if(page==3){snprintf(a,sizeof a,"UP %lus",t/1000);snprintf(b,sizeof b,"RAM ~%d B",ram());}
if(page==4){snprintf(a,sizeof a,"X %d",x);snprintf(b,sizeof b,"Y %d",analogRead(A1));}
screen.firstPage(); do {
label(page,12);screen.drawHLine(0,16,128);
if(page==0){value(get(0,t),33);value(get(1,t),49);}
if(page==1){value(get(2,t),39);}
if(page==2){value(get(3,t),32);value(get(4,t),48);}
if(page>=3){value(a,32);value(b,48);}
for(uint8_t i=0;i<5;i++) {if(i==page)screen.drawBox(40+i*10,58,6,4);else screen.drawFrame(40+i*10,58,6,4);}
}while(screen.nextPage());
}Remix this project
Make it yours in one click
Open a full copy of this project in your own Schematik workspace, diagram, code, parts, and assembly steps included. Swap the sensor, add features, or redesign the whole thing with AI. The author's original stays untouched.




