Project tutorial

The Magic Display With Arduino - The Mind Reader © CC BY-NC-ND

The Magic Display with Arduino can guess your choice on a card with 64 options of numbers, letters, or symbols, after only a few clues.

  • 2,676 views
  • 19 comments
  • 7 respects

Components and supplies

Apps and online services

About this project

Hello, everyone!!

Magic Display

The Magic Display is my unique creation that can read your mind and can find out what your choice was on a display with 64 numbers, letters, symbols, or whatever else you want.

You can create many different personal templates to be used with Magic Display.

How Does it Work

But how does Magic Display work?

It asks a few questions (6 in total) that you just need to answer YES or NO, according to the LED array connected.

If you see the number you chose in ON LED group, your answer is YES (Green tactile switch).

If your number is not highlighted, your answer will be NO (Red tactile switch).

With just these clues, after six questions, the Magic Display can figure out what it was by showing it on a flashing screen.

You can repeat (pressing Green/YES tactile button) for any other number of your choice and Magic Display will give you the correct answer all the time.

What makes Magic Display special and unique is that you can repeat the same number you chose before, and you will see that Y/N responses will be different, but the end result will always be right!

Code

I have created the logic of this code a long time ago, and I have improved over time on different platforms during development in versions for Excel-VBA, Visual Basic, C++, Lazzarus (Delphi) and Arduino was an extension of all these versions.

I also have a version with printed cards, and someday I will introduce them to everyone on a future project.

Well, have fun now!!

It is very simple to be built and very interesting!!

LAGSILVA

Illustrative Video using #17 as example

1) Materials List

  • 01 Arduino/Genuino Uno
  • 01 LED Array (8x8) Module with MAX7219
  • 01 Mini-Breadboard
  • 02 Tactile Switches
  • 01 Printed template for LED display (see attachments)
  • Jumpers for connections

2) Assembly

  • Follow the connections according to the electronic schematic diagram.
  • Print the template, cut and put it over the LED Matrix.
  • Upload the code into Arduino.

3) Libraries for Arduino

You need to install the following libraries into your Arduino IDE:

  • MsTimer2 library to read the tactile switch buttons.

Note: Attachments are available as a copy for your download and installation to your computer.

Custom parts and enclosures

Templates for the Cards
Templates to be used over the LED Array
Library for LED Array with MAX72xx
Library for LED Array with MAX72xx
ledcontrol-1_0_4_9qJAUOqS4E.zip
Library of MsTimer2
Library of MsTimer2
mstimer2_msMX8Y8w17.zip

Schematics

Schematics in PDF
Schematics in PDF file for the assembly

Code

Code of Mind ReaderArduino
Code for Arduino IDE of Mind Reader
/*    The Mind Reader - The Magic Cards with Arduino
      Copyright by LAGSILVA
      V2.1 - 17.Apr.2017
*/

#include <LedControl.h>   // Library for LED Array with MAX72XX
#include <MsTimer2.h>     // Library for Timer2

int k, b, chv, cartela, numcol, numlin, res, lin;
int botoes = 0;

byte simPinSW = 8; //Tactile button for the answer YES
byte naoPinSW = 7; //Tactile button for the answer NO
byte botaoSim, botaoNao;

/*
  Pin numbers of Arduino for connection with MAX72XX module
  pin 2 is connected to the DataIn (DIN)
  pin 3 is connected to LOAD (CS)
  pin 4 is connected to the CLK (CLK)
*/

LedControl lc = LedControl(2, 4, 3, 1);

//Array of digits numbers - 0 to 9 - Size 5x3
byte num[10][5] = {
  {7, 5, 5, 5, 7},  //0
  {2, 6, 2, 2, 2},  //1
  {7, 1, 7, 4, 7},  //2
  {7, 1, 7, 1, 7},  //3
  {5, 5, 7, 1, 1},  //4
  {7, 4, 7, 1, 7},  //5
  {7, 4, 7, 5, 7},  //6
  {7, 1, 2, 2, 2},  //7
  {7, 5, 7, 5, 7},  //8
  {7, 5, 7, 1, 7},  //9
};


void setup() {
  
  randomSeed(analogRead(0));
  
  pinMode (simPinSW, INPUT_PULLUP);
  pinMode (naoPinSW, INPUT_PULLUP);

  MsTimer2::set(10, lerBotoes); // 10ms period
  MsTimer2::start();

  lc.shutdown(0, false);    // Wakeup call of MAX72XX
  lc.setIntensity(0, 10);   // Set the bright of display (max is 15)
  lc.clearDisplay(0);       // Clear the display

}


void loop() {

  chv = random(1, 64);
  res = 0;
  for (cartela = 1; cartela <= 6; cartela++) { // Print the 06 questions
    lc.clearDisplay(0);
    delay(1000);
    for (lin = 0; lin < 5; lin++) { //Print the number of current question
      byte temp = num[cartela][lin];
      temp = temp << 2;
      lc.setRow(0, lin + 1, temp);
    }
    delay(1000);
    lc.clearDisplay(0);
    for (k = 1; k <= 64; k++) {
      b = k ^ chv;
      if (b >> (cartela - 1) & 1) {
        numcol = (k - 1) % 8;
        numlin = (k - 1) / 8;
        lc.setLed(0, numlin, numcol, true);
      }
    }
    while (botaoSim == 1 && botaoNao == 1) {
      delay(100);
      if (botaoSim == 0) {
        bitSet(res, cartela - 1); 
      }
    }
  }
  res = res ^ chv; 
  if (res == 0) {
    res = 64;
  }
  lc.clearDisplay(0);
  delay(1000);
  numcol = (res - 1) % 8;
  numlin = (res - 1) / 8;
  while (botaoSim == 1) { //Press YES to play again
    lc.setLed(0, numlin, numcol, true);
    delay(400); //Blinking LED showing the result
    lc.setLed(0, numlin, numcol, false);
    delay(200);
  }
  
}


void lerBotoes() {  //Read YES or NO buttons

  botaoNao = digitalRead(naoPinSW);
  botaoSim = digitalRead(simPinSW);
  
}

Comments

Similar projects you might like

LEDog Collar

Project tutorial by circuito.io team

  • 128 views
  • 1 comment
  • 5 respects

Handheld Infinity Kaleidoscope Group Kit

Project tutorial by Lucas Ainsworth

  • 1,910 views
  • 2 comments
  • 26 respects

Arduino 101 BLE RGB Lamp

Project tutorial by Gustavo Reynaga

  • 405 views
  • 2 comments
  • 6 respects

A Tone Generator with LCD Display!

Project tutorial by cronenborg

  • 35 views
  • 0 comments
  • 1 respect

Arduino Keyless Door Lock System with Keypad and LCD

Project tutorial by DIY Hacking

  • 630 views
  • 3 comments
  • 11 respects

Wireless Bagpipe

Project tutorial by Joe Bowbeer

  • 376 views
  • 0 comments
  • 6 respects
Add projectSign up / Login