The Micromouse competition is a worldwide robotics contest that challenges participants to build a small robot that can autonomously navigate itself to the center of an approximately 3 square meter maze. Our project, the Micromouse Autonomous Vehicle Kit, is an all-in-one robotics set designed for two main purposes: to be a starter kit for people who want to participate in the Micromouse competition, and to be a beginners robotics set for those who are interested in learning about or pursuing a career in technology and/or engineering. While some other Micromouse kits are available, this kit will allow customers of all knowledge levels to participate in the competition, as it is affordable, provides everything necessary for the competition (including software), and also is flexible enough to be improved on for those with more advanced knowledge and experience.
2. High Level VisualHardware Architecture Diagram
Software Architecture Diagram
The user interface being used for this project has several components. There are two onboard LEDs that are user programmable. These can be used for debugging or general program feedback, such as telling the user what mode the code is running in, which IR sensor is over a black line, etc. The LEDs are powered directly by the microcontroller on the high drive pins (20mA limit, see microcontroller schematic in section 5a for specific pin connection). The LEDs have a turn-on voltage of 2V and are each connected to a 130 Ohm resistor, limiting the current to 10mA to ensure safe operation of both the LED and the microcontroller.
There are also three onboard buttons to facilitate user input. Two of these are programmable by the user. The uses for the buttons could range from mode selection to confirming calibration data to turning on one of the LEDs. The third button is an onboard hardware reset button, allowing the user to quickly reset the microcontroller to the power up state. The two programmable buttons are connected to GPIO pins configured with internal pull ups, resulting in the buttons simply being connected to ground outside the microcontroller.
The third form of user interfacing is the connection between the computer and the MSP432 microprocessor. Through the use of Code Composer Studio from Texas Instruments, the MSP432 microcontroller can be programmed and debugged (with the use of a TI Launchpad as an intermediary, see user guide for more information on programming). There are real-time register views as well as variable watch windows and memory information that can help the user to debug their software. The schematics for these interfaces are shown below (with the exception of the programming interface, which is shown through the JTAG pins on the microcontroller schematic in section 5a).
Lastly our design can be expanded upon through the use of the Grove connectors as well as the generic 8-pin header included on the PCB. The Grove connectors can be used to communicate with additional external devices through UART or I2C, such as an accelerometer, thermocouple, or LCD screen. In addition, there are two digital connections that can be used to control an on/off device, such as an LED. The 8-pin header includes access to several additional GPIO pins, as well as a SPI bus, that the user can use for their own purposes. The schematic for these headers can be found in section 5a.
Buttons:
Buttons are internally pulled-up and will therefore read 1 (high) when not pressed and 0 (low) when pressed. The reset button, however, has a different circuit that reflects the design used on the TI Launchpad.
LEDs:
LEDs driven directly from the microcontroller on max 20mA high drive pins.
3.3 V supply - 2 V LED drop = 1.3 V across resistor 1.3 V130 Ohm=10 mA
10mA is enough current to illuminate LEDs safely.
* Note: Refer to section 5a for specific pins/connections to microcontroller.
5. Major Subsystems5a. Microcontroller(Shane Hooley)
The MSP432411Y microcontroller is the ideal microcontroller for this use case. Being the central unit of all the subsystems, it must be capable of handling all of the processing and control of those subsystems. The MSP432P411Y is capable of doing this through its 48MHz clock speeds, as well as being able to handle 1MBps of ADC conversions. This will allow for the three ultrasonic sensors and two infrared sensors to sample at a high rate and give the microcontroller the most up to date information as the robot completes its tasks. This will be vital during the maze solving objectives of the robot as it will need to update its position and find potential paths rapidly by utilizing the three ultrasonic sensors simultaneously. A missed sensor reading could result in a missed path through the maze.
The high clock speed of the microcontroller will allow for rapid computation of paths that can be followed to the center of the maze whilst handling the rest of the control of the robot. There will be a decently high computational stress on the controller as it performs searches through the maze, depending on the algorithm used. If conserving power becomes a priority, there would be no issues dropping the clock speed to half or even one quarter the highest frequency. With the 1MB of FLASH and 256 KB SRAM on the microcontroller, holding all of the maze solving software and the maze itself in memory will not be an issue, allowing for the entire maze to exist in memory and be updated as the robot traverses. There are also plenty of GPIO pins for further expansion of the robot, expanding the educational possibilities far beyond just maze solving and line following. These will be configured to be outputs and set to low for power savings by default, but will be user programmable through Code Composer Studio.
An oscillator circuit is included in the hardware required for correct and optimal performance of the microcontroller. This circuit creates the input frequency that will allow for the microcontroller to run at its maximum frequency of 48 MHz. Without this circuit, the microcontroller will only achieve a maximum frequency of 3 MHz out of the box. This will not ruin the operation of the Micromouse, but it will hinder its ability to potentially handle all of the decision making and data handling, especially if the platform is used for other use cases that may require more sensor integration or more complicated software.
Microcontroller Schematic:
Subsystem Conclusion
The MSP432P411Y is the ideal microcontroller for this application and will fare well for the project. With the high potential clocks speeds and analog to digital conversion speeds, there should be no issues with data acquisition and processing, while the sizable onboard memory should grant the space needed to successfully accomplish all the design goals.
5b. Sensors(Brenden Black)
For our sensors, we have selected three HC-SR04 ultrasonic sensors along with two QSD123 infrared detectors and a QED223 infrared emitter. The ultrasonic sensors will be mounted on the front, left, and right sides of the Micromouse so that walls can be detected on each side of it and the maze can be mapped. In addition to maze navigation ability, the ultrasonic sensors can be used for other purposes, such as another form of object-detection or distance measurement, if the user wishes to write their own custom software. The infrared detectors and emitter will be mounted on the bottom of the Micromouse, with the emitter providing light and the detectors reading the amount that is reflected back to determine what color they are over. This allows the robot to differentiate colors, primarily white and black, and gives it the ability to follow a black line on the floor.
The schematics for the ultrasonic sensors are shown below. Each is powered by a 5V source (at pin 4), which has been stepped down from the ~6V battery supply through a voltage regulator (discussed further in section 5d). The sensor is triggered for a reading by sending a 10us pulse from the microcontroller to the sensor’s trigger pin (pin 3 below), after which it emits an 8 cycle burst of a 40 kHz PWM wave and sets the echo pin (pin 2) high. When the sound wave returns, the echo pin is set to low. The distance reading is determined by the amount of time the echo signal is high using the formula centimeters = uS/58. Since the MSP432P411Y does not have direct PWM reading capability, the echo pin is connected to a GPIO pin on the microcontroller that triggers an interrupt on both the rising and falling edges of the signal to start and stop a timer. This allows the microcontroller to determine the amount of time the signal was high and then converts that measurement to the appropriate distance using the previous formula. In addition, the amplitude of the echo signal’s output is 5V, which could damage the pins of the microcontroller since they are only rated for 3.3V. To account for this, the signal is also run through a simple voltage divider with resistances of 1 kOhm and 1.8 kOhms to step down the voltage. These values were determined using the equation 3.35=R2R1+R2, with R1 set to 1 kOhm for simplicity. In this equation, R2 is 1941 Ohms, but 1.8 kOhms was selected to ensure the value never exceeds 3.3V, as a little under 3.3V will still read as high on the microcontroller.
Ultrasonic Sensor Schematics:
Each sensor has its own trigger pin from the microcontroller, along with its own GPIO pin for readings. Details about individual pins/connections can be found above.
Additionally, the schematics for the infrared (IR) detectors and emitter are included below. Both the emitter and detectors are powered by the 3.3V source, which is also stepped down from the ~6V battery through a separate voltage regulator. Based on how much light is received by each of the detectors, the voltage across the detectors vary. To avoid damaging the detector, a 5.11 kOhm resistor is added to reduce the amount of current it receives. In addition, to filter the output, a RC filter is added to ensure accurate readings and reduce noise in the circuit. The output of the filter is read by the microcontroller’s ADC and processed accordingly. The emitter is controlled by a NFET through a GPIO pin on the microcontroller in order to save power when it is not needed, such as when performing maze navigation. When the pin is high, the NFET turns on which, in turn, turns the emitter on. A 66 Ohm resistor is used to limit current through the IR emitter as well.
IR Detector Schematic:
Two IR detectors are used to help determine where the Micromouse is in relation to the line, rather than just one sensor to tell if it is on the line.
IR Emitter Schematic:
The IR emitter provides the light that is reflected from the surface below the Micromouse and read by the detectors. When the emitter is off, the detectors will not give accurate readings.
Subsystem Conclusion:
The accuracy and reliability of our sensors are vital to the Micromouse operating correctly and completing its tasks. The ultrasonic sensors must be accurate to enable wall detection in the maze as well as to see possible paths it can take. The IR sensors must also be able to tell when they are on the black line, versus on the edge or off of it. Without reliable and accurate sensors, the entire project cannot function as intended.
5c. Motors(Jacob Fuller)
For our motor subsystem we have decided that utilizing the gearometer and encoder assembly for Romi/TI-RSLK is the best design choice to satisfy the requirements for the Micromouse project. The DC motor by itself is not capable of position tracking, but with the use of the built in encoders this can be achieved. The Romi encoder is capable of outputting 24 pulses per revolution of the motor shaft, which translates to 1 pulse every 15 degrees of rotation. Assuming we use a wheel with radius 0.75” this will allow precise tracking of the vehicle with a resolution of ((2*pi*0.75)/24) = 0.2”. This is more than enough to effectively map and navigate the maze. The DC motor is also the easiest to control and implement compared to the other types of motors, which is important for our target audience of robotics beginners. The high efficiency and low weight of the DC motors is also important because that will allow us to use a smaller on board battery to maintain the same run time, which decreases the footprint, weight, and overall cost of the system.
We estimate our robot to have a mass of ~0.75kg, and a max speed of .5m/s to navigate the maze accurately and with a good pace. A simple method to calculate the torque for each motor is T = m*a*r. Assuming mass = 0.75 kg, wheel radius of 1.905 cm and acceleration of .5m/s^2, torque rating=0.007N*m. To calculate the rpm: max speed : = .5 m/s, radius = 1.905cm distance per revolution = 11.97. 1m/s = 50cm/s/11.97cm/rev = 4.18 rev/second * 60 = 250.6 rpm. The initial current draw for each motor is 875 mA on startup, and draws 145 mA at full load once in motion. Total initial current draw = 750 mA * 2 = 1.5A. Since the 5V regulator is only capable of 1.5A output, each motor will require its own regulator to ensure they both can initiate at the same time without maxing out the regulator.
Additionally, to control the speed and direction of the motors, an H-Bridge is necessary. After thorough comparisons, we decided the DRV8837 TI motor driver would be a better option than the custom made H-bridge. One reason is because the motor driver is able to turn on the motors much faster than the H-bridge. This allows for a much higher frequency PWM signal to control the motors. Additionally, the motor driver has a much smaller footprint than the H-bridge and also has additional safety features such as shoot through protection. The schematics and testing for the DRV8837 are shown below.
Finally, after the Alpha board was built it was clear that the motors had some serious stability issues that need to be addressed. To fix this, I created a 3D model of the motors and attached a mount between them to eliminate wobbling. Additionally, I created a chassis that is mounted to the bottom of the vehicle which alleviates stress from the solder joints of the motors as the vehicle moves. This will have a big impact on the reliability and longevity of the vehicle.
DRV8837 Diagrams:
The testing of the DRV8837 is shown below. This illustrates the speed that the DRV8837 is able to turn on and turn off compared to the original H-Bridge design.
Turn on time ~ 300 ns
- Turn on time ~ 300 ns
Compared to H-Bridge ~ 80 µS
- Compared to H-Bridge ~ 80 µS
Turn off time ~ 300 ns
- Turn off time ~ 300 ns
Same as H-Bridge
- Same as H-Bridge
As you can see, the DRV8837 is able to turn on much faster than the H-bridge. The data above allows for the following calculations of the maximum PWM frequency to control the motors.
DRV8837 turn on time = 300ns
- DRV8837 turn on time = 300ns
T = turn on + turn off + delay
- T = turn on + turn off + delay
T = 300 ns + 300 ns + 500 ns
- T = 300 ns + 300 ns + 500 ns
f = 1/T
- f = 1/T
f = ~900kHz compared to 12kHz for H-Bridge
- f = ~900kHz compared to 12kHz for H-Bridge
Encoder Connections:
The encoders output a pulse to the microcontroller every 15 degrees of rotation. The MSP432 can count these pulses to determine distance traveled and, as a result, its position within the maze.
Motor Stability:
The dark gray motor mount eliminated any wobble in the motors. The bottom attached chassis removed any stress on the motor solder joints as the vehicle accelerated or stopped.
Subsystem Conclusion:
The brushed DC motors with encoders provide an accurate and efficient way to traverse and track the maze. The DRV8837 is necessary to effectively control the speed and direction of the motors and was determined to be a better solution than the custom built H-bridge. From testing, the motor mounts seemed to greatly improve the stability of the motors. The next step would be to 3D print the motor mounts and chassis to perform further testing to ensure this design works properly.
5d. Power(Amanda Pound)
The power supply for the Micromouse will consist of four 1.5 volt alkaline (AA) batteries in series for a total nominal voltage of ~6 volts and a capacity of ~2.5Ah. The batteries will be used to power the MSP432411Y microcontroller, motors, encoders, and sensors. The motor drivers, encoders, and ultrasonic sensors require a 5 volt supply. The voltage from the batteries will be stepped down to the required 5 volts using two LD29150DT50R linear regulators. Similarly, the microcontroller, IR emitter, and IR detectors require a 3.3 volt supply. The supply voltage will be stepped down for these components using a TLV1117-33CDCYR regulator.
The battery life of the Micromouse is estimated to be ~2 hours. This estimate was calculated based on the max current draw outlined in the datasheet for each component and assuming each component is constantly drawing power. This conservative estimate still comes in over our requirement of a half hour of operating time leaving a lot of space for potential future added capabilities.
Power Supply Schematic
Subsystem Conclusion
The alkaline battery pack works well for our product because AA batteries are widely available and fairly affordable and they have a small footprint. The pack also has enough capacity to power the Micromouse more than the required 30 minutes. The linear voltage regulators are also cheaper than the buck alternatives and at our low operating voltages have a small enough dropout voltage to work reliably.
5e. Software(Shane Hooley and Amanda Pound)
On the software side, we have two major objectives. First, we need to have a completed program that will traverse the Micromouse through the maze. Second, we need working code examples, such as line following and wall detection, that interface with the different peripherals such as the motors, sensors, and LED’s.
By providing example code that demonstrates how to interface with the different components as well as a completed maze navigation program, we will be providing users all the tools they need in order to develop their own strategy for solving the Micromouse maze. This allows our project to function as both a general robotics kit as well as a Micromouse competition starter kit, increasing the audience for our product.
Line Following:
Line following code is meant to be a simple example for the kit’s users to better understand how to interface with the IR Emitter and Detectors. The code requires contrast between the floor and the line, and does a quick calibration to store both values. Once the robot is placed on the line the user can hit the start button. The code then uses the values gathered from the IR sensors to calculate its relative position over the line. It then controls the motors to make small adjustments to center itself while moving forward.
Wall Detection:
Similar to the line following, wall detection is meant to be sample code to help the user understand how to interface with the ultrasonic sensor. When placed in a maze this code will serve two purposes, keep the robot centered between the walls as it moves forward as well as keeping the robot off a collision path with any walls in front of it. If the robot encounters a wall in front it will check to see if it is at a corner, dead-end, or intersection, and make the appropriate action. This code will also serve as an example of how to interface with the ADC as the readings from the ultrasonic sensor will need to be converted in order to be read by the microcontroller.
Maze Solving:
Maze solving described here is mostly theoretical due to the COVID-19 pandemic putting restrictions upon our ability to design and test different software and hardware. However, the maze traversal code onboard the RSLK and the maze solving method has been proven to work through smaller demos and simulation. To solve the maze, the robot will need a few modes of operation. The first will be a search mode where the robot will be in the maze for the first time, locating the center. This will be done by updating a graph of the maze with what cells connect to other cells. The robot traverses the maze by utilizing its ultrasonic sensors, which will tell it if it is safe to move forward or if it needs to pivot. It will know its location through the use of the encoders attached to the DC motors. Once the robot is in one of the center four cells, it runs a search algorithm to find a path from start to finish, which is detailed further below. Once that path is determined, it follows the path back to the start to be set up for its next run. The mode is then changed to solve mode where the robot already has the shortest path in memory. The robot then follows the path to the middle of the maze, solving it, then returns to the start.
The ultrasonic sensors work on the principle of an interrupt that changes it’s interrupt edge from positive edge to negative edge, defining the response pulse from the ultrasonic sensors. When an interrupt is triggered on the positive edge of an ultrasonic sensor pin, a bit is set that allows an always running timer interrupt to increment a counter, until a negative edge interrupt is generated that resets the counting bit. As for the encoders, due to their method of operation, which sends a pulse whenever they rotate a certain distance, the pins the encoders send data on will have positive edge interrupts set to increment counters. Between the ultrasonic and encoder data that comes back to the MSP432P411Y, the robot’s position in the maze will be identifiable, which will eventually lead to the solving of the maze. There will also be timers running to control the PWM. This will utilize an UP timer, which restarts after reaching the value set in TIMERAx_CCx0, ultimately setting the PWM period. The duty cycle of the PWM will be set through CCx1 and CCx2, which will modify the outputs on their respective pins.
As for the maze solving algorithm, the best determined approach was to use a modified Breadth-First search. The modification is detailed as a predecessor node array that maintains the node that accessed the current node. This forms a data structure similar to a tree, which can be followed to form the parent node all the way to the desired node. Once the desired node is reached, the predecessor array is followed back to the start, with each node traversed being stored in a “solved” array. This array can then be accessed to output the shortest correct path from the starting position to the center of the maze. This may, however, not be the fastest path due to the amount of turns that may be present and lack of straight paths. This is for the end user to determine. The example maze solving algorithm is meant to be inspiration or a good starting point for the end user.
Subsystem Conclusion
COVID-19 has drastically altered our project timeline, as well as the demos and deliverables we were able to procure. We, to the best of our ability, worked well as a team to develop software that integrated with our hardware to deliver what we could from the software side. A lot of functionality was proven onboard an incorrectly functioning alpha level Micromouse Board prototype, as well as proof of concepts being run on the RSLK as well as through simulation using CLion and Java.
6. Conclusion- After careful evaluation of our overall design, component selection for each of our subsystems, and the first assembly of the Micromouse we were able to complete, we believe that this design best fits the scope of our project. Our design is aimed at minimizing cost as well as ensuring that our product requirements are completely fulfilled. Although our project could not be fully completed, our engineering rigor, along with our models, simulations, and alternate demonstrations, prove that our design would be functional if it was completed.
Maze Traversal Video:
https://drive.google.com/open?id=1z52JMunF6zPWU9L1X3OM0WaG9x00mHfW
Comments