Third Year PDP

Before the separation of BA and BSc students, I felt Constellation was a way to open one’s mind to see the wider world and the people living in it. The first Topic I explored was ‘Creativity and Cognitive Development’. The main point that I took from this class was that each individual will never understand the opinion of another individual. This was proven using Toy design, instead of letting adults design them, they allowed children directly. The result was much different to what the adults would have produced, providing evidence for the previous statement.

The following Topic was ‘The Body in Society’. The main things explored was identity and gender. I had never thought of gender such an in-depth way before this Topic. The main argument was that we only see masculine/feminine aesthetic and products as masculine/feminine, due to society conditioning us to believe so. And then later discussed whether these gender boundaries were that have been implemented into society are restricting peoples creativity, happiness. One main debate during this class was whether it is deemed appropriate to allow your child to dress and/or play with toys designed for the opposite sex if they wish to do so. In an attempt to avoid gender restriction some parents decide to bring their children up ‘Gender-neutral’. This is when the children are only allowed to play with toys deemed appropriate for both males and females. Although some believe that not allowing them to do something is restricting in itself.

When we reached second year BA and BSc were separated. Being a BSc student, I finished the first-year constellation and started Mechanical Engineering and Electronics. Although I found Electronics rewarding, I found it very challenging (by far the most challenging part of my degree). In hindsight, I wish I had returned home after every session and revised all work taught in that class. I feel even my skills are not as good as they could be, and would definitely advise future students who lack a background in electronics to read through the lectures beforehand,  pay full attention during, and after each lecture re-do what you have been taught to ensure you fully understand.

Mechanical Engineering was one of the favorite parts of my Product Design Experience, I wish we were taught more of this in the first year. It seemed that that first year for us was designed completely BA based, and included no aspect of BSc, this applies to subject, constellation, and field. Many people in my year struggled to decide whether they were more appropriate for the BA or BSc course, as there was no way of predicting that Bsc entailed. I believe that there should be an incorporation of constellation, electronics, and engineering in the first year to provide a wider understanding of each course. But also, regardless of being BA or BSc, having knowledge of electronics and engineering is essential in regards to creating good design and producing high quality working prototypes. I also think that maybe an exam could be beneficial, this could potentially encourage students to revise the information taught in these classes which would be highly beneficial to us as future designers.

I started off my third-year Technical Report thinking I would be writing about ‘Information, Communication, Technologies’. Over the summer holidays, I realised this topic was much too broad, therefore, I had to narrow down my Topic of choice. It took longer than I would have liked to finalise my decision but I decided to write about ‘Telemedicine’. I thoroughly enjoyed writing about this, although still found the topic too broad, so wanted to discuss Telemedicine in relation to something more specific. I considered on writing about Telmedicine in relation to people who live in rural/secluded areas but instead decided to write my technical report on ‘Telemedicine in relation to seniors living in the UK’.

I discovered that Telemedicine is already of great benefit to elderly people in relation to Telemonitoring so that elderly people can live independently in a safe, non-intrusive way. And it is also being used to help elderly residents emotionally living in nursing homes and suffer from mental diseases such as dementia. Although there was a gap in the market in relation to elderly people and real-time telemedicine. This gap was mainly due to the digital divide in society and the expense of smart devices being too high for many elderly people living in the UK. For the Stage two (the design stage) of my Technical report, I focussed on this gap in the market and applied the design process to produce an appropriate design solution. Due to time constraints, the finalised product idea is not as finished as I would have hoped, although I believe the concept has great potential to help the elderly people in the UK gain easier access to healthcare at a small expense. If I did have more time, I would develop high facsimile models to test the product.

Overall, Constellation/Mechanical Engineering as a whole was an essential part of my journey in becoming a more rounded designer over the past three years. I have gained more practical design skills from subject and field, but constellation has made me aware of the importance of questioning your design thinking. I now always ask myself, ‘why’? Constellation highlighted the importance of understanding that the people I am designing for may not want a product to be the way that I may have assumed that they would have wanted (never make assumptions). Also, I have been more aware that I should consider the social stigma that surrounds certain design aesthetics, for example, do you design a product based around gender constraints, gender neutrality, or attempt to ignore the social boundaries and begin to implement the idea that people can like what they like, regardless of social stigmas applied to certain aesthetics or function.

Advertisements

Line Tracking Robot: PDP

We began the project by listing the components we deemed essential. One of the main components being two IR sensors which function using Digital Pins, allowing us to observe when they were ‘HIGH’ or ‘LOW’ using the digital read function on the serial monitor. For us to test the IR sensors we had to write our first code:

 int leftSensor = 7;
int rightSensor = 8;

void setup() {
Serial.begin(9600);
pinMode(leftSensor, INPUT);
pinMode(rightSensor, INPUT);
}

void loop() {
int sensorValL = digitalRead(leftSensor);
int sensorValR = digitalRead(rightSensor);
Serial.println(sensorValL);
Serial.println(sensorValR);
delay(1);
}

IR Sensors

We discovered from this test that the IR sensors must be 20mm from the floor to work at their best.

We chose to include a free moving wheel at the front of the racer, this uses less energy than a servo operated wheel and is light weight. L298N motor controller was also used, as it is easy to control the speed (which is controlled using Pulse Width Modulation pins on the Arduino) and direction (each motor is connected to an additional two digital pins that control the direction through simple LOW / HIGH code combinations). A 9v battery will be used to power the Arduino through the motor controller. The motor controller is necessary because one motor will not consume much current, but can’t move a large mass whereas as two motors can move a large mass but will consume a large current. 

1

Before we could test how effective these components were, we needed a working code. I was proud that we wrote our code ourselves, with research we figured out the issues and we both learnt from the experience.

 

//motor controls
//left motor
int enableA = 10;
int in1 = 9;
int in2 = 8;

//right motor
int enableB = 5;
int in3 = 7;
int in4 = 6;

//sensor pins

int leftSensor = 4;
int rightSensor = 3;

void setup() {
Serial.begin(9600);
pinMode(enableA, OUTPUT);
pinMode(enableB, OUTPUT);
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(in3, OUTPUT);
pinMode(leftSensor, INPUT);
pinMode(rightSensor, INPUT);

}

void loop() {
int leftSensorValue = digitalRead(leftSensor);
int rightSensorValue = digitalRead(rightSensor);
boolean leftSenDetect = digitalRead(leftSensor);
boolean rightSenDetect = digitalRead(rightSensor);

//testing sensor values and distance required from ground

Serial.print(“left sensor = “);
Serial.println(leftSensorValue);

Serial.print(“right sensor = “);
Serial.println(rightSensorValue);

//false is if surface is DARK!
//true is if surface is LIGHT!

if (leftSenDetect == true && rightSenDetect == true) {
//left motor direction
digitalWrite(in1, LOW);
digitalWrite(in2, HIGH);

//left motor speed
analogWrite(enableA,200);

//right motor direction
digitalWrite(in3, LOW);
digitalWrite(in4, HIGH);

//right motor speed
analogWrite(enableB, 200);
}

else if (leftSenDetect == false && rightSenDetect == true) {

// keep left motor going
digitalWrite(in1, LOW);
digitalWrite(in2, HIGH);

//left motor speed

analogWrite(enableA, 75);

// stop right motor
digitalWrite(in3, LOW);
digitalWrite(in4, LOW

delay(550);

analogWrite(enableB, 100);

}

else if (leftSenDetect == true && rightSenDetect == false) {
// stop left motor
digitalWrite(in1, LOW);
digitalWrite(in2, LOW);

analogWrite(enableA, 100);

// keep right motor going
digitalWrite(in3, LOW);
digitalWrite(in4, LOW);

delay(550);

analogWrite(enableB, 75);

}

}

 We made our first model out of 6mm MDF board, it was simply just a rectangle on wheels but it allowed us to test what we needed it and then learn from that and then develop it. We attached the components to the 140mm by 70mm piece of MDF using BlueTrack, as it attached them temporarily making it quick to disassemble and reassemble which was creating for testing. We tested this model on a simple track, we realized after the first test that changes to our code were necessary, such as adding a delay to the ‘else if’ statements, giving the Racer more time to correct itself. After this we created a more complex track, after changing the code again so that the delay was set at 500 milliseconds and altering the positioning of the IR sensors it followed the line on this track.

We also noticed that the wheels that were laser cut from 6mm MDF lacked traction, causing wheel spin. We solved this by attaching elastic bands. We experimented with two different wheel sizes after this, one set had a 40mm diameter and the other 60mm. We calculated the speed of these wheels using Speed = Distance/Time. The 40mm wheels completed the track 2-meter straight track in 0.13 meters per second, and the 60mm did the track in0.22 meters per second. This result proved that the larger the feel the faster the Racer since it covers more ground per rotation. We then tested acceleration using the formula acceleration=velocity/time taken. The 40mm Wheels had an acceleration of 0.0244 m/s2, whereas the 60mm Wheels had an acceleration of 0.0086 m/s2. Finally, we calculated the force required for each size (Force = Mass X Acceleration). The mass of the Racer was 250g giving the 40mm wheels a force of 0.0061N, and the 60mm wheels a force of 0.00215 N. The larger wheel increased acceleration meaning less force is needed, increasing the efficiency of the Racer. Therefore we chose to use larger wheels in the final model.

2

For our second model, we used 3mm Plywood, because of it being a less dense material and 3mm thinner it would make the Racer lighter. We also added a switch, and used 80mm diameter wheels, added supports on the outer side of the wheels to keep them straight, and an extra level so that there would be more space for the components and an underside to hide and organize the mess of the wires. This extra layer would be supported by a Warren Girder Bridge arrangement, as it is effective and light weight.

Due to changes in the Racer, the code needed altering. Delays were reduced due to larger wheels, one wheel turns in the opposite direction to achieve sharper turns, and we set the motors to 220 on the PWM pins when neither of the sensors are detecting the black lines which really helped in producing a noticeable improvement in speed.

//left motor controls
int enableA = 10;
int in1 = 9;
int in2 = 8;

//right motor
int enableB = 5;
int in3 = 7;
int in4 = 6;

//sensor pins

int leftSensor = 4;
int rightSensor = 3;

void setup() {
Serial.begin(9600);
pinMode(enableA, OUTPUT);
pinMode(enableB, OUTPUT);
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(in3, OUTPUT);
pinMode(leftSensor, INPUT);
pinMode(rightSensor, INPUT);

}
void loop() {
int leftSensorValue = digitalRead(leftSensor);
int rightSensorValue = digitalRead(rightSensor);
boolean leftSenDetect = digitalRead(leftSensor);
boolean rightSenDetect = digitalRead(rightSensor);

//testing sensor values

Serial.print(“left sensor”);
Serial.println(leftSensorValue);

Serial.print(“right sensor”);
Serial.println(rightSensorValue);

// false is dark surface
//true is light surface

if (leftSenDetect == true && rightSenDetect == true) {
//left motor direction
digitalWrite(in1, LOW);
digitalWrite(in2, HIGH);

analogWrite(enableA, 220);

// right motor

digitalWrite(in3, LOW);
digitalWrite(in4, HIGH);

analogWrite(enableB, 220);
}

else if (leftSenDetect == false && rightSenDetect == true) {

// left motor opposite way
digitalWrite(in3, HIGH);
digitalWrite(in4, LOW);

analogWrite(enableA, 50);
//right motor speed
digitalWrite(in1, LOW);
digitalWrite(in2, HIGH);

analogWrite(enableB, 70);

delay(350);

}
else if (leftSenDetect == true && rightSenDetect == false) {
// left motor speed
digitalWrite(in3, LOW);
digitalWrite(in4, HIGH);

analogWrite(enableA, 70);

// right motor opposite way

digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);

analogWrite(enableB, 50);

delay(350);

}
}

The speed of this Racer was 0.11 meters per second faster than the previous racer. The acceleration increased by 0.0464 m/s2. And with a weight of 350 grams an additional 0.0171 N of force was required.

20170324_125218

We chose to return to MDF for the final model because the Plywood warped. But we chose to include slots on the top layer for cable management and a slot for the switch to sit into.

We designed a place for the Egg to sit, we decided to take the name ‘Dream Ender’ and create ‘Dream Ender II’. We went with the theme of this name creating a Devil seat for the egg, and engraved the seat and wheels with this name.

We purchased an Arduino Nano, since they would take up less space and be lighter in comparison to a regular sized Arduino. But it drained all power for the motors, we are unsure if this was due to them being so cheap, or if the soldering caused it damage. But because of this we had to return to the original Arduino, and we were unable to shed a potentially significant amount of weight.

This time it weighed around 325 grams, we expected this due to the extra weight of the egg support and the use of MDF. Surprisingly, the speed was reduced slightly by 0.02 meters per second. We believe this could be due to one of the wheels not being completely straight, to help fix this we added pieces of plywood for support and stability. The acceleration decrease by 0.006-meter m/s2. And due to the lighter weight, it took 0.003325 N less force to move the Racer and the cost of a slightly reduced speed, therefore there was no real increase in efficiency.

20170330_175307 1

20170330_175230

20170330_175237

We tested this Racer on a simple track and completed it flawlessly. Therefore, we created the most complex track we had yet, with very sharp turns. Unfortunately, the racer did not always make these turns so we reduced the speed and delays out of fear that it may stray from the track on the day of the race. We also added code that would make the Racer stop when both sensors were above the black tape.

Line Tracking Robot Racer- The final model

We reviewed the second model together ready to plan for our final Racer!

The first thing we noticed was that using Plywood for the body was not as successful as we had hoped, this material is prone to warping, and when this happens it will cut inaccurately in the laser cutter and disfigure the final shape, so we decided to return to MDF.

Secondly, we needed to fully arrange the wires this time so that they are neatly organised making it more aesthetically pleasing and understandable. We wish to achieve this by cutting slots into the top MDF layer, for the wires to be pulled through. We also chose to solder down some wires for more reliable contact.

We also cut a section out of the top MDF layer for the Switch to slot into, this made huge improvement to the aesthetic and ease of use for the switch.

And finally we designed a place for the Egg to sit, we decided to take the name from the elastic band racer ‘Dream Ender’ and create ‘Dream Ender II’. We went with the theme of this name creating a Devil seat for the egg, and engraved the seat and wheels with this name.

We purchased a few Arduino Nanos, since they would take up less space and be lighter in comparison to a regular sized Arduino, but for some reason they drained all power for the motors, we are unsure if this was due to them being so cheap, or if the soldering caused them damage. Because of this we had to return back to the orginal Arduino therefore were unable to shed a potentially significant amount of weight. This time it weighed around 325 grams, we expected this due to the extra weight of the egg support and the use of MDF.

20170330_165739

Speed:

We returned back to the 2 meter track for the final time, sett the PWM (pulse width modulation) pins to 255 to calculate the speed.

Speed = Distance / Time

Speed = 2 / 6.31

Speed = 0.31 meters per second

Surprisingly, the speed was reduced slightly by 0.02 meters per second. We believe this could be due to one of the wheels not being completely straight, to help fix this we added pieces of plywood for support and stability.

Acceleration=

Acceleration = 0.049 meter / square second {m/s2}

80mm Wheels Acceleration = 0.055 meter / square second {m/s2}

A decrease in 0.006 meter / square second {m/s2}

Force 

Looking at the force required to move the object.

Force = Mass X Acceleration

Force = 0.325 x 0.049

Force = 0.015925 N

Due to the lighter weight, it took 0.003325 N less force to move the Racer and the cost of a slightly reduced speed, therefore there was no real increase in efficiency.

We tested the Racer on our track after testing it on the 2 meters. It finished it flawlessly, so we chose to create a more complex track with sharp corners, as we were unsure on what we would be facing on the day. Unfortunately, the racer did not always make these sharp corners , so we reduced the speed and delays to be safe. We also coded the racer so that it was stop completely when both sensors faced the black tape (therefore will stop at the finish line).

If we were to do this again we would used more sensors, designed and made much more stable wheels, and a more pleasing aesthetic.

Line Tracking Robot Racer: The 2nd Model and testing

On this model, the Racer traveled in a straight line due to the wheel supports making it much easier to test. We used the 2 meter track previously used and timed it to gather the same data recorded from the last model (speed, acceleration and force).

Speed: We used the time it took for the Racer to finish the 2 meter track to calculate the speed, (the racer finished the track in 6 seconds).

Speed = Distance / Time

Speed = 2 / 6

Speed = 0.33 meters per second

An increased speed of  0.11 meters per second.

Acceleration: 

After calculating the change in velocity we worked out the acceleration. Acceleration had also improved.

 

80mm Wheels Acceleration = 0.055 meter / square second {m/s2}

An increase in acceleration by 0.0464 meter / square second {m/s2}

Force 

I order to calculate the force we reweighed the racer (including the egg this, as that will be included on the day of the race). The racer weight 350 grams, which is another 100 grams. Although we decreased the thickness of material and chose a less dense material, the amount of material to create the extra layer and structural support was added, so we expected an increase in weight overall.

20170324_122905

Force = mass X acceleration

Force = 0.35(kg) X  0.055 (m/s2)

Force = 0.01925 N

An additional 0.0171 N of force was required.

 

Changes in the code were required for the Racer to move most efficiently due to the change in the Racers body.

  • Delays could be reduced due to the wheels being larger.
  • One wheel now turns in the opposite direction in order to achieve sharper turns.
  •  We set the motors to 220 on the PWM (pulse width modulation) pins when neither of the sensors are detecting the black lines which really helped in producing a noticeable improvement in speed.
Fastest Code So Far

Here we have the best code yet, I feel we’re nearing the sweet spot in terms of speed and reliability.

//left motor controls
int enableA = 10;
int in1 = 9;
int in2 = 8;

//right motor
int enableB = 5;
int in3 = 7;
int in4 = 6;

//sensor pins

int leftSensor = 4;
int rightSensor = 3;

void setup() {
Serial.begin(9600);
pinMode(enableA, OUTPUT);
pinMode(enableB, OUTPUT);
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(in3, OUTPUT);
pinMode(leftSensor, INPUT);
pinMode(rightSensor, INPUT);

}
void loop() {
int leftSensorValue = digitalRead(leftSensor);
int rightSensorValue = digitalRead(rightSensor);
boolean leftSenDetect = digitalRead(leftSensor);
boolean rightSenDetect = digitalRead(rightSensor);

//testing sensor values

Serial.print(“left sensor”);
Serial.println(leftSensorValue);

Serial.print(“right sensor”);
Serial.println(rightSensorValue);

// false is dark surface
//true is light surface

if (leftSenDetect == true && rightSenDetect == true) {
//left motor direction
digitalWrite(in1, LOW);
digitalWrite(in2, HIGH);

analogWrite(enableA, 220);

// right motor

digitalWrite(in3, LOW);
digitalWrite(in4, HIGH);

analogWrite(enableB, 220);
}

else if (leftSenDetect == false && rightSenDetect == true) {

// left motor opposite way
digitalWrite(in3, HIGH);
digitalWrite(in4, LOW);

analogWrite(enableA, 50);
//right motor speed
digitalWrite(in1, LOW);
digitalWrite(in2, HIGH);

analogWrite(enableB, 70);

delay(350);

}
else if (leftSenDetect == true && rightSenDetect == false) {
// left motor speed
digitalWrite(in3, LOW);
digitalWrite(in4, HIGH);

analogWrite(enableA, 70);

// right motor opposite way

digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);

analogWrite(enableB, 50);

delay(350);

}
}

Line Tracking Robot Racer: What we learnt from our first model

Having tested a Sketch model with and without the egg (as the added mass of the egg would obviously effect the force), we were provided with a new and useful set of information that we could apply to our next model and iteration of code in order to make it better.

The first and most obvious thing to us that needed to be changed from the first model was the material, and the thickness of the material used in the main body. Instead of 6mm MDF we have chosen to test 6mm Ply, this is because we want to make the Racer lighter increasing its speed, and MDF is a very dense material.

Another issue we found with our Racer was that was that it was difficult to turn the Racer on and off as we would have to remove wires in order to do so. So we would like to add an on/off switch to provide easier operation.

As discussed in previous blog posts we discovered that the larger the wheel, the faster the car, therefore we have decided to increase the diameter by another 20mm in diameter (80mm), we have purchased gears that we will use if the increased wheel size does not speed up the car as fast as we would like. The only issue we had with the 60mm wheels on the last model was that they were not travelling straight. When testing the Racer on a straight 2m track with a code telling the Racer to dive forward, the Racer began to drive to the left, so next time we will add supports on the outer side of the wheel,

Our previous Racer last wasn’t the most aesthetically pleasing thing, mainly due to the mess of wires, therefore in this iteration we want to try and increase cable management. One way in which we wish to try and achieve this is by adding another layer onto the Racer for components to be secured to, having this will allow us to hide the wires on the lower layer. On the lower layer we plan to secure the two motors at the near end, the top layer will sit on top of this, therefore the motors will also at as a a support. Although, support was still needed for the front end of the Racer, we discussed possible solutions and decided that the Warren Girder Bridge arrangement seemed the best solution as it is supportive and a lightweight efficient solution, so we shall trial this out using 3mm Plywood for the panels.

warren1

 

Line Tracking Robot Racer: Wheel Testing (Speed, Acceleration and Force)

The next component on our list was the wheels. We had previously discussed the possibility of including 3D printed tracks as a replacement, but decided against this as wheels would be easier and faster to test and change or alter if necessary, and also gives us the option to experiment with gears. We experimented with two different wheel sizes by laser gutting them quickly out of plywood and calculating the speed for each journey using the formula speed =distance/time. 

We wrote new code to test the wheels, making sure that the Racer only moved forwards. We marked a two meter track and then timed how long (time) it took for the Racer to finish the two meter (distance) track.
40mm Wheels completed the 2 meters in 15 seconds.

60mm Wheels completed the 2 meters in 9 seconds.

Calculations for working out the speed for each set of wheels:

Speed=Distance/Time

40mm :

speed = 2 / 15

0.13 meters per second

60mm :

speed = 2 / 9

0.22 meters per second

From this we learnt that the larger the diameter of the wheel the faster the rotation, this confirms what we were taught in one our mechanical engineering lecture that the more ground per rotation increased speed.

We chose to carry on using elastic around both wheels for added traction, the same way as we did on the previous sketch model. Due to the increased size in wheels increasing the speed of the Racer, it has been necessary to reduce the delay function in the coding.

After testing the speed of the wheels we chose to calculate acceleration, which is change in velocity/time taken

60mm Wheels =0.0086 meter / square second {m/s2}

40mm Wheels = 0.0244 meter / square second {m.s2}

Finally we wanted to work out the force depending of the size of the wheels, in order to work this out we needed to weight the Racer, the weight was 250g.

20170317_102020

Force = Mass X Acceleration

60mm Wheels :

Force = 0.25(kg) X 0.0086(m/s2)

Force = 0.00215 N

40mm Wheels:

Force = 0.25 X 0.0244

Force = 0.0061 N

Due to a larger acceleration

The larger wheel increases acceleration meaning less force is needed, increasing the efficiency of the Racer.  Therefore, we shall use larger wheels in the final model.

Line Tracking Robot Racer: Further Component Analysis

We returned back to the components list after familiarising ourselves with the infrared sensors. We wanted to think outside the box when it come to the components we included in our design so that it was unique in comparison to the many other Robot Racers online. One unique idea for components we had was using a free moving wheel at the front of the racer, this not only add a quirky look and function but it would also use less energy than a servo operated wheel and is also lighter in weight. We will decided whether it will be included on the final design after testing it on a prototype model. But before we can test this free moving wheel and other components we need a working code.

There are a list of component that were given to us that need to be included in our design including two dc motors and a servo motor. We were also given a choice of motor controllers, we chose to include the L298N. From previous research, this motor controller seems perfect for what we are trying to achieve as it is simplistic and easy to control the speed (which is controlled using Pulse Width Modulation pins on the Arduino) and direction (each motor is connected to an additional two digital pins that control the direction through simple LOW /  HIGH code combinations). A 9v battery will be used to power the Arduino through the motor controller. The motor controller is necessary because one  motor will not consume much current, but can’t move a large mass whereas as two motors can move a large mass but will consume a large current. 

motor controllertesting motors

We realised from previous testing with the IR sensors that for them to work at there best they needed to be approximately 20mm from the floors surface due to shadowing and reflection from the light source on the sensor which would provide an inaccurate reading.

As mentioned in the previous blog post the idea is that we could attach the digital sensors to each side of the car and they will then hopefully they will be able to sense the light difference between the flooring and the black tape, and will always be able to correct itself so that the black tape is kept in between the two sensors. Therefore the Racer will be able to follow the line. Depending on which sensor detects the tape, either the left or right motor will switch off so that the robot will correct itself.

1

The Code:

//motor controls
//left motor
int enableA = 10;
int in1 = 9;
int in2 = 8;

//right motor
int enableB = 5;
int in3 = 7;
int in4 = 6;

//sensor pins

int leftSensor = 4;
int rightSensor = 3;

void setup() {
Serial.begin(9600);
pinMode(enableA, OUTPUT);
pinMode(enableB, OUTPUT);
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(in3, OUTPUT);
pinMode(leftSensor, INPUT);
pinMode(rightSensor, INPUT);

}

void loop() {
int leftSensorValue = digitalRead(leftSensor);
int rightSensorValue = digitalRead(rightSensor);
boolean leftSenDetect = digitalRead(leftSensor);
boolean rightSenDetect = digitalRead(rightSensor);

//testing sensor values and distance required from ground

Serial.print(“left sensor = “);
Serial.println(leftSensorValue);

Serial.print(“right sensor = “);
Serial.println(rightSensorValue);

//false is if surface is DARK!
//true is if surface is LIGHT!

if (leftSenDetect == true && rightSenDetect == true) {
//left motor direction
digitalWrite(in1, LOW);
digitalWrite(in2, HIGH);

//left motor speed
analogWrite(enableA,200);

//right motor direction
digitalWrite(in3, LOW);
digitalWrite(in4, HIGH);

//right motor speed
analogWrite(enableB, 200);
}

else if (leftSenDetect == false && rightSenDetect == true) {

// slow down left motor speed
digitalWrite(in1, LOW);
digitalWrite(in2, LOW);

//left motor speed

analogWrite(enableA, 75);

//maintain right motor speed
digitalWrite(in3, LOW);
digitalWrite(in4, HIGH);

delay(550);

analogWrite(enableB, 100);

}

else if (leftSenDetect == true && rightSenDetect == false) {
//maintain left motor speed
digitalWrite(in1, LOW);
digitalWrite(in2, HIGH);

analogWrite(enableA, 100);

//slow down right motor
digitalWrite(in3, LOW);
digitalWrite(in4, LOW);

delay(550);

analogWrite(enableB, 75);

}

}

2

 

This was basic prototype to test the functions of the model, although it lacked aesthetic quality to allowed us to test what we needed to. the base consisted of a 140mm X  70mm MDF board, and the components were attached to this with a range if blue tack, glue and double sided tape. These temporary attachment methods were useful for quick disassembly, in order to find the best position for the components.

Testing this prototype also made us aware of changes that needed to be made in the code, for example, we added a delay to the “if else” statements, giving the Racer more time to correct itself when turning sharp corners, due to this testing the delay has been set at 550 milliseconds, but this is open to change in further testing.

The first track we tested the model on was simplistic with minimal sharp corners, but since we are unsure on what the track will be like on the day, we created a more complex track once the car could follow the line on the first track.

tac1

There were a lot more issues with the second track (displayed below). The corners were so sharp that the Racer didn’t have enough delay time to sense the black line therefore it would leave the track. We altered the code and positioning of the sensors and after numerous attempts managed to get the Racer to follow it.

trac2

The laser cut wheels that were cut from the 6mm MDF lacked grip, this caused wheel spin when having one motor on and the other off. We solved this by using elastic bands to increase the traction greatly on the wheels.