Arduino Basics Lesson 2-3: (Liquid) Crystal Ball

Arduino Basics Lesson 2-3: (Liquid) Crystal Ball

For the “Arduino For Kooks” course, I recommend you get the Arduino Starter Kit available here.

The Arduino, despite its simplicity, is a very powerful electronics platform and it can do so much more than blink LEDs or make noises with a buzzer. In this project, we’re going to connect a simple character LCD to the Arduino and use it to display some randomly selected custom text.

The Circuit:

Start by connecting +5V and GND to their respective busses on the breadboard. Use a jumpers to connect one side of a tactile switch to +5V and the other side to D8. Also connect a 10KR resistor to GND to act as a pull-down and prevent the pin from floating.

Connect a 10KR rotary potentiometer’s + and – pins to +5V and GND respectively while connecting the drain pin to pin 3 on the LCD. Finally, connect the LCD pins as shown in the schematic below:

The Sketch:


LiquidCrystal lcd(12,11,5,4,3,2); // generates an instance in the lcd

const int switchPin = 6;
int switchState = 0;
int prevSwitchState = 0;
int reply;

void setup() {

pinMode(switchPin, INPUT);
lcd.print("I AM THE GREAT");
lcd.setCursor(0,1); // changes the Cursor to continue writing in the second row

void loop() {

if (switchState != prevSwitchState) {
if (switchState == LOW) {
reply = random(8);
lcd.clear(); // clears the screen

switch(reply){ // the program will enter the case
assigned to the switch
case 0:
case 1:
lcd.print("It's probable");
case 2:
lcd.print("It is certain");
case 3:
lcd.print("Outlook good");
case 4:
lcd.print("It is unclear");
case 5:
lcd.print("Ask again");
case 6:
lcd.print("I have no idea");
case 7:


2 thoughts on “Arduino Basics Lesson 2-3: (Liquid) Crystal Ball”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.