Micromouse Predator from Scratch

Project Overview:

The goal of this project was to design, construct, and control a small wheeled robot, completely from scratch. Dr. Malcolm MacIver’s lab is studying robot-rodent interactions and required a robot to act as a high-speed predator that will constantly try to discover, chase, and corner a mouse in a maze-like habitat.

To achieve this, I drew knowledge from my previous mechatronics experience to build a motor control circuit, communicate wirelessly using a Digi XBee module radio, as well as create a custom PCB. I also took inspiration from the Half-Sized Micromouse Competition for both mechanical and electrical design.

Have a look at the code on my GitHub.

Design Constraints and Considerations

Overall, this project was relatively open-ended. The three hard constraints were that the robot (1) be no wider than 6.35cm in order to fit through the smallest opening in the habitat, (2) move as fast, if not faster than the mice, which peak at speeds around 2m/s, and (3) make 60 degree turns around 1 m/s.

While there were no height or weight restrictions for this robot, those variables certainly played a significant role in my design process. If the center of mass of the robot was too high, the robot would tip over when making high-speed turns. And the heavier the total mass of the robot became, the larger the motors would have to become to create the appropriate driving torque. Given these considerations coupled with the fact that speed and width we’re the main constraints on this robot, I first turned my focus to analyzing and comparing different motors.

Motor Analysis

My goal was to create a simulated “race” between a given brushed DC motor and the mice to find motors that ran faster than the mice. Dr. MaIver’s lab provided me with mouse trajectory and velocity data over time from their ongoing experiments. With this information to compare to, I needed to extrapolate equations to calculate a motor’s position and linear velocity over time given only a motor’s electrical specs.

To model the motor’s behavior, I started using a simple equation that expressed input and outputs in terms of power. I manipulated that equation until I had an expression that was only dependent on the 1st and 2nd order differentials of displacement over time. Once I had a function that was dependent on displacement over time, I was able to run the “race” simualtions. In order to get the robots linear and velocity displacement over time to compare to they mice, solved the equation for x(t) as well as x’(t):

Where r is the wheel radius, V is the voltage across the motor, kt is the torque constant, G is the gear ratio, R is the motor’s internal resistance and m is the total mass of the robot and all its parts. Using the equations, I compared several motors to the mice by creating graphs such as the two below. The blue line represents the motor’s data while the green line represents a mouse.

I also examined each motor’s torque-speed curve to ensure that a motor’s anticipated torque outputs were within the continuous operating region of that motor. Using all graphs I was able to eliminate several motors while still having a couple of viable motors to choose from.

My final motor selection came down to weight and size. For this entire system, the motors and battery we’re the largest and heaviest components. Therefore I wanted the smallest and lightest option of both. This meant choosing a 1 cell battery and therefore a motor that only needed up to 3.7V to operate. After doing some initial mechanical modeling, I chose a light and small motor that fit the design configuration I was looking for.

Circuit Hardware

Once the critical parts were chosen, it was time to order all the other circuit components so I could start breadboarding and testing the circuit before ordering a custom PCB. I chose to use a PIC32 microcontroller since I had previous experience with these chips and there were a couple on hand to get started with quickly. Along those lines, I also chose to use the TI DRV8833 motor drivers. As a safety precaution, I added IR distance sensors to detect objects and avoid collisions. The last key component to this circuit was the Digi XBee 3 802.15.4 module which I used to communicate wirelessly with the robot.

Given these components, I created the following schematic and tested this circuit on the following breadboard:

PCB Design

In order to integrate all the circuit components into a small area on the robot, a custom PCB was necessary. After I confirmed that my circuit worked on the breadboard, I had confidence that I could design a functional PCB.

My initial thought was to use the PCB as a chassis component, as many of the Micromouse robots do. However, the MacIver lab uses a camera system above their habitat to track the mice and robot. And in order to detect, track, and determine the orientation of the robot, 3 red LEDs need to form an isosceles triangle on top of the robot. Given that, it was simple to rework the mechanical design so the PCB was the top-most component.

As with all PCB prototyping, this was a very iterative process, especially considering how many components needed to fit in such a small space. The dimensions of the PCB were determined by the footprint of the robot, which in turn was driven by the length of the motors. I was able to fit 35 components in a 46cm x 34cm space as pictured below.

View from OSHPark

Once the boards were manufactured, I soldered all the individual components myself using a microscope. I quickly realized I couldn’t program my microcontroller. I did a continuity test to identify the issue and discovered I didn’t have common ground across all the components. To get my PCB up and running as quickly as possible, I soldered jumper wires to all components that needed common ground. After that I was able to program the PIC and confirm that all my other connections were correct. I designed a new board with common ground for future use.

Left side shows completed board with the XBee module.
Right side shows the components lying underneath the XBee.

Mechanical Design

Below are images of the finalized, differential drive robot that I modeled in Soldiworks and then 3D printed.

Final design, 5cm wide by 5.5cm long

I started with a four wheel configuration like many of the Micromouse designs. But after some testing, I discovered that the flooring in the MacIver lab habitat has a much higher coefficient of friction than the flooring used in the Micromouse competitions. I decided to remove two wheels and switch the tire material to a harder rubber o-ring which were skinner and therefore had smaller areas of contact to make turns easier. The thinner wheels also had the benefit of making the overall width of the robot smaller.

Orignal design on left, updated design on right

Remote Control

Below is a video of robot being given left and right DC commands. It shows the robot moving forward and backwards, turning in a circle, and lastly moving in a loop. Note: these are only feed-forward commands, feed-back control is needed for precise movement.

Next Steps

As a safety feature the next immediate step will be incorporating the IR distance sensors as object avoidance / collision detection. I have already accounted for the sensors in my PCB, so all there is left to do is mount the hardware and implement functionality onto the microchip such that the robot stops if it senses that an object is too close.

Given that there is a mechanically and electrically sound design, the next control steps are to add a PID controller. The MacIver lab is able to track the robot’s location as it moves throughout the habitat. With that information, a position feedback controller can be implemented per the block diagram below.

Once the PID controller is squared away, the final step for autonomous navigation will be to create a path planning algotihm. This algorithm will recevice a mouse location and plan a route from the robot’s location to the mouse while avoiding all obstacles. With that, the predator robot will be fully operational!