Close
0%
0%

M8B 2.0

Magic 8 Ball + User Guide 2.0

Similar projects worth following
238 views
We created a Magic 8 Ball, as well as its users' guide.
The M8B is able to give a random answer to a question asked by the user and the manual lights up automatically after opening it, to read the instructions.
We now want to improve our M8B to make it more user friendly.
This is the link to the first part of our project: https://hackaday.io/project/193146-m8b.
  • 1 × ESP32 TTGO
  • 1 × Portable battery
  • 3 × M-M wires
  • 8 × M-F wires
  • 13 × F-F wires

View all 12 components

  • 2024-05-02

    Nelithzederdelle3 days ago 0 comments

    Today we tried to solve the issue we had last week to make the DFplayer work with the ESP32:

     following this tutorial : (8650) DFPlayer Mini Interface with ESP32: Audio Playback Tutorial | Add voice to ESP32 - YouTube

    here is the code from the video:

    #include "SoftwareSerial.h"
    #include "DFRobotDFPlayerMini.h"
    
    // Use pins 2 and 3 to communicate with DFPlayer Mini
    static const uint8_t PIN_MP3_TX = 25; // Connects to module's RX 
    static const uint8_t PIN_MP3_RX = 27; // Connects to module's TX 
    SoftwareSerial softwareSerial(PIN_MP3_RX, PIN_MP3_TX);
    
    // Create the Player object
    DFRobotDFPlayerMini player;
    
    void setup() {
    
      // Init USB serial port for debugging
      Serial.begin(9600);
      // Init serial port for DFPlayer Mini
      softwareSerial.begin(9600);
    
      // Start communication with DFPlayer Mini
      if (player.begin(softwareSerial)) {
       Serial.println("OK");
    
        // Set volume to maximum (0 to 30).
        player.volume(20);
        // Play the first MP3 file on the SD card
        player.play(1);
      } else {
        Serial.println("Connecting to DFPlayer Mini failed!");
      }
    }
    
    void loop() {
    
     
       }

    However, I get an error message :

    I tried another code I found in the comments:
    #include "DFRobotDFPlayerMini.h"
    
    DFRobotDFPlayerMini player; // Create the Player object
    
    void setup() {
    
      Serial.begin(9600); // Init USB serial port for debugging
    
      Serial2.begin(9600); // Init serial port for DFPlayer Mini
    
      // Start communication with DFPlayer Mini
    
      Serial.println("Connecting to DFplayer");
    
      while (!player.begin(Serial2))
    
      {
    
          Serial.print(".");
    
          delay(1000);
    
      }
    
      Serial.println(" DFplayer connected!");
    
      player.volume(20); // Set volume to maximum (0 to 30).
    
    }
    
    
    void loop() {
    
        player.play(1);
    
        delay(3000);
    
        player.play(2);
    
        delay(3000);
    
        player.play(3);
    
        delay(3000);
    
       }

     but I get the same error message.

    SO, I tried another code from another source :

    #include <DFPlayer_Mini_Mp3.h>
    
    
    #include <SoftwareSerial.h>
    
    #include <DFRobotDFPlayerMini.h>
    
    
    SoftwareSerial mySerial(25, 27); // RX, TX
    
    void setup() {
        mySerial.begin(9600);
        mp3_set_serial(mySerial);
        mp3_set_volume(15);       // fixe le son (30 maximum)
        mp3_set_EQ(0);            // equalizer de 0 Ã 5
    }
    
    void loop() {
        mp3_play();  // joue mp3/0001.mp3
        delay(5000); // pause de 5 secondes
    
    }

    and another one:

    #include <SoftwareSerial.h>
    #include <DFPlayer_Mini_Mp3.h>
    
    SoftwareSerial mySerial(25, 27); // RX, TX
    
    //
    void setup () {
      Serial.begin (9600);
      mySerial.begin (9600);
      mp3_set_serial (mySerial);  //set softwareSerial for DFPlayer-mini mp3 module 
      mp3_set_volume (15);
    }
    
    
    //
    void loop () {        
      mp3_play (1);
      delay (6000);
      mp3_next ();
      delay (6000);
    }

    However, the libraries involved might only work for Arduino and give this type of error message with the ESP32:


    Then, I tried reinstalling the libraries, re-setting up the ESP32, and did all the updates.

    But nothing works I still get this error message:

    DEBRIEF :

    I still have the same error message, the ESP32 set-up does not seem faulty, the last 2 libraries don't work for ESP32, something is still not clear in the first 2 codes

    We also worked on the design of the ball and made a paper prototype to make sure that the dimensions are right and the ball would be nice looking.

    We are still hesitating about the final material we'll use for the final version (either leather or cardboard with fabric covering it).

  • 2024-04-24

    isaure.jarry04/25/2024 at 09:08 0 comments

    Today, we received our whole order:

    • micro-SD module card ADA254:
    • audio amplificator module MP3 DF player:
    • RB-TFT1.8 1,8'' screen:
    • USB cable male/male:

    We decided not to order the cable so that we could create our own, with the voltage and length desired.

    • hall effect magnetic sensor:
    • mini speaker:
    • micro USB male to USB female:
    • micro SD card:

    (the box was too fancy not to show it so enjoy)

    We also tried to modelise the circuit of this video : https://www.youtube.com/watch?v=9w_AaIwlsE4 with this website https://wokwi.com/projects/new/esp32 .

    However, it did not work as there is no MP3 dfplayer, so we tried the ESP32 we used in the first semester but they were all over heating, so we tried to de-soulder them.

  • 2024-04-11

    isaure.jarry04/25/2024 at 08:02 0 comments

    Today, we did the final bill of materials and this it was we ordered under our budget:

    • USB cable male/male: for the instructions' book charger
    • RB-TFT1.8 1,8'' screen: to display the messages and images on the M8B (what will answer to the questions asked)
    • hall effect magnetic sensor: detects when the book is opened or closed to light it up automatically
    • mini speaker: to make a little sound when the answer is charging in the M8B and potentially read it (we haven't decided yet whether or not to make it, or just if we make it mandatory because it could annoy some people)
    • micro USB male to USB female: to wire the battery to the book
    • micro SD card: one for the audio, one for the images (we alreay have one)
    • audio amplificator module MP3 DF player: for the sound to be good enough to go through the speaker
    • micro-SD module card ADA254: to connect the micro SD to the circuit

    We mostly ordered our components on Mouser and Gotronic.

  • 2024-04-04

    isaure.jarry04/25/2024 at 07:46 0 comments

    Today, we checked different ways of putting sound into the M8B.

    We started to simulate it.

    We also started the list of components, but we changed a lot and took a long time to find the easiest to connect components so we haven't finished it.

  • 2024-03-21

    isaure.jarry03/21/2024 at 10:17 0 comments

    This is what we did today:

    • successfully made our code work to have an answer appear on the screen when we shake the accelerometer
    • made our list of components
    • detailed our prototype

  • 2024-03-21 - Success! Programming the gyroscope 2.0

    Nananis03/21/2024 at 09:27 0 comments

    Today we finally managed to correct the code and ensure that when we shake the gyroscope, text appears on the screen:

    #include <Wire.h>
    #include <Adafruit_MPU6050.h>
    #include <Adafruit_Sensor.h>
    #include <LiquidCrystal.h>
    
    Adafruit_MPU6050 mpu;
    
    const int rs = 15;
    const int en = 13;
    const int d4 = 32;
    const int d5 = 33;
    const int d6 = 25;
    const int d7 = 26;
    LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
    
    void setup() {
      Serial.begin(115200);
      while (!Serial)
        delay(10); 
    
      Serial.println("Adafruit MPU6050 test!");
    
      if (!mpu.begin()) {
        Serial.println("Failed to find MPU6050 chip");
        while (1) {
          delay(10);
        }
      }
      Serial.println("MPU6050 Found!");
    
      mpu.setAccelerometerRange(MPU6050_RANGE_8_G);
      Serial.print("Accelerometer range set to: ");
      switch (mpu.getAccelerometerRange()) {
        case MPU6050_RANGE_2_G:
          Serial.println("+-2G");
          break;
        case MPU6050_RANGE_4_G:
          Serial.println("+-4G");
          break;
        case MPU6050_RANGE_8_G:
          Serial.println("+-8G");
          break;
        case MPU6050_RANGE_16_G:
          Serial.println("+-16G");
          break;
      }
    
      lcd.begin(8, 2);
      Serial.begin(115200);
      lcd.clear();
    }
    
    void loop() {
      sensors_event_t a, g, temp;
      mpu.getEvent(&a, &g, &temp);
    
      Serial.print("Acceleration X: ");
      Serial.print(a.acceleration.x);
      Serial.print(", Y: ");
      Serial.print(a.acceleration.y);
      Serial.print(", Z: ");
      Serial.print(a.acceleration.z);
      Serial.println(" m/s^2");
    
      Serial.print("Rotation X: ");
      Serial.print(g.gyro.x);
      Serial.print(", Y: ");
      Serial.print(g.gyro.y);
      Serial.print(", Z: ");
      Serial.print(g.gyro.z);
      Serial.println(" rad/s");
    
      Serial.print("Temperature: ");
      Serial.print(temp.temperature);
      Serial.println(" degC");
    
      if (abs(g.gyro.x) > 1 || abs(g.gyro.y) > 1 || abs(g.gyro.z) > 1) {
        lcd.clear();
        lcd.setCursor(0, 0);
        lcd.print(getRandomMessage());
        lcd.setCursor(0, 1);
        lcd.print("UwU");
        delay(3000);
        lcd.clear();
      }
    

     The next step is reducing the sensitivity of the gyroscope. We don't want to text to appear as soon as the person picks up the ball.

    Here is the new code:

    #include <Wire.h>
    #include <LiquidCrystal.h>
    #include <Adafruit_MPU6050.h>
    #include <Adafruit_Sensor.h>
    
    const int rs = 15;
    const int en = 13;
    const int d4 = 32;
    const int d5 = 33;
    const int d6 = 25;
    const int d7 = 26;
    LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
    
    Adafruit_MPU6050 mpu;
    
    void setup() {
      lcd.begin(8, 2);
      Serial.begin(115200);
      while (!Serial) {
        delay(10); // Wait for Serial Monitor to open
      }
    
      if (!mpu.begin()) {
        Serial.println("Failed to find MPU6050 chip");
        while (1) {
          delay(10);
        }
      }
      Serial.println("MPU6050 Found!");
    
      mpu.setAccelerometerRange(MPU6050_RANGE_8_G);
      mpu.setGyroRange(MPU6050_RANGE_500_DEG);
      mpu.setFilterBandwidth(MPU6050_BAND_21_HZ);
    }
    
    void loop() {
      sensors_event_t a, g, temp;
      mpu.getEvent(&a, &g, &temp);
    
      float accelerationMagnitude = sqrt(pow(a.acceleration.x, 2) + pow(a.acceleration.y, 2) + pow(a.acceleration.z, 2));
      
      // Adjust this threshold value to change the sensitivity
      float threshold = 60.0;
    
      if (accelerationMagnitude > threshold) {
        lcd.clear();
        lcd.setCursor(0, 0);
        lcd.print(getRandomMessage());
        lcd.setCursor(0, 1);
        lcd.print("UwU");
        delay(3000);
        lcd.clear();
      }
    }
    
    String getRandomMessage() {
      String messages[] = {
        "Go ahead",
        "Fuck it.",
        "WTF?!",
        "OOPS",
        "Possibly",
        "Fate.",
        "Nauwr",
        "Shut up",
        "RIP",
        "Nope"
      };
    
      int index = random(10);
      return messages[index];
    }
    

  • 2024-03-14

    isaure.jarry03/14/2024 at 11:09 0 comments

    What we did today:

    • coding the gyroscope
    • connecting it to the screen
    • thinking about the construction of our ball (inside and outside)

    Things to do next time:

    • complete the instructions
    • finish our list of components

  • 2024-03-07

    isaure.jarry03/14/2024 at 09:13 0 comments

    This is our action plan for our improved Magic 8 Ball:

    • have a better and bigger screen, with more pixels and with wich we could display more than 16 letters, potentially even showing pictures
    • voice speaker to read the message when it's displayed
    • improve the structure of the ball, make it smaller (with a transparent part to show the screen), inspired by Jon Paul's balls
    • have a better LED composition
    • add an accelerometer giroscope
    • incrustation -> prevision
    • create eyes like a furby

    And to improve our user's guide:

    • implement a sensor to open the book automatically
    • E-paper for the text

View all 8 project logs

  • 1
    Construct the outer box
    1. Cut pieces in the cardboard
    2. Cover each pieces with the fabric
    3. Assemble them with staples
  • 2
    Construct the inside of the box
    1. Create a ground with spaces/holes specifically adapted to each component with a 3D modeling tool so that the components don't move when shaking the ball
    2. 3D print it
    3. Place it inside of the box, make sure to attach it so it doesn't move
  • 3
    Coding each component

View all 4 instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates