Friday, December 12, 2014

Solidworks Models


Motor Extension
Joint that connects the axle and wheel.

Top Panel
Top Shell used to house the Arduino.

Base Panel

Assembly including dc motor supports and previously named parts.

Laser Cutter in Action!


Movement!


Our Unfinished Code

 here
#include <Adafruit_MotorShield.h>
#include <Servo.h>
#include <Wire.h>
// Pin constants for the Ultrasonic sensor.
const int pingPinOut = 8;
const int pingPinIn = 8;
// Constant Definitions
const unsigned slowSpeed = 400;
const unsigned fastSpeed = 800;
const unsigned openSpace = 7;
const unsigned turnTime = 1000;
Adafruit_MotorShield AFMS = Adafruit_MotorShield();
// Declares the left motor on the Adafruit M3 and right motor on M4.
// Declares the Ultrasonic sensor as "myLooker".
Adafruit_DCMotor *lMotor = AFMS.getMotor(2);
Adafruit_DCMotor *rMotor = AFMS.getMotor(3);
Servo myLooker;
void setup()
{
Serial.begin(9600);
// Declares the servo motor that the ultrasonic sensor is on to pin 9.
myLooker.attach(9);
AFMS.begin();
}
void loop()
{
delay(2000);
bool found = SolveMaze();
// If the goal of the maze was found, the robot will do a happy dance.
if (found == true)
{
goLeft(100);
goRight(100);
goLeft(100);
goRight(100);
}
}
bool SolveMaze()
{
// Begins infinite loop to look for the maze goal.
for (;;)
{
// Declares the step counter "i" and the character path array "path".
unsigned i = 0;
char path[50];
// Assigns the variable "cm" to the distance to the wall that is calculated by the function "DistancePing".
long cm = DistancePing();
long x = cm;
// Begins loop to move forward and put the letter "F" into the path array.
// This continues for a preset distance.
LookForward();
path[i++] = 'F';
goForward(slowSpeed);
while (cm >= x - 15)
{
goForward(slowSpeed);
cm = DistancePing();
}
// Determines if either the left or right direction is open.
bool left = LookLeft();
bool right = LookRight();
// If Both are left and right are open the robot will determine if it is at the goal.
if (left == true && right == true)
{
bool end = ChckForEnd();
if (end == true)
{
// If it is at the goal it will begin to shorten the path array.
char sPath[50];
char one, two, three;
unsigned index;
for (index = 0; index <= i; index++)
{
one = path[index];
two = path[index + 1];
three = path[index + 2];
if (one == 'L' && two == 'B' && three == 'R')
sPath[index] = 'B';
else if (one == 'L' && two == 'B' && three == 'F')
sPath[index] = 'R';
else if (one == 'R' && two == 'B' && three == 'L')
sPath[index] = 'B';
else if (one == 'F' && two == 'B' && three == 'L')
sPath[index] = 'R';
else if (one == 'F' && two == 'B' && three == 'F')
sPath[index] == 'B';
else if (one == 'L' && two == 'B' && three == 'L')
sPath[index] == 'F';
else
sPath[index] = path[index];
}
// The robot will then return to the start of the maze.
for (unsigned a = index; a >= 0; a--)
{
char step;
step = sPath[a];
if (step == 'F')
goBack(slowSpeed);
else if (step == 'R')
goLeft(slowSpeed);
else if (step == 'L')
goRight(slowSpeed);
}
// The robot will wait and begin its speed run through the maze.
delay(5000);
for (unsigned b = 0; b <= index; b++)
{
if (sPath[b] == 'F')
goForward(fastSpeed);
else if (sPath[b] == 'L')
goLeft;
else if (sPath[b] == 'R')
goRight(fastSpeed);
else
break;
}
return true;
}
}
// If the robot is not at the goal and the left path is open, it will go left.
// Otherwise if right is open it will go right.
// If neither are open, it will turn around and go back.
if (left == true)
{
goLeft(slowSpeed);
path[i++] = 'L';
}
else if (right == true)
{
goRight(slowSpeed);
path[i++] = 'R';
}
else
{
goBack(slowSpeed);
path[i++] = 'B';
}
}
}
/*-------------- g o F o r w a r d ( ) ----------------------
Purpose: To move the robot in the forward direction.
*/
void goForward(int speed)
{
delay(1000);
lMotor->setSpeed(speed);
rMotor->setSpeed(speed);
lMotor->run(FORWARD);
rMotor->run(FORWARD);
delay(turnTime);
lMotor->run(RELEASE);
rMotor->run(RELEASE);
}
/*-------------- g o L e f t ( ) -------------------------
Purpose: To turn the robot left.
*/
void goLeft(int speed)
{
delay(1000);
lMotor->setSpeed(speed);
rMotor->setSpeed(speed);
lMotor->run(BACKWARD);
rMotor->run(FORWARD);
delay(turnTime);
lMotor->run(RELEASE);
rMotor->run(RELEASE);
}
/*---------------------- g o R i g h t ( ) ---------------------
Purpose: To turn the robot right
*/
void goRight(int speed)
{
delay(1000);
lMotor->setSpeed(speed);
rMotor->setSpeed(speed);
lMotor->run(FORWARD);
rMotor->run(BACKWARD);
delay(turnTime);
lMotor->run(RELEASE);
rMotor->run(RELEASE);
}
/*---------------------- g o B a c k ( ) ----------------------
Purpose: to turn the robot 180 degrees
*/
void goBack(int speed)
{
delay(1000);
lMotor->setSpeed(speed);
rMotor->setSpeed(speed);
lMotor->run(FORWARD);
rMotor->run(BACKWARD);
delay(turnTime);
delay(turnTime);
lMotor->run(RELEASE);
rMotor->run(RELEASE);
}
/*-------------- D i s t a n c e P i n g ( ) ---------------------------
Purpose: To determine the distance to the wall using the ultrasonic sensor.
*/
long DistancePing()
{
long duration, cm;
// Pings a test pulse, then the measured one.
pinMode(pingPinOut, OUTPUT);
digitalWrite(pingPinOut, LOW);
delayMicroseconds(2);
digitalWrite(pingPinOut, HIGH);
delayMicroseconds(10);
digitalWrite(pingPinOut, LOW);
// Read in the time it takes for the signal to travel and return.
pinMode(pingPinIn, INPUT);
duration = pulseIn(pingPinIn, HIGH);
return (cm / 29 / 2);
}
/*----------------------- L o o k F o r w a r d ( ) -------------------------
Purpose: Turns the servo so that the sensor is facing forward.
*/
void LookForward()
{
delay(1000);
int x = 90;
myLooker.write(x);
}
/*------------------------ L o o k L e f t ( ) ----------------------------
Purpose: Determines if the left side of the robot is open.
*/
bool LookLeft()
{
delay(1000);
long cM;
myLooker.write(0);
cM = DistancePing();
if (cM >= openSpace)
return true;
else
return false;
}
/*--------------------- L o o k R i g h t ( )------------------------------
Purpose: Determines if the right side of the robot is open.
*/
bool LookRight()
{
delay(1000);
long centiM;
myLooker.write(180);
centiM = DistancePing();
if (centiM >= openSpace)
return true;
else
return false;
}
/*----------------------- C h c k F o r E n d ( ) ---------------------------
Purpose: Determines if the robot is at the goal of the maze.
*/
bool ChckForEnd()
{
delay(1000);
long leftCenti, rightCenti;
myLooker.write(135);
rightCenti = DistancePing();
myLooker.write(45);
leftCenti = DistancePing();
if (rightCenti >= openSpace && leftCenti >= openSpace)
return true;
else
return false;
}

Wednesday, November 19, 2014

What we plan to achieve

A-Maze-Ing Solvers
Overview:
Imagine a world where disabilities do not have an impact upon a person’s mobility and ability to navigate efficiently. When looking specifically at visual impairment, which would arguably be one of the most difficult disabilities to cope with, little to no technology exists to aid these people. At the current point in time, the main methods that people with visual impairments use for transportation are guide dogs and/or a red cane with a white tip. This method is practical at its core and completes its goal of safely guiding someone from point A to B, however this method  does not take into account efficiency. In no way does  this technology help visually impaired people to find the most efficient path to follow, rather it simply expects that they can rely on their other senses in order to find the best path.  
Now imagine a hospital where patients are led from room to room in wheelchairs that drive themselves. The robot would be able to follow a common path, map out the area, and learn the shortest route from one place to another in the smallest amount of time. This technology could even be extended to transportation on a larger scale. If the wheelchair was designed for use on the street, it could be programmed to stop at places that are marked as caution areas, such as crosswalks or busy traffic areas that could be dangerous. Our robot could be connected through GPS and programmed to help people with various handicaps live easier lives. This could be modified in many other ways besides automated wheelchairs. Current technologies already exist using the concept we plan to explore. The Roomba, a robot vacuum, moves around the room vacuuming the things in its path. Other examples include parking sensors, mobile devices, and those sensors that stop the conveyor belt from moving at the cash register when your items get to the front.
BELT.gif
Proximity sensors in a conveyor belt
thumb.php
 Proximity sensors in a car
 
      
111994-iphonesensors.jpg
Proximity sensors in a smartphone



Anyone with blindness or a disability that requires a wheelchair would benefit from this type of machine. All of these influence direction and safety of the disabled person. There seems to be a lack of interest in solving this problem currently without the use of current technology. We are qualified to address this problem because we are motivated future mechanical engineers exploring the use of proximity sensors, motors and coding to create a project that if pursued further can be helpful to a lot of people.


A man forced to navigate through the streets with a disability.
A hospital patient unable to navigate on their own two feet.
    


Description of Solution:
With the A-Maze-ing solver, we will be utilizing the capabilities of proximity sensors in a mobile robot in order to solve a maze in the most efficient manner. With these sensors, our robot will be able to detect the walls in front of it and send a signal, which tells the robot to turn and go about another direction, successfully navigating from point A to B. These applications can be stretched far beyond mazes and can potentially help with navigation for the visually impaired. In these situations, a robot could detect an obstacle and notify its owner to allow for more efficient travel methods and avoid collisions. We chose this problem because we feel that there should be easier and more efficient ways for people with disabilities to navigate their world.
Existing solutions to the aforementioned problem are fairly limited and have been used for too long. These could include walking sticks and seeing eye dogs. Our team believes that something much more than just these overused methods can be created. For example, imagine having a wheel chair that was also a machine with sensors on it that mapped out your world for you and could alert you of any oncoming obstacle or danger.  The benefits pertaining to this idea would involve an easier life for certain groups in society. The expected price may vary, but we do not believe this to be a deterrence to the project. Our target audience would be either companies, such as hospitals, or people with disabilities, in which case health insurance should play a factor.


MicroMouse example
Performing functions of human likeness

MicroMouse Analysis:
Some materials needed to make the micromouse consist of 2 DC motors, a motor shield, one arduino kit, 3 wheels, a micromouse shell, proximity sensors, and one battery pack. The team will meet at least twice a week to go over coding, ideas, improvements, design, construction, testing, and prototyping. We will stay within our budget, provided by the competition guidelines, and utilize any other pieces that were found from recycled objects around the house. This will include taking apart old toys to find any other parts that will be useful.
The resources that are listed will be used to make the micromouse as agile, sleek, and functional as possible. Most of the previously mentioned items that are still needed will be bought at Adafruit, Pololu, Sparkfun and any other website we find that sells items for robotics.


 Important tools to our success
 Intricate coding and wiring to transmit information to microprocessors



Road Map:
Establishing a set amount of hours, based upon availability, will help make sure that we have sufficient time needed to work on the project and make sure it will be finished by the presentation date of December 4, 2014.


Steps:
  • Create code that works properly with the arduino micromouse
  • Buy the pieces needed to make the micromouse
  • Assemble the micromouse
  • Test the micromouse with the code periodically to make sure the code is compliant
  • Fix any problems and defects that arise from the code and micromouse compatibility


The risks we will come across may consist of time constraints, Inconsistencies pertaining to the mouse following the correct path, a lack of availability of necessary pieces within our budget, and minor issues within the code. Risk is always a part of any experiment or project, but should not be a deterring factor. Take a risk and believe in the A-Maze-Ing Solvers!

Today's work Nov 19

Solidworks designing 
 Start of the maze
 Working on our Arduinos
A layout of our materials

Monday, November 10, 2014

We got a new member!

From top to bottom: Alina Lautenschlager, Joeseph McCarthy, Nathaniel Hall, Adam Michaud and Mario Barrera. 

Monday, November 3, 2014

Hello World!


As the A-Maze-ing Solvers our group is going to build a robot that learns its surroundings as it moves around a maze so that it can find the fastest route possible.

micromouse shell

http://www.robotstorehk.com/metallic/metallic.html
this is what the micromouse shell should look like when we are done. The pieces can be bought from the above web page. These pieces could also be bought at any hardware store.

Monday, October 27, 2014

Code examples

We found example codes here
// Maze simulator object
function Maze(maze, startRow, startCol) {
this.maze = _.flatten(maze);
this.startRow = startRow;
this.startCol = startCol;
this.length = maze.length;
this.area = this.maze.length;
}
_.extend(Maze.prototype, {
// String helper
toString: function() {
return this.maze.toString();
},
// _.each() helper
each: function(fn, context) {
return _.each(this.maze, fn, context);
},
// Get a particular cell value
get: function(rowCol) {
return this.maze[ this.rowColtoZ(rowCol) ];
},
// X/Y coordiante (un)linearizing functions
rowColtoZ: function(rowCol) {
return this.length*rowCol[0]+rowCol[1];
},
zToRowCol: function(z) {
return [ Math.floor(z / this.length), z % this.length ];
},
// Similar to above, but calls relativify first
rowColtoZRelative: function(rowCol) {
return this.relativify(this.rowColtoZ(rowCol));
},
zToRowColRelative: function(z) {
return this.relativify([ Math.floor(z / this.length), z % this.length ]);
},
// Relativeify converter
relativify: function(rowCol) {
return [ Math.abs(this.startRow - rowCol[0]), Math.abs(this.startCol - rowCol[1]) ];
}
});
view raw gistfile1.txt hosted with ❤ by GitHub

This is it

This is the inspiration for our project.