Electronic identity card using oled

DIY Electronic ID Card with Round Display (ESP32-C3 and GC9A01) | Kids Robotics | MakeMindz
MakeMindz

DIY Electronic ID Card with a Round Display

Turn your name badge into a glowing gadget! Our electronic ID card shows your name, class and favourite things on a round screen, with a sparkling dot that races around the edge. Press a button to flip to the next page.

  • Level: Beginner+
  • Time: about 2 hours
  • Ages 10+ (with an adult helper)

What are we building?

An electronic ID card is a name badge with a tiny screen inside. The ESP32-C3 is its brain, a round display is its face, and a small rechargeable battery lets you wear it on a lanyard. A push button flips between four pages: Hello, School, Hobbies and ID number.

Design yours: type your details and tap the pages. The code lines below the card update, ready to copy into the Arduino sketch.


Privacy tip: Never put your home address, phone number or full name on a badge. Use your first name, your class and fun facts only, because strangers can read your badge too.

What you need

PartHow many
ESP32-C3 SuperMini board1
1.28 inch round display, 240×240, GC9A01, SPI (7 pins)1
Small push button1
3.7V LiPo battery (300–500 mAh) with protection1
TP4056 charger module with protection (6 pads)1
Tiny slide switch1
Jumper wires, breadboard, double-sided tape1 set
Card, thick foam board or a 3D-printed case, plus a lanyard1
About the “round OLED”: the popular 1.28 inch round screens are usually sold as “round OLED”, but the GC9A01 type is really a full-colour LCD. It is bright and works great with this code. If your screen is a true small round OLED (such as 0.71 inch), it uses a different chip and library, so check its datasheet and tell us which one you have.
Battery safety: Only an adult should connect the battery. Use a protected battery, check + and − twice, never puncture or squash it, never charge it alone, and stop using it if it gets hot or puffy. Cover the back of the card so no bare wire can touch metal.

How it works

  • SPI: the round display listens to the ESP32-C3 through a fast data line (SPI). Each pixel is a tiny dot of colour.
  • Pages: the code draws one page of text at a time. A button press (or a timer) draws the next page.
  • Animation: a pink dot circles the screen by calculating its place with sine and cosine, then erasing the old spot.
  • Power: the TP4056 charges the battery from a USB cable, and a switch turns the badge on and off.

Circuit diagram

ESP32-C3 SuperMini 3V3GNDGPIO4 (SCK)GPIO6 (MOSI)GPIO3 (DC)GPIO7 (CS)GPIO2 (RST) GPIO1 Round display VCCGNDSCLSDADCCSRST Page button (other leg to GND) LiPoTP4056Switch to ESP32-C3 5V pin Battery B+/B− to TP4056 B+/B−. Power out (OUT+/OUT−) goes through the switch. All GND wires join together.

Pin table

ESP32-C3 pinRound display / part
3V3VCC
GNDGND
GPIO4SCL (clock)
GPIO6SDA (data)
GPIO3DC
GPIO7CS
GPIO2RST
GPIO1Page button, other leg to GND
5V pinTP4056 OUT+ through the slide switch
GNDTP4056 OUT−
The display’s BLK pin (if it has one) can stay unconnected, because the backlight is usually already on. Not every ESP32-C3 SuperMini is wired the same, so check your board for the SPI pins SCK 4, MOSI 6 and CS 7. With a multimeter, check that the battery gives about 3.7–4.2V at the 5V pin before connecting the board.

Step-by-step instructions

  1. Test the display on a breadboard

    With no battery and the USB cable only, wire the round display and the button to the ESP32-C3 as in the pin table. Install the esp32 by Espressif board package. In Library Manager install Adafruit GC9A01A and Adafruit GFX Library.

  2. Upload the code

    Choose Tools > Board > ESP32C3 Dev Module and turn USB CDC On Boot to Enabled. Paste the code below and click Upload. The first page should appear with a pink dot running round the edge. Press the button to flip pages.

  3. Make it yours

    Use the card designer above to try your name, class, school and hobby. Copy the code lines it creates into the top of the sketch, replacing the sample ones. Upload again.

  4. Add battery power

    With an adult, wire the LiPo, TP4056 and switch as in the diagram, with the switch off. Connect the switch output to the ESP32-C3 5V pin last. Switch the battery off before you plug in USB to upload new code.

  5. Build the card case

    Cut a round window in thick card or foam board and fit the display behind it. Tape the board and battery on the back, keeping the TP4056 USB port reachable for charging. Add a hole for the lanyard, a button on the side, and cover the back with tape.

Arduino code

#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_GC9A01A.h>

#define TFT_CS  7
#define TFT_DC  3
#define TFT_RST 2
#define BTN_PIN 1

// ---- Edit these to make the card yours (keep them short!) ----
const char* NAME   = "ARYA";
const char* CLASS_ = "Class 6A";
const char* SCHOOL = "Sunrise School";
const char* HOBBY  = "ROBOTS";
const char* ID_NO  = "MM-001";
// ---------------------------------------------------------------

// Colours (RGB565)
#define BG     0x08E6   // dark navy
#define WHITE  0xFFFF
#define YELLOW 0xFE47
#define PINK   0xFB51
#define BLUE   0x2BFC
#define MINT   0x2DD1

Adafruit_GC9A01A tft(TFT_CS, TFT_DC, TFT_RST);   // uses the default SPI pins

const int NUM_PAGES = 4;
int page = 0;
unsigned long lastChange = 0, lastDot = 0;
int dotX = -100, dotY = -100;
float angle = 0;
bool lastBtn = HIGH;

// Draw text centred, shrinking it until it fits the width
void centerText(const char* s, int y, int maxSize, uint16_t color, int maxW = 170) {
  int size = maxSize;
  while (size > 1 && (int)strlen(s) * 6 * size > maxW) size--;
  int w = strlen(s) * 6 * size;
  tft.setTextSize(size);
  tft.setTextColor(color);
  tft.setCursor(120 - w / 2, y);
  tft.print(s);
}

void drawPage(int p) {
  tft.fillScreen(BG);
  for (int r = 116; r <= 119; r++) tft.drawCircle(120, 120, r, BLUE);   // ring
  dotX = -100;                                                           // forget old dot

  if (p == 0) {
    centerText("HELLO!", 45, 3, YELLOW);
    centerText("my name is", 85, 2, WHITE);
    centerText(NAME, 115, 5, PINK);
    centerText("ROBOT MAKER", 175, 2, MINT);
  } else if (p == 1) {
    centerText("I STUDY AT", 50, 2, WHITE);
    centerText(SCHOOL, 90, 3, YELLOW);
    centerText(CLASS_, 140, 3, PINK);
  } else if (p == 2) {
    centerText("I LOVE", 55, 3, WHITE);
    centerText(HOBBY, 100, 4, YELLOW);
    for (int i = 0; i < 3; i++) tft.fillCircle(90 + i * 30, 175, 9, i == 1 ? PINK : MINT);
  } else {
    centerText("ID CARD", 50, 3, WHITE);
    centerText(ID_NO, 95, 4, YELLOW);
    centerText("MakeMindz Club", 150, 2, MINT);
    centerText("Made by me!", 180, 2, PINK);
  }
}

void setup() {
  pinMode(BTN_PIN, INPUT_PULLUP);
  tft.begin(40000000);          // 40 MHz SPI
  tft.setRotation(0);
  drawPage(0);
  lastChange = millis();
}

void loop() {
  unsigned long now = millis();

  // Button: next page
  bool btn = digitalRead(BTN_PIN);
  if (lastBtn == HIGH && btn == LOW) {
    page = (page + 1) % NUM_PAGES;
    drawPage(page);
    lastChange = now;
    delay(50);                  // debounce
  }
  lastBtn = btn;

  // Auto-flip every 8 seconds
  if (now - lastChange > 8000) {
    page = (page + 1) % NUM_PAGES;
    drawPage(page);
    lastChange = now;
  }

  // Animated dot orbiting inside the ring
  if (now - lastDot > 30) {
    lastDot = now;
    if (dotX >= 0) tft.fillCircle(dotX, dotY, 5, BG);            // erase old dot
    angle += 0.12;
    dotX = 120 + (int)(106 * cos(angle));
    dotY = 120 + (int)(106 * sin(angle));
    tft.fillCircle(dotX, dotY, 4, PINK);
  }
}
Tip: Long words get small automatically so they fit. Keep your name to 10 letters or fewer and your school to 16 letters or fewer for the best look. If you do not like the auto-flip, delete the “Auto-flip” block.

Tips and troubleshooting

The screen stays black

Check VCC, GND and all five signal wires (SCL, SDA, DC, CS, RST). Make sure you chose the ESP32C3 board, and try pressing the board’s reset button.

The colours look wrong

Some round displays swap red and blue. Try swapping the colour values in the code, or search for your display’s “colour order” setting.

The picture is rotated or the text is cut off

Change tft.setRotation(0) to 1, 2 or 3. Shorten long words, because the corners of a round screen are cut off.

Nothing happens when I press the button

Check that one leg of the button goes to GPIO1 and the other to GND. The code turns on the built-in pull-up resistor, so no resistor is needed.

It restarts on battery power

Check the battery is charged, that the switch contacts are solid, and that the battery wires are firmly connected. Add a 100 µF capacitor across the 5V pin and GND.

My display has a different chip

The code above is only for the GC9A01. For another chip you need a different library and different setup lines.

What did we learn?

  • SPI is a fast way for a microcontroller to send pictures to a screen.
  • Colours in code are stored as numbers, called RGB565.
  • Sine and cosine help us move things in circles.
  • Privacy means choosing carefully what to share about yourself.

Try these challenges

  • Add a fifth page with a fun fact or a joke.
  • Draw a robot face or logo with fillCircle and fillRect.
  • Add a battery level page using the ESP32-C3’s analog input and two resistors.
  • Use Wi-Fi so your phone can change the name without uploading code.

Questions kids ask

Can I use a different ESP32 board?

Yes, but the pin numbers will be different. Change the #define lines and connect the SPI wires to your board’s SPI pins.

How long does the battery last?

A 400 mAh battery usually lasts a few hours with the screen on. Turning the switch off when you are not wearing it helps a lot.

Can this open doors or replace my school ID?

No. It is a fun name badge and does not work as a real ID or key. It is also a good reason to learn about how real smart cards stay secure.

Show who you are with a gadget you built yourself! Made your own ID card? Share it with us.

Follow MakeMindz for more kids robotics and maker projects.

Comments

Product Cards
Buddy Bot eBook
⭐ New 2026 Release
Build Your
Own Robot!
3D design, wiring &
Arduino coding.
★★★★★ Young inventors love it!
🖨️
3D Print
All parts
⚡
Wire it
Circuit guide
💻
Code it
Arduino IDE
🤖
Watch it
Walk & react
📋 Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Website Offer
₹499 ₹300
🌍 International: $5 USD
One-time · Instant digital delivery
🔒 Secured by Razorpay · Your data is safe
📄 Download Free Sample Copy
🔒 Secured by Razorpay · Your data is safe
🍓
Raspberry Pi Pico Mastery
21 Projects
⚡ Launch Price — 80% OFF
Learn Pico
Build 21 Projects!
MicroPython · Wokwi
IoT · Certificate
★★★★★ Perfect for beginners!
🖥️
Wokwi
No hardware
🐍
MicroPy
From zero
🔨
21 Projects
IoT + sensors
📄
Certificate
Verified cert
📋 Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Launch Offer
₹999 ₹200 80% OFF
🌍 International: $5 USD
One-time · Lifetime access · No subscription
🔒 Secured by Razorpay · UPI · Cards · NetBanking
🎉

You're in!

Payment successful! Your Buddy Bot eBook is ready. Time to build!

📖 Access Your eBook Now
🎉

Enrolled!

Payment successful! Lifetime access to all 21 Pico Projects is yours!

🍓 Go to My Course