Engineering Projects/Robot car/Howard Community College/Fall2012/P1-501 CDMR
Electronic Sections Expected
[edit | edit source]Problem Statement
[edit | edit source]To take a Power Wheels electric toy car and convert it into a robot car. This will be a car that can guide itself around the hall of HCC without human assistance, control, or otherwise input. There must be controls in place for controlling acceleration, stopping, guidance, and steering. Also because of the car we are working with, an entire steering apparatus must be fabricated to control the cars otherwise human operated steering system. An input and code strategy must also be established from which the cars directional decision making will be made.
Team Members
[edit | edit source]Mark Muhlbock
Christopher Wilson
Derek Staub
Rivesh Patel
Summary
[edit | edit source]First we will be starting out with a Power Wheels car, unmodified, as it comes from the factory. We will be hacking into the Power Wheels throttle controls with an Arduino circuit board to control foreward, backward, and stopping. This same board will control a system of relays, gears, and a motor that will be connected to the existing steering apparatus to control steering. Also a strategy will be formed from which the cars navigation will be based. At this point in the project the car will either be guided by an internal timing map, proximity sensors, or light sensors.
Story
[edit | edit source]When we first got authorization for the project we immediately began searching for a car. It was known from the beginning that with the nature of the car the most immediate mechanical hurdle was going to be steering. While part of the team was searching for a vehicle the other part was working on developing a steering system. Many motors were gone though however they were all omni directional. A motor that would turn both ways was found and secured. The problem with the motor is that currently it does not appear to be producing much power. This is the reason for needing gears to reduce the ratio from the motor to the steering apparatus. Though the motor is currently weak we have only tested it with an AC/DC converter that was plugged into the wall with a currently unknown voltage. When we receive the car the motor will be hot wired straight from the cars power source through a set of relays. So until it is seen how much power this motor can produce off of the cars battery the motor is not being eliminated from the parts bin. Though the search is still ongoing for a more powerful/appropriate motor.
We received notification on September 20th that HCC would be providing the car. So we ended our own search for a vehicle and are now awaiting the HCC supplied vehicle to arrive.
On September 21st part of the team met up to work on the vehicles steering system. Many gears were gone through from the parts bin in the engineering room however all of them seemed to produce more problems then solutions. Also a direct gearset would require a solid chassis for mounting and this would add challenge to the fabrication process. While wandering about the engineering room a bicycle was stumbled upon. This was the inspiration for using bicycle gears to reduce the ratio and a bicycle chain to transmit the power. This not only makes for easier fabrication but we don't have to worry about finding gears that mesh perfectly from a parts bin full of random gears. Also bicycle gears are metal and can be welded or epoxy bonded to the hub on our electric motor with greater stability than smaller plastic parts.
On September 24th the team got together in class to further refine the route this car was going in. It was decided that instead of using the motor that we found we were going to use a power window motor and regulator system from a car. The motor that we had before never truly impressed and would require power the car would not naturally have.
Advantages of the power window motor/regulator setup:
- 1 Already runs on 12 volts
- 2 Has plenty of power (have you ever caught your hand in a power window going up?)
- 3 Regulator assembly already comes with gears, arms, and parts that can be used. Very little rummaging through piles of junk to make it work.
- 4 System is already designed to be stuffed into a tight location so it should present less mounting and space issues.
On September 28th the team got together again to hash out more of this project. Derek had attached the motor/regulator to a piece of wood that will be easy to mount once we get the car. The setup was bench tested and found to have plenty of power. The decided method of attaching the apparatus to the cars steering wheel is to just strap the regulator arm to the steering wheel and cut off any unnecessary metal after the steering wheel. It was also decided that we are going to power the motor through an Arduino Monster Moto Shield after contemplating a system of relays that would of left us digging for more parts. We also began work on finding programming solutions for this whole setup.
On the week of October 1st we made a bit of progress. We did some searching to find Arduino programs that already work with what we are trying to do. Searching "monster moto shield" we found a few useful links:
- www.sparkfun.com/products/10182 (then click on "example code")
- www.arduino.cc/forum/index.php?topic=80273.0
- www.markszule.com/blog/2012/01/29/building-a-robot-dagu-magician-chassis-arduino/
the last link contains a zip file that is very similar to what we need.
On October 3rd we finally had the car. We immediately began taking measurements with a drill bit, a protractor, and a piece of tape. We determined that the range of the steering wheel was 45* in either direction with a total of 90* lock to lock. This is well withing the range of our steering motor. Not only that the steering effort is well within the range of what the motor produces. The steering motor/setup was then measured at 65* either way or 130* total rotation.
Next step was to develop a way of manually stopping the motor at 45* so that it could not destroy the car. Several ways were discussed to do this. Some of the ideas were:
- Fill space in gears with epoxy.
- Fill space in gears with solder.
- wrap a thin peace of metal around the sector gear where we want it to stop to jam the gear.
- cut off sector gear where we want it to stop.
Chris took the steering motor/assembly home to continue working on a solution to this.
On October 5th the team met again to work on the project some more. Mark and Derek got the arduino and a Ultra Sonic Sensor (HC-SR04) proxy sensor to read a serial output in centimeters. The range of the sensor is 200cm and can read to about 25* off center. With this we did some tests on the car.
We found that the cars steering radius was barely enough to accommodate the range of the sensor. Several ideas were discussed and we finally decided that the sensor would be placed on the left side of the car and that the programming would make the car only turn on left had corners (henceforth known as the NASCAR method). With this the car can ride a wall and sense when there is a turn by detecting the wall next to it rather than whats in front of it. This works better with the sensors range and will lend to easier programming.
On October 10th our group set up the sensor and arduino to a bread board we did not need the moto shield because today was focused on coding. We continued where we left off on the 5th trying to break down the coding we used that allowed the sensor to detect range and how we could take the input from the sensor and output its signals to the steering motor so that when the sensor detects that it is for example 50-100cm from an obstacle it will initiate a left turn for (x) amount of seconds before steering back into the straight position. The folowing code is what we used to detect range with the HC-SR04 sensor.
/*
HC-SR04 Ping distance sensor] VCC to arduino 5v GND to arduino GND Echo to Arduino pin 13 Trig to Arduino pin 12 */
- define trigPin 13
- define echoPin 12
void setup() {
Serial.begin (9600); pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT);
}
void loop() {
long duration, distance; digitalWrite(trigPin, LOW); // Added this line delayMicroseconds(2); // Added this line
digitalWrite(trigPin, HIGH);
// delayMicroseconds(1000); - Removed this line
delayMicroseconds(10); // Added this line digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); distance = (duration/2) / 29.1; if (distance >= 200 || distance <= 0){ Serial.println("Out of range"); } else { Serial.print(distance); Serial.println(" cm"); } delay(500);
}
- IMPORTANT!* TO USE THIS CODE COPY AND PASTE IT FROM THE EDIT WINDOW.
On October 12th the entire group met together, Chris brought an epoxy "Loctite" and cut out some sheet metal to fabricate the mechanical stops for the motor itself while Mark and Derek worked on coding for the motor and sensor. We based the code off of one we found on this site
- define trigPin 12
- define echoPin 13
- include <Servo.h>
Servo myservo;
void setup() {
Serial.begin (9600); pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); myservo.attach(9);
}
void loop() {
int duration, distance,pos=0,i; digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); distance = (duration/2) / 29.1; Serial.print(distance); Serial.println(" cm"); if(distance<5) { myservo.write(180); } else{ myservo.write(0); } delay(100);
}
- IMPORTANT!* TO USE THIS CODE COPY AND PASTE FROM THE EDIT WINDOW
So far we have used the above code and been able to move the steering motor back and forth and we are able to adjust the time the motor turns in each direction the problem is this code is on a loop so it stops getting input from the range sensor. Given more time our group would work more on the code we have all the basic setup for the steering. We have the arduino, range sensor, moto sheild and steering motor and we have assembled them all and it does work with the above code it is simply our code is telling the motor to turn keep turning in a loop cutting off feed from the sensor our next step would be to have this same code but without the loop function our efforts to change the loop function code were unsuccessful in turning the motor again.
Here is the configuration used with the Monster Moto Shield and the Arduino See mark muhlbock's user page for details on which wires are which
For the manual stops part was done during the meeting by first taking a 6 inch by one inch strip sheet metal and cutting it in half. Then the two halves were taken and both flattened and bent perfectly to 90* in a vise. All sheet metal and mating surfaces were sanded with 60 grit sand paper. after that epoxy was applied to the inside of one of the bent pieces of metal and applied to the bottom surface of the sector gear. From there it was held in place for about 5 minutes to set. Since the epoxy has a dry time of 20 min and a cure time of 24 hrs work on this end was continued at home.
After the epoxy was given about 4 hrs to set Chris then filled the space in between the gears with epoxy and applied epoxy to the top surface of the sector gear. with a large set of channel locks and a trim hammer the piece of metal was held in place while a light tapping force was used to bend the steel around the rest of the sector gear and flatten it. The channel locks were then used to pinch down the bend area around the gears to make for a tight fit and then the pliers were used again to hold the metal flat against the gear until the epoxy was dry enough to hold on its own. These may seem like lots of extra steps and details but they lead to a very tight fit that will allow the gear to go all the way into the regulator where the stopper needs to meet the gear. These extra steps also lead to a stronger bond that will endure multiple uses.
Approximately 4 hrs after that the epoxy was strong enough for testing. Chris tested both stops multiple times and the operation is smooth, quiet, and there is no drama when you reach the end, the assembly just stops with no binding and comes back off the stop with no sticking, slack, or noise. This is in part due to the exact placement of the stoppers. they are positioned at the top of the sector gears tooth in such a way that the actuating gear would have to stop in a way that the next actuating tooth would be at less than 180* of rotation while the current actuating tooth is already firmly positioned against the sector gears last tooth.
Unfortunately we were unable to finish the robot car. The biggest hold up is software. Nobody on the team is good enough with Arduino to just sit down and knock out a code for what we are trying to do. It took some time getting the car and getting the steering assembly put together, however even if we had those things the first day of the project we still of been held back by our ability to use the software.
Decision List
[edit | edit source]- A power window motor and regulator from a car will be used to operate the steering
- A Arduino Monster Moto Shield will be used with an Arduino Uno to control the steering system and will eventually be intigrated with the rest of the cars functionality.
- A Ultra Sonic SC-SR04 range sensor will be mounted to the left side of the car and the car will be programmed to follow a wall to the left.
Material List
[edit | edit source]- 1. Power Wheels car
- 2. Power window motor and regulator from a car
- 3. Wiring
- 4. AC/DC converter wall plug for bench testing
- 5. Wood for mounting motor/regulator
- 6. Arduino, bread board, and wiring
- 7. Range sensor
- 8. Arduino Monster Moto Shield
Will need to continue:
- 1. Programming code
- 2. Basic wood and nails/screws to mount steering assembly to car
Software List
[edit | edit source]Links to other sites we used that aided in our coding research:
http://code.google.com/p/arduino-new-ping/
http://arduino.cc/forum/index.php?topic=125711.0
http://winkleink.blogspot.com/2012/05/arduino-hc-sr04-ultrasonic-distance.html
Arduino software will be used. A rough mask for the programming we will be using to operate the steering can be found here:
http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Dev/Arduino/Shields/MonsterMoto_Shield_Example.pde
Next Steps
[edit | edit source]We must develop a program that works with our range sensor, arduino and moto sheild to make our motor turn based on the distance the sensor reads.