Distance check using encoders
Posted by aavalos3 in Uncategorized on November 2, 2011
I used two optical encoders, calculated the distance traveled on each pulse of the encoder. In the code I just send the distance to be traveled in inches. The code will use the wheel encoders to go that exact distance.
H-bridge Diagram with capacitors and a NOT-gate
Posted by aavalos3 in Uncategorized on October 14, 2011
This is the diagram I created. It is based on Abdullah’s diagram with the addition of PWM, capacitors and a NOT gate. This implementation should drive the motors of one side. Another chip with the same diagram should drive the motors on the other side of the car.
The capacitors will be needed to filter any noise from the motors.
The PWM input would necessary to add variable speed to the motors. If you don’t need it, connect it to 5V.
The addition of NOT-gates is not necessary, but I think I could help reduce the amount of pins used on the micro-controller side.
My ultrasound mount
Posted by aavalos3 in Uncategorized on October 5, 2011


This is my ultrasound mount, I did it with some parts that I found in the shop at school.
Processing
Posted by aavalos3 in Uncategorized on September 16, 2011
This is our group’s sketch using processing. This is the path that our robot will follow. This has 5 main divisions which will be the tiles. Each main division (tile) is divided into three.
Our robot will navigate through the middle of the tiles following the path shown below.
The code includes an animation showing how the robot will follow this path
int screenXValue = 500;
int screenYvalue = screenXValue;
int nbOfInnerDivisions = 3;
int nbOfOuterHorizontalLines = 5;
int nbOfOuterVerticalLines = nbOfOuterHorizontalLines;
int nbOfInnerHorizontalLines = nbOfOuterHorizontalLines * nbOfInnerDivisions;
int nbOfInnerVerticalLines = nbOfInnerHorizontalLines;
int xpos;
int ypos;
float rectWidth;
float rectHeight;
float HorizontalGap;
float VerticalGap;
int k;
void setup()
{
size (screenXValue,screenYvalue);
background (100,150,150);
drawLines(255,255,255,nbOfInnerHorizontalLines, nbOfInnerVerticalLines);
drawLines(0,0,0,nbOfOuterHorizontalLines, nbOfOuterVerticalLines);
HorizontalGap = (float)height/nbOfInnerHorizontalLines;
VerticalGap = (float)width/nbOfInnerVerticalLines;
rectWidth = (screenXValue/nbOfOuterHorizontalLines)/nbOfInnerDivisions-1;
rectHeight = (screenYvalue/nbOfOuterVerticalLines)/nbOfInnerDivisions-1;
drawRects(VerticalGap, HorizontalGap);
xpos = (int)HorizontalGap + 1;
ypos = (int)VerticalGap + 1;
k = 0;
}
void draw()
{
animateSquare();
}
void drawLines(int r, int g, int b, int nbOfHorizontalLines, int nbOfVerticalLines)
{
stroke(r,g,b);
float distanceBetweenHorizontalLines = (float)height/nbOfHorizontalLines; //giving the distance between the lines a constant value
float distanceBetweenVerticalLines = (float)width/nbOfVerticalLines;
for(int i = 0; i < nbOfHorizontalLines; i++)
{
line(0, i*distanceBetweenHorizontalLines, width, i*distanceBetweenHorizontalLines);
}
for(int i = 0; i < nbOfVerticalLines; i++)
{
line (i*distanceBetweenVerticalLines,0,i*distanceBetweenVerticalLines, height);
}
}
void drawRects(float xpos, float ypos)
{
fill(100);
rect(xpos+1, ypos+1,rectWidth, rectHeight*4+4);
rect(xpos*2+2, ypos*4+1, rectWidth*6+5, rectHeight);
rect(xpos*2+2, ypos+1, rectWidth*3, rectHeight);
rect(xpos*4+1, ypos*2+2, rectWidth, rectHeight*6+5);
rect(xpos*7+1, ypos*5+2, rectWidth, rectHeight*6+5);
rect(xpos*8+2, ypos*10+1, rectWidth*6+5, rectHeight);
rect(xpos*5+2, ypos*7+1, rectWidth*6+5, rectHeight);
rect(xpos*10+1, ypos*8+2, rectWidth, rectHeight*5+3);
rect(xpos*13+1, ypos*11+2, rectWidth, rectHeight*3+1);
rect(xpos*10+1, ypos*13+1, rectWidth*3+1, rectHeight);
fill(255);
}
void animateSquare()
{
if(k>=0 && k< (VerticalGap*3))
{
rect(xpos, ypos++, rectWidth, rectHeight);
//delay(50);
}
else if(k>=(VerticalGap*3) && k<(VerticalGap*9))
{
rect(xpos++, ypos, rectWidth, rectHeight);
//delay(50);
}
else if(k>=(VerticalGap*9) && k<(VerticalGap*15))
{
rect(xpos, ypos++, rectWidth, rectHeight);
//delay(50);
}
else if(k>=(VerticalGap*15) && k<(VerticalGap*21))
{
rect(xpos++, ypos, rectWidth, rectHeight);
//delay(50);
}
else if(k>=(VerticalGap*21) && k<(VerticalGap*24))
{
rect(xpos, ypos++, rectWidth, rectHeight);
//delay(50);
}
else if(k>=(VerticalGap*24) && k<(VerticalGap*27))
{
rect(xpos–, ypos, rectWidth, rectHeight);
//delay(50);
}
else if(k>=(VerticalGap*27) && k<(VerticalGap*33))
{
rect(xpos, ypos–, rectWidth, rectHeight);
//delay(50);
}
else if(k>=(VerticalGap*33) && k<(VerticalGap*39))
{
rect(xpos–, ypos, rectWidth, rectHeight);
//delay(50);
}
else if(k>=(VerticalGap*39) && k<(VerticalGap*45))
{
rect(xpos, ypos–, rectWidth, rectHeight);
//delay(50);
}
else if(k>=(VerticalGap*45) && k<(VerticalGap*48))
{
rect(xpos–, ypos, rectWidth, rectHeight);
//delay(50);
}
k++;
if(k >=VerticalGap*48) setup();
}
Atmel’s AVR architecture
Posted by aavalos3 in Uncategorized on September 13, 2011
The arduino microcontroller is based on Atmel’s AVR chips. The AVR is a modified Harvard Architecture 8-bit RISC. It is a modified Harvard Architecture because it is equipped with separate, dedicated memories and buses for program and data information.
This microcontroller also follows instructions set based on the RISC concept. RISC means Reduced Instruction Set Computing. It is an strategy to have simplified instructions or operations that work in fewer CPU cycles increasing the chip’s performance.
Although Arduino uses its own modified version of a library-driven C++, because it is based on an AVR mocrocontroller, we can program it in C or assembly, reducing the size that the program will take inside the microcontroller’s flash memory. Assembly language would probably be one of the most effective, but it requires to know more internals details about the hardware and it is not very portable. C language would still allow direct control of the hardware and it is portable.
Chess robots solutions
Posted by aavalos3 in Uncategorized on September 5, 2011
There were several questions that surfaced during our discussion about building a chess game made with robots.
One of them was how to make them more cost efficient. One of the ways is making 2WD robots instead of 4WD. This will actually solve 2 issues; It will reduce the amount of power consumption since the robots will require half of the amount of current to actually move, and you are also saving money on buying extra motors.
Another issue that surfaced related to power consumption is the need of h-bridge drives, which is an IC that enables you to supply enough voltage and current to the motors which the arduino micro controller cannot. The Arduino board will send a HIGH or LOW signal (5v or 0v) and the h-bridge will take power from a different source the power the motors.
Also, like all motors, these will create noise which can affect the readings from our sensors. We will need a way to filter the noise using discrete components to avoid getting false readings.

