<TheTechWiz/>
All projects
Completed

Crystal Ball

An Arduino Crystal Ball, that works just like a Magic 8-Ball.

Arduino as a Learning Platform

Arduino was my gateway into electronics. Before Raspberry Pi, before Jetson, before any serious hardware projects — there was Arduino. A microcontroller you could program in a simplified C++ environment, with tons of tutorials and a huge community.

I built several small projects with Arduino before moving to more complex platforms.

Crystal Ball Project

The Crystal Ball is an Arduino-powered Magic 8-Ball. To activate the ball, press a button, and then it displays an answer on an LCD screen.

Hardware

  • Arduino Uno — The brains
  • 16x2 LCD display — Shows the responses
  • Button — Detects pressing to trigger a new answer

How It Works

#include <LiquidCrystal.h>
 
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
 
const int switchPin = 6;
 
int switchState = 0;
 
int prevSwitchState = 0;
 
int reply;
 
void setup() {
 
	lcd.begin(16, 2);
	
	pinMode(switchPin, INPUT);
 
	lcd.print("Ask the");
 
	lcd.setCursor(0, 1);
 
	lcd.print("Crystal Ball!");
}
 
void loop() {
    switchState = digitalRead(switchPin);
 
    if (switchState == LOW) {
        reply = random(8);
        lcd.clear();
        lcd.setCursor(0, 0);
        lcd.print("The Ball Says:");
        lcd.setCursor(0, 1);
 
        switch (reply) {
            case 0: lcd.print("Yes");             break;
            case 1: lcd.print("Most Likely");     break;
            case 2: lcd.print("Certainly");       break;
            case 3: lcd.print("Outlook Good");    break;
            case 4: lcd.print("Unsure");          break;
            case 5: lcd.print("Ask Again Later"); break;
            case 6: lcd.print("Doubtful");        break;
            case 7: lcd.print("No");              break;
        }
    }
 
    prevSwitchState = switchState;
}

The ball triggers when the button is pressed, picking a random response from the array and displaying it.

What I Learned

Arduino taught me the fundamentals that everything else builds on: digital I/O, analog sensing, PWM, serial communication, timing with millis() instead of delay(). It helped me understand Arduino, and later move onto Raspberry Pi.