User:Iahmed2/ENES100/Project 1

Delete the italics (delete the two quote marks) when filling out this form.

Project Preference
1)Autonomous Power Wheel

2)BioVest

3)Wind Turbine

Problem Statement
Because we are in the third design phase of the project, we are mainly concerned with redesigning most of what the previous groups did. They designed actuators for the steering wheel and the gas pedal, but we want to refine them. We also have to write the codes for the actuators and then put the project together in a platform so it is portable.

Week 1 Narrative
This week, I read the CDIO reports that previous groups did to see what they did and where we have to start off. While reading, I realized that the previous groups have finished most of the project. All we need to do is to build the actuator that they designed and mostly just put the project together. We might need to make some minor changes from what they have.

When we met up this week, we though of a new design for the gas pedal and we tried to make a new design for the steering actuator. But, we had a hard time figuring out where the actuator should go. We also spent a little bit on designing a new platform because we didn't think the previous platform would work.

For this week, I was given the task of figuring out the battery part of the project. But, all I did was figure out how many volts each actuator and the Arduino would need. Then I figured out that we might need two or three batteries to power the autonomous power wheel.

Week 2 Narrative
This week our team met up to design the prototype of the steering wheel and the gas pedal, but I mainly worked on the gas pedal prototype. First, I looked around the lab to see what can be used the make the gas pedal and I found a hinge, a spring, and nails/screws. I figured that the hinge needs a screw in between the faces, so in order to hold the spring in place, I would have to put a nail or screw through the hing and the screw. I found a wedge to not only angle the hinge put to also nail the spring in between. In conclusion, I was able to build a make-shift gas pedal within an hour with some help.

After we designed and got the design approved, we designed what the gas pedal actuator will look like on paper. Then each of us was given the task of using CAD to design it so that we can print the part with the 3D printer. So I worked on designing the actuator and the bracket of the actuator on Sketchup. It was frustrating at first because I couldn't plug in the measurements (like the tutorial suggested. I had to physically move the mouse to the dimensions I wanted. But, I found it less frustration toward the end because I learned a lot from just using the program.

At the beginning of the week, I was tasked to measure the actuators' speeds and to figure out the turning wheel turning radius. Most of this information was already on the CDIO reports from before. So I didn't actually measure anything. However, we still needed to find out how far out the lever must extend from the center of the steering wheel so that the actuator would need less force to turn the wheel. I found the most useful was the torque formula. So I started by plugging in the radius of the steering wheel, the force the wheel needs, and the turning degree. After finding that torque, I plugged in a higher radius to see what the torque would be. To my confusion. I found the torque to be larger, which didn't make sense because the torque is supposed to go down when the lever is attached. So I kept trying only to find out i was using the wrong formula. With the new formula I was told to just plug in values for the torque, distance, and force, but to keep one constant each time. Trail and error.

The tasks I was given at the beginning of the week were already done on by the previous groups, so I worked on stuff that other people weren't working on so that I don't waste time.

Week 3 Narrative
his week, I worked on the circuit and the Arduino program, like the discussion page said. I thought that building the circuit would be hard and it would be time-consuming, but it was completely the opposite. Within 10 minutes I figured out where the wires need to go and I built the circuit. To test the circuit, I hooked up the Arduino to the computer and I uploaded the code to the Arduino.

This was also a way to test the code. The previous CDIO report said that the code works for both motors and it did, but I had to change some numbers. This is because both the gas pedal actuator and the linear actuator would extend for a few seconds and retract in half that time. Then they wouldn't do anything else. I wanted tot program he code so that the gas pedal actuator presses the pusher for the whol time during the drive and only retract when the drive is over. I also wanted to program the linear actuator to turn a full 360 to the right and then again to the left, which makes a figure eight. But while trying to change the numbers, I found that the actions of the motor didn't work according to how it was changed. After troubleshooting, I realized that I had the sketch setup to the wrong board.

Though I changed the board type, I ran into a bigger issue; the board started to smoke after we uploaded the code to it. SO, I tried loosening and re-tightening the wires, but it still smoked. So, I tried changing the motor shield, the Arduino, and the wires. But the circuit was till giving off smoke, and I couldn't figure out where it was coming from. I kept checking the circuit, but nothing seemed off. I couldn't work on the program itself because the circuit was wasn't working. But, the most important thing is that the code and the circuit worked despite the previous groups' concerns.

Week 4 Narrative
==/* MonsterMoto Shield Example Sketch date: 5/24/11 code by: Jim Lindblom hardware by: Nate Bernstein SparkFun Electronics License: CC-SA 3.0, feel free to use this code however you'd like. Please improve upon it! Let me know how you've made it better. This is really simple example code to get you some basic functionality with the MonsterMoto Shield. The MonsterMote uses two VNH2SP30 high-current full-bridge motor drivers. Use the motorGo(uint8_t motor, uint8_t direct, uint8_t pwm) function to get motors going in either CW, CCW, BRAKEVCC, or BRAKEGND. Use motorOff(int motor) to turn a specific motor off. The motor variable in each function should be either a 0 or a 1. pwm in the motorGo function should be a value between 0 and 255. */
 * 1) define BRAKEVCC 0
 * 2) define CW  1
 * 3) define CCW 2
 * 4) define BRAKEGND 3
 * 5) define CS_THRESHOLD 100

/* VNH2SP30 pin definitions xxx[0] controls '1' outputs xxx[1] controls '2' outputs */ int inApin[2] = {7, 4}; // INA: Clockwise input int inBpin[2] = {8, 9}; // INB: Counter-clockwise input int pwmpin[2] = {5, 6}; // PWM input int cspin[2] = {2, 3}; // CS: Current sense ANALOG input int enpin[2] = {0, 1}; // EN: Status of switches output (Analog pin)

int statpin = 13;

void setup { Serial.begin(9600); pinMode(statpin, OUTPUT);

// Initialize digital pins as outputs for (int i=0; i<2; i++) {   pinMode(inApin[i], OUTPUT); pinMode(inBpin[i], OUTPUT); pinMode(pwmpin[i], OUTPUT); } // Initialize braked for (int i=0; i<2; i++) {   digitalWrite(inApin[i], LOW); digitalWrite(inBpin[i], LOW); } // motorGo(1, CCW, 1023); // Push the gas pedal for 6 seconds motorGo(1, CW, 1023); delay(6000);//time required to push the pedal // Stop motor to leave the pushed pedal motorGo(1, CW, 0); delay(40000);//time required for the drive // Receed from the gas pedal for 6 seconds motorGo(1, CCW, 1023); delay(6000);//time required to stop the actuator from pushing }

void loop {  //turn all the way left motorGo(0, CW, 1023); delay(500); //time required for half stroke length //keep turning for 20 seconds motorGo(0, CW, 0); delay(20000);//time required for the turn //turn all the way right motorGo(0, CCW, 1023); delay(500); //time required for half stroke length //keep turning for 20 seconds motorGo(0, CCW, 0); delay(20000);//time required for the turn

if ((analogRead(cspin[0]) < CS_THRESHOLD) && (analogRead(cspin[1]) < CS_THRESHOLD)) digitalWrite(statpin, HIGH); }

void motorOff(int motor) { // Initialize braked for (int i=0; i<2; i++) {   digitalWrite(inApin[i], LOW); digitalWrite(inBpin[i], LOW); } analogWrite(pwmpin[motor], 0); }

/* motorGo will set a motor going in a specific direction the motor will continue going in that direction, at that speed until told to do otherwise. motor: this should be either 0 or 1, will selet which of the two motors to be controlled direct: Should be between 0 and 3, with the following result 0: Brake to VCC 1: Clockwise 2: CounterClockwise 3: Brake to GND pwm: should be a value between ? and 1023, higher the number, the faster it'll go */ void motorGo(uint8_t motor, uint8_t direct, uint8_t pwm) { if (motor <= 1) {   if (direct <=4) {     // Set inA[motor] if (direct <=1) digitalWrite(inApin[motor], HIGH); else digitalWrite(inApin[motor], LOW);

// Set inB[motor] if ((direct==0)||(direct==2)) digitalWrite(inBpin[motor], HIGH); else digitalWrite(inBpin[motor], LOW);

analogWrite(pwmpin[motor], pwm); } } }=