User:Timoni/ENES-100/Project 2

Week 1 Narrative
I continued the same project that I worked on for project 1; the beer retrieval robot. I left off with the two non-continuous servo motors installed on our robot, and I had at least gotten the those servos to move the robot, even though they could only rotate 180 degrees. The first thing I did was acquire the continuous servo motors and attach them to the robot. We also found more durable wheels that looked stylistically better and fit with the motors more easily.

Next, we found a code that we could test the new servos with.

include 

Servo servoLeft;         // Define left servo Servo servoRight;       // Define right servo

void setup { servoLeft.attach(10); // Set left servo to digital pin 10 servoRight.attach(9); // Set right servo to digital pin 9

void loop {           // Loop through motion tests forward;           // Example: move forward delay(2000);         // Wait 2000 milliseconds (2 seconds) reverse; delay(2000); turnRight; delay(2000); turnLeft; delay(2000); stopRobot; delay(2000);

// Motion routines for forward, reverse, turns, and stop void forward { servoLeft.write(0); servoRight.write(180);

void reverse { servoLeft.write(180); servoRight.write(0);

void turnRight { servoLeft.write(180); servoRight.write(180);

void turnLeft { servoLeft.write(0); servoRight.write(0);

void stopRobot { servoLeft.write(90); servoRight.write(90);

It was simple, just enough for the motor to move forward, backward, left and right in particular order. Whats most important is the the robot's wheels rotated much more than 180 degrees. Continuous rotation is completely imperative to our robot. Once we completed this, our project was ready for its next step that will be explored next week.

Week 2 Narrative
The next step for our project is object avoidance. We need a way for our robot to know when/if something or someone is in its way, and be able to avoid it however necessary. In order to do this, we needed some sort of sensor. There are 2 types of sensors that would fit our needs, either an infrared sensor or an ultrasonic sensor. An infrared sensor senses the contrast between white and black and using that as a guidance system. For example a robot with an infrared sensor could follow a white line on a black surface to quite surprising accuracy. A common infrared sensor cost around $12-15.

It worked perfectly. I soldered the top pin set and my partner soldered the bottom one. While soldering we learned that although doubtfully harmful to the circuitry, one does not need as much solder as most everyone online said was necessary. We used about half as much most others used and our pins still completed the circuit. With the HC-SR04 sensor now fully attached we would be able to move into the next phase of our project. This phase would be getting the sensor to work in tandem with the motors and actually have the robot avoiding objects.

Week 3 Narrative
Our goal for this week was to get the robot's ultrasonic sensor working at the level necessary to avoid objects in its path. The first problem we faced after getting the HC-SR04 sensor attached electrically to the arduino was getting it to actually sense or do anything. When we first got it attached and then tried to run the sketch that we found, nothing happened. Neither the motors nor the sensor seemed to be working at all. After some retrial and fiddling we decided to regroup and look at the problem again. Since we knew that our motors were sound, we figured it had to be either the electrical configuration of the sensor, the sensor itself, insufficient power, or the arduino code itself. To eliminate one of the possible problems, we attached the arduino and robot to the laptop, so power could be an issue no longer. Still the robot did nothing. Then we double and triple checked the configuration of the sensors wires, and retested all of the soldered pins to make sure that they could carry a charge. All of that checked out, so the electrical details also could not be the problem. Then we considered the sensor just not working at all, or maybe being somehow incompatible with our arduino. To try and see if this was the problem, we attached an LED light to the arduino and changed the code to where whenever the sensor sensed an object, the LED would turn off; otherwise it would stay lit up. This actually worked, so we were able to cross a faulty sensor off the list of possible problems as well. Now the only plausible problem that could be hindering our work was the code. We searched online endlessly for codes to test the sensor with the motors; but ran into many setbacks. First of all many of the codes were for DC motors instead of servos, so that rendered them useless. Secondly, some codes would fit all of our requirements, but for some reason would not pass the Arduino program's verification test. The program named all manner of reasons for that. Lastly some codes were just incomplete or shoddily written so they didnt work either. After more hours of searching, I came across a code that someone used for a robot with the same purpose as our current mission statement; object avoidance. However his robot used DC motors to power the wheels, and a servo motor to turn the sensor; like a set of eyes on a rotating head. I decided to attempt to repurpose his code for our robot, deleting the parts that used the servo to rotate the sensor, and changing the specifications for DC motors to servo motors instead. So far, I have been met with failure as whenever i try to verify it in the program, there always seems to be a problem. This setback is proving very time consuming to remedy. Our goal for the next week is to find a way to fix this problem, and possibly integrate an infrared sensor to make guiding the robot back to you after it fetches the beverage that much easier.

Week 4 Narrative
Last week our group was met with the struggle of producing a code that would activate the ultrasonic sensor and the motors simultaneously. The goal was to get the robot to move forward, scan its surroundings for obstructions, and then proceed depending on whether or not there was an obstruction or not. The code I attempted to repurpose finally passed the verification process, but it did nothing to the robot. Professor Dolge afterwards helped us tweak another code we had, but the same thing happened. It passed the verification and it was structurally and procedurally sound; however the wheels only rotated slowly and in opposite directions. We still have not found a code that works with our project, but that is our focused goal. Once we achieve that we will work on the reflectance sensor.