I am a second year computing student at Cardiff Metropolitan University and have been set an assignment to build an arduino robot.

I have paired up with Lauren Wright for this assignment and will frequently update my Tumblr as I complete this assignment.
staff:
“ Last month Tumblr took a decisive step toward transparency, and today we’re asking that our government do the same. We’re standing with our colleagues from across the web to demand transparency and accountability around laws concerning...

staff:

Last month Tumblr took a decisive step toward transparency, and today we’re asking that our government do the same. We’re standing with our colleagues from across the web to demand transparency and accountability around laws concerning privacy.

Today is “The Day We Fight Back” against unfettered surveillance. We hope you’ll join us

Tuesday, 10 December 2013

Update 4 (It lives!)

The code is now ready and the robot is now working. In this video it is clear that when the robot comes in contact with the wall it turns and carries on in another direction. (wall avoiding robot)

This video was chosen because it shows how the robot is able to get out difficult situations such as corners.

With Lauren Wright

Update 3 (Technical shizzle-wizzle)

Now that the robot is constructed we are ready to program it. In order to program it we used the Arduino software which runs of C.

Firstly we programmed the distance sensor to see if the cables were connected correctly and working. We had to download an additional library (NewPing) in order to allow the sensor to work. This is the code for the sensor:

#include <NewPing.h>

#define TRIGGER_PIN 14
#define ECHO_PIN 15
#define MAX_DISTANCE 200

NewPing DistanceSensor (TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);

void setup()
{
Serial.begin(9600);
}

void loop()
{

unsigned int cm = DistanceSensor.ping_cm();
Serial.print(“Distance: ”);
Serial.print(cm);
Serial.println(“cm”);

}

This is the test that proves that the sensors are working:

image

Note how the distance changes because during this test we moved the sensor closer and away form an object.

The next part was to program the motors. We did this separately to the sensor code because we wanted to make sure that the motors worked. 

This is the code used for a basic forward and backward test:

#include <AFMotor.h>

AF_DCMotor Motor1(1);
AF_DCMotor Motor2(3);

{
Motor1.setSpeed(150);
Motor2.setSpeed(150);
Motor1.run(FORWARD);
Motor2.run(FORWARD);
Motor1.run(BACKWARD);
Motor2.run(BACKWARD);
}

This is the final code with the sensor and the motor involved:

#include <AFMotor.h>
#include <NewPing.h>

AF_DCMotor Motor1(1);
AF_DCMotor Motor2(3);


#define TRIGGER_PIN 14
#define ECHO_PIN 15
#define MAX_DISTANCE 200

NewPing DistanceSensor (TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);

void setup()
{
Serial.begin(9600);
}

void loop()
{

unsigned int cm = DistanceSensor.ping_cm();
Serial.print(“Distance: ”);
Serial.print(cm);
Serial.println(“cm”);



if (cm >20 )
{

Motor1.setSpeed(150);
Motor2.setSpeed(150);
Motor1.run(FORWARD);
Motor2.run(FORWARD);
}
if (cm<20)
{
Motor1.setSpeed(0);
Motor2.setSpeed(0);
Motor1.run(BRAKE);
Motor2.run(BRAKE);
Motor1.setSpeed(255);
Motor2.setSpeed(255);
Motor1.run(FORWARD);
Motor2.run(BACKWARD);
}
}

Initially Lauren was in charge of programming and she was able to create the majority of the code. However after several tests it was clear that there were errors within her code, which is why I decided to have a go in order to improve the code. 

Eventually I was able to sort out the code by removing unnecessary delays and tweaking parts of the code. 

Even though I was able to fix the problem the majority of the credit should go to Lauren for writing up the mainframe of the code.

With Lauren Wright

Update 2.3 (The end is in sight)

We were now ready to attach the circuit board and the distance sensor. The distance sensor slots into the circuit board and the positioning is not that important as long as the connections are correct. To me it was important to have the sensors central because they represent the robots eyes.

image

The circuit board will sit on top of the chassis in front of the Arduino Uno. In order to make it clear to the connections that were created between the distance sensor and the Arduino Uno I have found a diagram online.

Arduino Robot

This diagram was not created by me and I do not own any rights. This diagram was taken from this website: http://blog.miguelgrinberg.com/post/building-an-arduino-robot-part-ii-programming-the-arduino

This is what the top of the robot now looks like. (The head and the eyes)

image

Currently the circuit board is held by Lauren’s hair band just in case we decide on changing the position of the board. I must admit this project would have failed would we not have had that hairband. It brought us closer to the robot, which motivated us even more.

Unfortunately it did not keep the circuit board in place very well, which made it annoying to connect wires and move the robot around. At one point I was ready to scrap the hairband idea and just stick the circuit board but Lauren insisted on keeping there in case we changed the position of the board.So we did and all in all it worked out fine.

image

All the components are now assembled and the robot is ready for programming.

So now the robot is complete. Isn’t it beautiful?

image

With Lauren Wright

Update 2.1 (On the upside)

Now that the chassis is fully assemble we were ready to attach the remaining components which would bring the robot to life. 

The final parts that we were going to attach include the Arduino Uno, motor drive, distance sensor and the circuit board (refer to the Budgeting and Components post in the archive for the components)

Firstly we attached the Arduino Uno to the top because this part is essentially the robots brain and will be programmed to allow the robot to function

NOTE: In order to attach the Arduino Uno we had to remove the top parts so that we could screw the board from the bottom. Also the positioning of the board is centered so that all the other parts could be placed around it. This makes the robot look neat and aesthetically pleasing.

image

Once the Arduino Uno was secured we reattached the top part of the robot to the rest of the chassis. We were now ready to attach the motor drive which simply slots onto the Arduino Uno, but before we could do this we had to connect the cables to the Arduino Uno and the motor drive.

In order to do this we required a motor shield, which separated the motor drive and the Arduino Uno with enough space for the cables to fit in. However since we have a small budget and did not wish to spend more money on the robot, we had to improvise and find an alternative.

So what we did was we cut one end of the cable, which gave us a thin copper wire which was big enough to fit into Arduino Uno slots and have the motor drive on top. this proved tricky but once the motor drive was placed on top it kept the cables in place.

image

The motor drive is now on top of the Arduino Uno with the cables attached. The reason for these cables will be explained in more detail later on, but they are there to make connections on the circuit board

image

With Lauren Wright

Update 2 (Up up and away)

The first component we added on the top part of the chassis was the battery pack

Then we added the top part of the chassis in order to cover the battery pack. This made the chassis look better and allowed for more space on the top part for the arduino and the circuit board.

 The middle part of the robot where the battery pack is positioned

image

The top part of the robot 

image

This is how it looks now with the parts to go on top beside the chassis

image

With Lauren Wright

Thursday, 14 November 2013

Update 1 (Motors, wheels and plastic)

The chassis is ready to be assembled

image

Firstly we had to assemble the chassis, and the first part was attaching the motors to the plastic casing. This was done by screwing the motors to the plastic and using bolts to hold them in place. 

image

Then we added the wheels by simply slotting them into the white plastic parts sticking out

image

After the main wheels were on we also had to add a third wheel which would allow the robot to turn around freely

image

The bottom part is now done.

With Lauren Wright

Tuesday, 8 October 2013

Budgeting and Components

In order to construct my chosen Arduino robot I will need the following components:

Chassis (Magician Chassis) £18.30

image

Arduino Board (Arduino UNO Circuit Board) £0.00 - Provided by the university

image

Motor Drive (SainSmart L293D Motor Drive Shield) £9.87

image

Distance Sensor (Ultrasonic Module HC-SR04) £5.90

image

Prototyping Board (BB400 Solderless Plug-in BreadBoard) £4.44

image

Cables (65Pcs Reusable Solderless Breadboard Jump Wire Cables) £0.89image

USB Cable (1.8M USB A-Male to B-Male cable) £2.39image

Amazon has a bundle which allows us to buy the Chassis, Prototyping board and a Distance Sensor for a total of £28.64. This saves us about £4.00

The maximum budget for my group is £80 which is more than the final cost of these products.

Using www.amazon.co.uk the total cost of the items listed above is £41.79 (Before post and packaging) which is below the budget.

The final cost of all the parts including post and packaging is £49.92

With Lauren Wright

Tuesday, 1 October 2013
lauwright:
“  this is the arduino uno board me and dimi will be using!
Dimitri:
”
“ This is the Arduino Uno board that Lauren and I will be using
”
With Lauren Wright

lauwright:

this is the arduino uno board me and dimi will be using!

Dimitri:

This is the Arduino Uno board that Lauren and I will be using

lauwright:
“ this is pretty much what we want our bot to look like, but we would be interested in having more of a shell/coat to make it look more neat and tidy dimitri what do you think?
”
This is basically what we are going to do. A mix between...

lauwright:

this is pretty much what we want our bot to look like, but we would be interested in having more of a shell/coat to make it look more neat and tidy dimitri what do you think?

This is basically what we are going to do. A mix between Wall-e and a tank. We should definitely add a shell to the bot so that it doesn’t look messy like the one in this picture.

we think we have it!

lauwright:

we have now come to a final decision to make a wall avoiding bot. we also have a few more ideas to add onto this. we will keep you updated

A motion sensor robot which looks like a tank and has a laser on it. I think that should be our final robot. Simple but genius

short listing of our robots

lauwright:

first we were considering making a secret knock detector, where the door will only unlock when the required knock has been made. we then thought that this was a bit too boring for our liking, we want to create something that is more fun


 

My Arduino Robot Project

In this blog I will be tracking the progress of my arduino robot building assignment.

 For this project I have been paired up with Lauren Wright