- Jan 15, 2001
- 15,069
- 94
- 91
I recently finished working on a mobile robot that had to navigate through a maze and evade a predator. I thought the HT section might find the project to be interesting and also if anyone has any specific questions, I would be happy to answer them.
Some background:
The robot had to use a Motorola 68HC12 microcontroller, Tamiya gearbox, and a Pololu Serial dual channel motor controller. Other than that, it was up to each team how they wanted to meet the goals. My team (me and one other guy) decided to try both IR and ultrasonic sensors. We tested both sensors extensively and even put both types on a few prototype robots, but we ended up using only IR for the final project because the ultrasonic wasn't working quite like we were hoping.
The output of each sensor was connected to an analog to digital conversion port of the 68HC12, and from that a "count" was generated. Based on the count, motor directions and outputs were calculated through fuzzy logic. If anyone is interested, here are some files and pictures of the calculations and components.
Excel file for fuzzy membership functions and outputs
Circuit board I designed (previous classes used a big mess of wires). I included 8 transistor driven externally and individually controllable channels. The 68HC12 can't source or sink very much current, but all of the LEDs you will see in the video are high power and would have overloaded it. For this reason, the 8 channels can be turned on and off by the microcontroller by pulling an output pin low or high, which puts the transistor connected on the other end into cut-off or saturation mode. Drawing - Actual Board
Robot body (drawn in solid edge, printed in a rapid prototyper)
Actual Front - Drawing of Front -
Actual Rear - Drawing of Rear
Inside of the robot
Here is a zip file with all of the code we wrote to make the robot work. Main.c and Fuzzy.asm are the "main" files. The evasion section of this code revision uses the fuzzy logic just like the wall evasion program, but it has a 5 second spin-in-place loop as well.
Info on wall detection:
The short range sensors start to detect objects at around 40cm away from the front of the lens. Based on the distance from the front of the sensor, it outputs a certain voltage, which we converted into a "count" in the program. Based on the count, the reading was classified as either low, medium, or high, and was processed accordingly in the fuzzy logic. For example, if the front 3 short range sensors read in low, low, high (left, center, right), we would turn a moderate left since the right sensor was reading a high value. If the readings were high, high, low (left, center, right), we would turn a hard right since the left and center sensors are reading a high value (something is very close). Based on that decision and the magnitude of the turn needed, motor output values were chosen.
If it was determined that the robot had to turn a hard right, the left wheel might get a speed of 7C (on a scale from 00 to 7F, 7F being the fastest it can go) and the right wheel might get a speed of 04 (very slow). That setup should turn a very hard right because the left wheel is spinning way faster than the right.
If all 3 sensors read high, the robot went into backup mode (the function in Main.c is called Getoutofjam()...lol) and the back sensors turned on and used the fuzzy logic just like the front sensors.
Evasion info:
We tried TONS of different evasion modes. At the last minute, the sensors weren't acting like we wanted them to, so we programmed in a 5 second spin and then 5 seconds of driving using the fuzzy logic to avoid objects/predators. In the middle of the contest, we reprogrammed it with a loop to simply spin as fast as possible in place. The point of the evasion mode was to keep my professor from popping the balloon inside the top part of our robot. He popped it a few times, but this project was a huge success and the deans/teachers/students loved it, so he didn't bother taking points off for that.
Here is the webpage we threw together in about 5 seconds for the school website. There is a 5 minute video of the robot competition at the bottom. You have to click on the gif in the bottom right of the robot spinning in place. Link
BTW, you may notice hulk-bot on that page. That was the other team's robot, but their motor controller blew up about 10 minutes before the competition so they didn't get a chance to compete. The motor controllers we used were total garbage. We bought 6 (30 dollars each) and broke them about 15 times. I was able to fix them by switching components from board to board, but their microcontroller burned up (it was an 8 pin Pic) and since we didn't have the program that came flashed from the factory, I couldn't fix their controller.
Some background:
The robot had to use a Motorola 68HC12 microcontroller, Tamiya gearbox, and a Pololu Serial dual channel motor controller. Other than that, it was up to each team how they wanted to meet the goals. My team (me and one other guy) decided to try both IR and ultrasonic sensors. We tested both sensors extensively and even put both types on a few prototype robots, but we ended up using only IR for the final project because the ultrasonic wasn't working quite like we were hoping.
The output of each sensor was connected to an analog to digital conversion port of the 68HC12, and from that a "count" was generated. Based on the count, motor directions and outputs were calculated through fuzzy logic. If anyone is interested, here are some files and pictures of the calculations and components.
Excel file for fuzzy membership functions and outputs
Circuit board I designed (previous classes used a big mess of wires). I included 8 transistor driven externally and individually controllable channels. The 68HC12 can't source or sink very much current, but all of the LEDs you will see in the video are high power and would have overloaded it. For this reason, the 8 channels can be turned on and off by the microcontroller by pulling an output pin low or high, which puts the transistor connected on the other end into cut-off or saturation mode. Drawing - Actual Board
Robot body (drawn in solid edge, printed in a rapid prototyper)
Actual Front - Drawing of Front -
Actual Rear - Drawing of Rear
Inside of the robot
Here is a zip file with all of the code we wrote to make the robot work. Main.c and Fuzzy.asm are the "main" files. The evasion section of this code revision uses the fuzzy logic just like the wall evasion program, but it has a 5 second spin-in-place loop as well.
Info on wall detection:
The short range sensors start to detect objects at around 40cm away from the front of the lens. Based on the distance from the front of the sensor, it outputs a certain voltage, which we converted into a "count" in the program. Based on the count, the reading was classified as either low, medium, or high, and was processed accordingly in the fuzzy logic. For example, if the front 3 short range sensors read in low, low, high (left, center, right), we would turn a moderate left since the right sensor was reading a high value. If the readings were high, high, low (left, center, right), we would turn a hard right since the left and center sensors are reading a high value (something is very close). Based on that decision and the magnitude of the turn needed, motor output values were chosen.
If it was determined that the robot had to turn a hard right, the left wheel might get a speed of 7C (on a scale from 00 to 7F, 7F being the fastest it can go) and the right wheel might get a speed of 04 (very slow). That setup should turn a very hard right because the left wheel is spinning way faster than the right.
If all 3 sensors read high, the robot went into backup mode (the function in Main.c is called Getoutofjam()...lol) and the back sensors turned on and used the fuzzy logic just like the front sensors.
Evasion info:
We tried TONS of different evasion modes. At the last minute, the sensors weren't acting like we wanted them to, so we programmed in a 5 second spin and then 5 seconds of driving using the fuzzy logic to avoid objects/predators. In the middle of the contest, we reprogrammed it with a loop to simply spin as fast as possible in place. The point of the evasion mode was to keep my professor from popping the balloon inside the top part of our robot. He popped it a few times, but this project was a huge success and the deans/teachers/students loved it, so he didn't bother taking points off for that.
Here is the webpage we threw together in about 5 seconds for the school website. There is a 5 minute video of the robot competition at the bottom. You have to click on the gif in the bottom right of the robot spinning in place. Link
BTW, you may notice hulk-bot on that page. That was the other team's robot, but their motor controller blew up about 10 minutes before the competition so they didn't get a chance to compete. The motor controllers we used were total garbage. We bought 6 (30 dollars each) and broke them about 15 times. I was able to fix them by switching components from board to board, but their microcontroller burned up (it was an 8 pin Pic) and since we didn't have the program that came flashed from the factory, I couldn't fix their controller.