Skip to content

epfl-cs358/2024fa-minosmouse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CS-358 Project: MinosMouse 🐭

Yaman Ben Fraj - Yuri Chlebny - Mehdi Alaoui - Rudolf Yazbeck - Georges Azzi - Youssef Neji

Project overview

There's a very specific hobby, and that's micromice. Micromice are little “mice” that are placed in a maze, and the aim is to solve the maze as quickly as possible. This is what our project is all about, and we were motivated to do it after seeing various videos in which competitors design micromice that manage to solve a maze in a matter of seconds. What particularly impressed us was the speed and precision with which these micromice solve the maze.

More precisely, the micromouse solves the maze in two phases, the first of which is the search run 🔎, in which Minosmouse maps the maze, with the aim of finding an optimal path to the goal. Returning to the start, it potentially explores a new, perhaps more optimal path. Once back at the starting cell, the micromouse proceeds to the speed run 🏁, in which it must solve the maze as quickly as possible, explaining the highly competitive nature of micromice!

The aim of our project was to design a micromouse from scratch and achieve performances comparable to those observed in competition. To achieve this, we had to explore and master various fields, including 3D printing, mechanical engineering, microcontroller programming and control theory. This project is a fine example of creativity and technical rigor combined.

⚠️ Please consider consulting the project proposal for more details about MinosMouse 📝Project proposal📝

MinosMouse design

The micromouse is 85x89mm (length x width), and weighs [TBD]g with battery (48g). The micromouse is really small and fits in the hand. To make it even lighter without compromising its solidity, Minosmouse has the particularity of being made in a honeycomb design.

Capture d’écran 2024-12-15 à 13 25 48

MinosMouse, though relatively small, is a concentrate of technology in hardware, software and 3D design. In such a small space, you need to reconcile performance and lightness. To this end, here is a list of the elements that enabled us to make our micromouse and achieve our goals, both from a hardware and software point of view. We've added an OLED screen to the micromouse, to give a real-time view of the walls it sees and the direction it's taking.

Hardware Overview

Our micromouse has the following hardware components:

  • 1x ESP32 Board 36 Pins
  • 2x N20 DC Gear Motor $6V$, 750RPM, with encoders
  • 2x Sensor: Time of flight VL6180X (5mm-200mm)
  • 1x Sensor: Time of flight VL53L4CD (1mm-1300mm)
  • 1x IMU MPU-6050
  • 1x MX1508 Motor Driver
  • 1x $9V$ Battery
  • 1x Switching Regulator Module R-78E5.0-0.5 ($5V$ output)
  • 1x OLED Screen 128x64 SSD1306
  • 1x Ball Caster 1/2"
  • 2x Wheel 32x7mm

Software Overview

While exploring the maze for the first time, Minosmouse uses a floodfill algorithm to give a distance cost to each cell of the maze. In parallel, it makes an internal map of the walls thanks to the ToF sensors. When it reaches the goal, it is then able to compute the shortest path in terms of cell distance with these measurements. In order to achieve precise movement, Minosmouse makes extensive use of control theory, more specifically PID systems. Thanks to this, the micromouse can correct itself in real time using its various sensors. In addition, the micromouse uses a finite-state machine to make a decision after each of its movements. FSM

Challenges

The micromouse is designed to be light and fast, which poses a real challenge throughout its development. We have to constantly bear in mind that every change we make to our micromouse design has a significant effect on micromouse movement.

The main challenges are:

  • A lightweight micromouse. We need to make the micromouse as light as possible, so that the motors can support its weight without difficulty so they can run at full speed.
  • A fast micromouse. Unsurprisingly, the aim of a micromouse is to be as fast as possible, while still delivering reliable movements.
  • A small micromouse. The smaller the micromouse, the more possibilities it has in the maze, such as smoother turns or the ability to cross diagonals like straight lines.

Schematics

These circuits show how all the components are connected:

(Pin connections in this circuit may not be representative of the real circuit Pinout below)

Pinout

Component Pin Name ESP32 Pin
Sensors, IMU, Screen I2C SDA 21
Sensors, IMU, Screen I2C SCL 22
Built-in LED LED_BUILTIN 2
Left Motor INT1 26
Left Motor INT2 32
Right Motor INT3 27
Right Motor INT4 33
Left Side Sensor CE_PIN_LEFT 25
Right Side Sensor CE_PIN_RIGHT 23
Front Sensor XSHUT_PIN_CENTER 13
Left Encoder SIGNAL_FEEDBACK_YELLOW_LEFT 18
Left Encoder SIGNAL_FEEDBACK_GREEN_LEFT 19
Right Encoder SIGNAL_FEEDBACK_YELLOW_RIGHT 35
Right Encoder SIGNAL_FEEDBACK_GREEN_RIGHT 14
Power & Ground 5V and GND V5 and GND

Making MinosMouse

Soldering

Power Connections

  1. Solder the 2-PIN JST female connector to the 9V battery connector.
  2. From the 2-PIN JST male, solder two wires for power (one for the motors, and the rest for the switching regulator, to supply the rest of the components with $5V$) and one wire for ground.
  3. Motor driver: Solder a wire for power and a wire for ground (discussed in step 2.) to the motor driver + and - pins.
  4. Switching regulator: Solder the other wires for power and ground to the VIN and GND pins of the switching regulator.
  5. Motors:
  • Left: Solder the motor + (Red wire) et - (White wire) to the motor driver (pins next to "Motor-A"). Solder the encoder + (Black wire !) and - (Blue wire) to the switching regulator VOUT and GND pins.
  • Right: Solder the motor + (Red wire) et - (White wire) to the motor driver (pins next to "Motor-B"). Solder the encoder + (Black wire !) and - (Blue wire) to the switching regulator VOUT and GND pins.

  1. Sensors, IMU, Screen: Solder wires to VIN and GND pins of these components.
  2. ESP32: Solder wire to V5 and GND pins to supply power to the ESP32.
  3. Solder all power and ground wires from steps 6 & 7 together. Once all the components to be supplied with $5V$ are connected together by two wire harnesses (power and ground), solder these two wire harnesses to the switching regulator's VOUT & GND pins.

Data Connections

  • Encoders
    1. Left motor encoder: Solder the yellow wire of the encoder to the pin 18 of the ESP32 & the green wire of the encoder to the pin 19.
    2. Right motor encoder: Solder the yellow wire of the encoder to the pin 35 of the ESP32 & the green wire of the encoder to the pin 14.
  • Motor Driver
    1. Left motor: Solder a wire between the pin INT1 of the motor driver and the pin 26 of the ESP32 (Forward). Same for the pin INT2 & pin 32 (Backward)
    2. Right motor: Solder a wire between the pin INT3 of the motor driver and the pin 27 of the ESP32 (Forward). Same for the pin INT4 & pin 33 (Backward)

📝 In an ESP32 system, peripherals like ToF sensors, IMUs, and OLED displays communicate with the microcontroller on the same $I^2C$ bus, a multi-device serial protocol. Each device has a unique address, allowing the ESP32 to send commands and receive data.

  • Common $I^2C$ bus:

    First, all these components have to be soldered via 2 common cable harnesses, which are soldered to pins 22 (SCL) and 21 (SDA) of the ESP32 (c.f Pinout).

    ‼️ Ensure proper insulation using heat shrink tubes‼️

  • Sensors:

    We need to switch off the sensors one by one in order to redefine their addresses, because if they use the same addresses on the $I^2C$ bus, they'll send data to the same address and the data read by the ESP will be incorrect.

    The 3 sensors have the same default address: $\texttt{0x29}$, so we redefine 2 addresses so that the 3 sensors have 3 different addresses

    1. Right sensor: Solder a wire between the CE pin & the pin 23 of the ESP32
    2. Left sensor: Solder a wire between the CE pin & the pin 25
    3. Front sensor: Solder a wire between the XSHUT pin & the pin 13
  • IMU:

    Nothing more to do than solder the SCL / SDA pins of the IMU, the IMU default address is $\texttt{0x68}$.

  • OLED Screen:

    Nothing more to do than solder the SCL / SDA pins of the screen, the screen default address is $\texttt{0x78}$.
    ⚠️ You may consider soldering wires with a female pins, so that you can easily remove the screen.

💭 Often, the default $I^2C$ address is written on the rear face of the component.

After all these steps, you should have the following backbone:

Step By Step Assembly

⚠️ Consider uploading the program to the ESP32 before screwing it to the top case ⚠️

  1. 3D-Print the parts in this directory (Chassis.stl, TopCase.stl and 2x MotorBracket.stl).

  1. Mount the wheels on the motors
  2. Screw the ball caster and the motors to the chassis (thanks to the motor brackets printed beforehand)

  1. Screw every hardware components soldered to the top case
  2. Screw the top case to the chassis
  3. Connect motors with 6-pin connector
  4. Mount the screen on the back of the micromouse

Software Installation

Follow this tutorial to install the necessary extension required for this project.

Getting Started !

Once you've uploaded the code to the micromouse and your maze is ready, connect a $9V$ battery to the micromouse.

  1. Place it in the maze, centered in the starting cell.
  2. Press the reset button once
  3. 🔎 Search-run: Move your hand briefly in front of the front sensor. It will start its search-run
  4. 🏁 Speed-run: Once the mouse has returned to the starting point, place it correctly in the starting cell. Once you're ready, briefly move your hand in front of the front sensor to start the speed-run.

Going further: PCB

It is possible to further improve MinosMouse in order to avoid having all that extra cable. One possible way of doing this is with a PCB: all connections will be made in the PCB, with no visible wires.

As a proof of concept, here is the prototype of the PCB version of MinosMouse we did:

image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5