Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

ATtiny85 and OLED Display Based Interactive Game with Buzzer and LED

View and Edit Project In Cirkit DesignerImage of ATtiny85 and OLED Display Based Interactive Game with Buzzer and LED

Circuit Documentation

Summary

This circuit is designed to control an OLED display, a buzzer, and an LED using an ATtiny85 microcontroller. The circuit also includes a rocker switch, pushbuttons, and resistors to manage the flow of current and user inputs. The OLED display shows a menu with options, and the pushbuttons allow the user to interact with the menu. The buzzer and LED provide audio and visual feedback, respectively.

Component List

  1. 5V Battery

    • Pins: Positive, Negative
    • Description: Provides power to the circuit.
  2. LED: Two Pin (Red)

    • Pins: Cathode, Anode
    • Description: Provides visual feedback.
  3. ATtiny85

    • Pins: PB5, PB3, PB4, GND, Vcc, PB2, PB1, PB0
    • Description: Microcontroller that controls the OLED display, buzzer, and LED.
  4. 0.96" OLED

    • Pins: GND, VDD, SCK, SDA
    • Description: Displays text and menu options.
  5. Buzzer

    • Pins: PIN, GND
    • Description: Provides audio feedback.
  6. Rocker Switch

    • Pins: 1, 2
    • Description: Controls the power supply to the circuit.
  7. Red Pushbutton

    • Pins: Pin 2, Pin 1, Pin 3, Pin 4
    • Description: User input for interacting with the menu.
  8. Pushbutton

    • Pins: Pin 2, Pin 1, Pin 3, Pin 4
    • Description: Additional user input for interacting with the menu.
  9. Resistor (5.5 Ohms)

    • Pins: Pin1, Pin2
    • Description: Limits current flow.
  10. Resistor (1 Ohm)

    • Pins: Pin1, Pin2
    • Description: Limits current flow.

Wiring Details

5V Battery

LED: Two Pin (Red)

ATtiny85

0.96" OLED

Buzzer

Rocker Switch

Red Pushbutton

Pushbutton

Additional Pushbutton

Resistor (5.5 Ohms)

Resistor (1 Ohm)

Code Documentation

ATtiny85 Code

/*
 * This Arduino Sketch initializes the OLED display, shows the text "DRAXION",
 * and then presents a menu with options "JEU" and "OPTION". If the "JEU"
 * option is selected, it will start the game on the ATtiny85 microcontroller.
 */

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

#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET    -1
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

#define BUTTON_PIN 2

void setup() {
  pinMode(BUTTON_PIN, INPUT);
  if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
    for(;;);
  }
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(0,0);
  display.println(F("DRAXION"));
  display.display();
  delay(2000);
  showMenu();
}

void showMenu() {
  display.clearDisplay();
  display.setCursor(0,0);
  display.println(F("1. JEU"));
  display.println(F("2. OPTION"));
  display.display();
}

void loop() {
  if(digitalRead(BUTTON_PIN) == HIGH) {
    startGame();
  }
}

void startGame() {
  // Code to start the game on ATtiny85
}

OLED Code

/*
 * This Arduino Sketch initializes the OLED display, shows the text "DRAXION",
 * and then presents a menu with options "JEU" and "OPTION". If the "JEU"
 * option is selected, it will start the game on the ATtiny85 microcontroller.
 */

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

#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET    -1
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

#define BUTTON_PIN 2

void setup() {
  pinMode(BUTTON_PIN, INPUT);
  if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
    for(;;);
  }
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(0,0);
  display.println(F("DRAXION"));
  display.display();
  delay(2000);
  showMenu();
}

void showMenu() {
  display.clearDisplay();
  display.setCursor(0,0);
  display.println(F("1. JEU"));
  display.println(F("2. OPTION"));
  display.display();
}

void loop() {
  if(digitalRead(BUTTON_PIN) == HIGH) {
    startGame();
  }
}

void startGame() {
  // Code to start the game on ATtiny85
}

This documentation provides a comprehensive overview of the circuit, including the components used, their wiring details, and the code running on the microcontrollers.