Skip to content

A simple and complete micromouse using the Arduino Leonardo-based MMKIT from Globaltronics

License

Notifications You must be signed in to change notification settings

micromouse-utad/MMKit-PH

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MMKit-PH

This repository is a fork of Peter Harrison's code for the MMKit. The repository was created to make it easier to run Peter's code using the Arduino IDE, as well as to help in the calibration processes needed to get the micromouse running correctly.

Index

  1. The Kit
  2. Installation
  3. Serial Connection
  4. Calibration
  5. Usage
  6. Documentation

The Kit

Components

Label Component Image
1 Left Diagonal IR Sensor
2 Forward Left IR Sensor
3 AA Batteries Support (4 – AA)
4 ON/OFF AA Batteries
5 Left Stepper Motor
6 Configurable Switches for Control Software
7 Connector for Right Motor
8 Right Diagonal IR Sensor
9 Forward Right IR Sensor
10 Bluetooth Connector (module not included)
11 LED pin 13 / Buzzer (Buzzer not included)
12 LED ON/OFF
13 Jumper for Selection AA Batteries/LiPo Battery
14 Right Stepper Motor
15 ON/OFF LiPo Battery (Battery not included)
16 Connector for Left Motor

Block Diagram

The following diagram was already provided from Peter's original repository.

Installation

There's no installation required, to run the code first download its latest release. After, uncompressed the code in the desired location on your machine and just open the project through the Arduino IDE.

Serial Connection

Before starting the calibration process, it is required to have a Serial connection to the mouse via the Bluetooth Connector (Label 10), not necessarily needing to be a Bluetooth adapter, any UART to USB adapter should work in this case.

The MMKit UART connection is as follow:

To connect to the UART you can use the program Putty, with the baud rate being 57600 or, alternately, the Arduino Serial Monitor, also using the same baud rate, just remember to change the connection port before using the Serial Monitor.

After the Serial connection is made, you can press 'h' to get the full list of commands available through it.

NOTE: Please take note that this UART connection is only for receiving and transmitting data from/to the MMKit at runtime, you still need to use the USB Connection to upload the sketch.

Calibration

The calibration consists of 4 parts:

  1. Side sensors raw calibration
  2. Front sensors raw calibration
  3. Front sensors sum/diff calibration
  4. Adjust the threshold values

To help with this process a routine was created to help you calibrate the robot, you cal call it if connected through the UART by pressing the key 'c'.

Side sensors raw calibration

The first step in calibrating the raw value of the side sensors is to place the robot in the center of a cell, with a wall in each of the sides. The side sensors should be in an angle so as to detect the edges of the front wall.

When reading the sensors values, they should be similar in both sides, if not, adjust the sensors so that the read values are as close as possible.

Finally, save the read values in the variables LD_CAL and RD_CAL, for the Left Diagonal value and Right Diagonal value correspondingly, inside the file parameters.h.

 

Front sensors raw calibration

For the front sensors raw calibration, the steps are similar to before. Start by placing the mouse in a cell with a wall in each of the sides, except, this time, the mouse should be place against the rear wall, instead of centered in the cell.

As before, when reading the sensors values, they should be similar in both sides, requiring an adjustment of the sensors if the values are not alike.

To finalize, the read values must be saved in the variables LF_CAL and RF_CAL, for the Front Left value and Front Right value correspondingly, inside the file parameters.h.

 

Front sensors sum/diff calibration

The next step is to calibrate the sum/diffs for the front sensors. To do so, position the mouse against the rear wall, but with the front of the mouse faced to it.

Before continuing, be sure to remove the back wall, as the mouse will move in reverse for this calibration.

When the mouse is moving, be sure to not influence its movement, if connected to the UART by cable. If the mouse doesn't moves in a straight line, run the subroutine again.

After the subroutine is finished, save the first array of values in the variable frontSumTable, and the second array of values in the variable frontDiffTable, inside the file sensors.cpp.

NOTE: If the mouse moves forward, instead of backwards, you have the motors connected in the wrong order, and you will need to swap the left with the right motor connection.

Adjust the threshold values

The final step for the calibration is to adjust the threshold values, for this you can use the command 'S' under the serial port that shows the walls the mouse is currently detecting together with sensor calibrated values. You can change DIAG_THRESHOLD, FRONT_THRESHOLD and FRONT_WALL_INTERFERENCE_THRESHOLD, in the file parameters.h, so the mouse sees the walls correctly.

The FRONT_THRESHOLD must have a value that allows the MMkit to see the wall in front when it is positioned in the first part of the cell just before entering the cell.

The DIAG_THRESHOLD must have a value that if the mouse is bettewen two walls and is near on of the walls he still can see the other.

The FRONT_WALL_INTERFERENCE_THRESHOLD is the sum of the value that the side sensors see when they MMkit is in the midle of the cell, as the MMkit reaches the wall in front this values start to have the reflex from the front wall so they are unrealiable to use for adjustment, therefore the MMkit must align using the front sensors.

Usage

To start a new run, position the mouse against the rear wall in the initial cell, make sure that the switch labeled 1 is faced to the right, and move switch 2 left to right, as to simulate a button. After, a red led should be turned on, just occlude the left sensors to start the discovery run.

After the mouse as finished its discovery phase, it will return to the start cell. When he reaches it, don't move the mouse to the rear wall again, only adjust its angle if needed, and occlude the left sensors to start the run to the finish line.

Documentation

Some additional documentation is also available in the latest release page in a zip file named MMKit-doc. This includes:

  • Code documentation generated from Doxygen
  • The MMKit's layout
  • The MMKit's schematic

About

A simple and complete micromouse using the Arduino Leonardo-based MMKIT from Globaltronics

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 82.9%
  • C 16.4%
  • Shell 0.7%