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

Arduino Uno-Based Digital Enigma Machine with OLED Display and Pushbutton Interface

View and Edit Project In Cirkit DesignerImage of Arduino Uno-Based Digital Enigma Machine with OLED Display and Pushbutton Interface

Circuit Documentation

Summary

This circuit consists of an Arduino Uno R3 microcontroller, an Adafruit OLED Monochrome 0.91in I2C display, multiple pushbuttons, and resistors. The circuit is designed to interface with the OLED display and handle multiple pushbutton inputs. The Arduino Uno is programmed to display information on the OLED screen and process input from the pushbuttons.

Component List

Adafruit OLED Monochrome 0.91in I2C with STEMMA QT

Arduino Uno R3

Pushbutton

Resistor

Wiring Details

Adafruit OLED Monochrome 0.91in I2C with STEMMA QT

Arduino Uno R3

Pushbutton

Resistor

Code Documentation

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

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels
#define totalWheels 3
#define totalElements 26
#define debug false

#define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

int wheels[3][26] = {
  { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 },
  { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 },
  { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }
};

String seeds[3] = {
  "mantu",
  "loves",
  "girls"
};

int btED = 13;
int btABC = 12;
int btDEF = 11;
int btGHI = 10;
int btJKL = 9;
int btMNO = 8;
int btPQRS = 7;
int btTUV = 6;
int btWXYZ = 5;

int mode = 1;               // 1 - encode | 2 - decode
int lastButtonPressed = 0;  // time

int lastButtonNo = 0;
int buttonIndex = 0;

char alphabets[8][4] = {
  { 'A', 'B', 'C', '-' },  // 2
  { 'D', 'E', 'F', '-' },  // 3
  { 'G', 'H', 'I', '-' },  // 4
  { 'J', 'K', 'L', '-' },  // 5
  { 'M', 'N', 'O', '-' },  // 6
  { 'P', 'Q', 'R', 'S' },  // 7
  { 'T', 'U', 'V', '-' },  // 8
  { 'W', 'X', 'Y', 'Z' }   // 9
};

int buttonStatus = 0;
bool handlingISR = false;
int lastDisplayRefreshed = 0;
char lastResult = ' ';

void setup() {
  pinMode(btED, INPUT_PULLUP);
  pinMode(btABC, INPUT);
  pinMode(btDEF,