Last Day at EIT

Sitting here on prize giving day, I have finally completed everything on my robot. I turned up around 8 this morning and have been working on getting my LCD to light up and read my code. I had to take it apart and fiddle with the contrast on the back of the display in order to be able to see my code, but i got it in the end. My EIT experience has been great, it’s been super fun and definitely something new that I tried outside school and it has really paid off.

25th October

Today is a Thursday, and I’ve come into EIT during my lunch/study period of school to catch up on a few things, as tomorrow is out last day here at EIT, except prize giving next week. I had  mainly made some changes on my blog, adding some new code, adding a picture of my own robot for the background imagine, and some subtle colour changes all around.

Sonar Sensor Code (in progress)

#include <NewPing.h>

// ---------------------------------------------------------------------------
// Example NewPing library sketch that pings 3 sensors 20 times a second.
// ---------------------------------------------------------------------------

#include <NewPing.h>

#define SONAR_NUM 1     // Number of sensors.
#define MAX_DISTANCE 200 // Maximum distance (in cm) to ping.

NewPing sonar[SONAR_NUM] = {   // Sensor object array.
 NewPing(35, 34, MAX_DISTANCE), // Each sensor's trigger pin, echo pin, and max distance to ping. 
 NewPing(48, 49, MAX_DISTANCE), // 1st Trigger 2nd Echo.
 NewPing(47, 46, MAX_DISTANCE)
};

void setup() {
  Serial.begin(115200); // Open serial monitor at 115200 baud to see ping results.
}

void loop() { 
  for (uint8_t i = 0; i < SONAR_NUM; i++) { // Loop through each sensor and display results.
    delay(50); // Wait 50ms between pings (about 20 pings/sec). 29ms should be the shortest delay between pings.
    Serial.print(i);
    Serial.print("=");
    Serial.print(sonar[i].ping_cm());
    Serial.print("cm ");
  }
  Serial.println();
}

 

Coding for autonomous robot

//Baylee's Bot
//coding is 4cool kids?

int ea = 7;      
int eb = 2;       
int lf = 6;  
int lb = 5; 
int rf = 4;  
int rb = 3; 

 

void fwd()
{
digitalWrite(rb,LOW); 
digitalWrite(rf,HIGH); 
digitalWrite(lb,LOW); 
digitalWrite(lf,HIGH); 
analogWrite(ea,200);   
analogWrite(eb,200);    
}


void left()
{
digitalWrite(rb,LOW); 
digitalWrite(rf,HIGH); 
digitalWrite(lb,LOW); 
digitalWrite(lf,HIGH); 
analogWrite(ea,200);   
analogWrite(eb,0);    
}


void right()
{
digitalWrite(rb,LOW); 
digitalWrite(rf,HIGH); 
digitalWrite(lb,LOW); 
digitalWrite(lf,HIGH); 
analogWrite(ea,0);   
analogWrite(eb,200);    
}

void stop()
{
analogWrite(ea,0);  
analogWrite(eb,0);  
}


void setup() {
  pinMode (30, INPUT); //30 Left
  pinMode (31, INPUT); //31 Right
  pinMode (33, INPUT); //33 Middle 
  }

void loop() 
{
if(digitalRead(30)==HIGH && digitalRead(31)==LOW && digitalRead(33)==LOW)
{
  right ();

}


  if(digitalRead(30)==LOW && digitalRead(31)==LOW   && digitalRead(33)==HIGH)
{
  fwd ();
  } 

if(digitalRead(30)==LOW && digitalRead(31)==HIGH && digitalRead(33)==LOW)
{
  left ();
  } 


  
}

 

19th October

My robot can now autonomously move around the taped section on the floor of our room, and move through the taped maze on the table. This was achieved by trial and error on the line detection sensors. One of my pins did not work, which meant I had to move some of my wires around, throwing out a bit of coding, and I had to remember that pin 30 is left, 31 is right, and 33 was the middle which got a bit confusing. managed to get it going and I also have a video of it completing the task.

28th September

Today is the last day of term, and one of the last sessions down here at EIT. We were working on coding our robots so that they could detect the black tape line and follow it autonomously, but that didn’t really happen. We all ran into a few problems and could not understand why what went wrong actually went wrong. Overall the lesson was pretty good and we were all rather on to it. Just a shame we ran into problems in places we maybe shouldn’t have, but its all for learning.

21st September

This week Steve was away, so I was unable to ask some questions about my coding. But through the day I managed to update most of my blog so it had a lot more detail and didn’t look so bland and lifeless. I added some photos and videos where needed and went a little more in depth with some of the days. I was absent the week before due to our school mock exams, but i’m pretty sure i managed to catch up quite a bit to the stage that I am at right now.

Reflection | noiƚɔɘlʇɘЯ

Overall, I am happy with how my chassis turned out. I personally thought I would have put some things into the wrong places, or I would create holes for the screws in the wrong place, making everything a lot more difficult. But I was wrong. The holes I created were in the correct locations, and did not have to drill any extra holes, all my components fit on in the places I arranged them too be. So what I had created on fusion 360 turned out great. My design also has some major flaws, that I would most definitely change if I had the opportunity to do this again.

Starting with my line detection sensors. I ran out of time and had to roll with a design that isn’t practical, nor is it very sturdy/protective. I should’ve created a little outer casing/shell to put each of the sensors in, this would protect them in case of a crash or drop, and would also give the final design a better over look. How they are placed now looks and feels like a rushed job. If I had the opportunity  to design another chassis, I would definitely create a case for all of them to sit in.

My LCD screen placement. Its there, it lights up, no problems there, but the placement of it isn’t very practical. If i were to design another chassis, I would move the LCD screen to the rear of the chassis, to a location similar to a number on a car. Where it sits now, is placed underneath 12 different wires, all coming from the 3 Ultrasonic sensors. The wires stretch over top of the display, making the display harder to read and look at when up and running. Moving the screen completely to the rear eliminates this issue, and allows for better practicality out of the LCD.

By far the BIGGEST flaw of them all is the Arduino board placement. I did not think it through at all, and that mistake cost me a lot of time, and a few different issues. My Arduino board is placed at the rear of my design, fits nice and snug in the corner, and bolted down perfectly. But placing it at the rear was a giant mistake, as the wires we have to connect everything together are all the same length, and are definitely not long enough to reach all components. The wires going from the Ultrasonic sensors are stretched out to their max, extending for the Arduino board. This is a problem, if anything gets snagged on those wires, it has no give, no leeway, it’ll pull straight from the sensor or board, which then could damage either one of them. These wires stretch right over battery compartment, making it slightly more difficult to put in, and take out the battery. I would have to remove the wires from the sensor, place in the battery, and out the wires back on in order to replace the battery. Again, could be fixed if the Arduino board was moved. Another major problem I encountered was that the wires from my line detection sensors to my Arduino board, would not reach no matter what. I had to grab two of each wire, cut, and solder them together in order for them to be able to reach.  That’s 12 different soldering jobs, 12 extra wasted wires, and a lot of time wasted during the lesson.

The easiest way to fix almost every issue, would be to swap what I have circled in the picture. For the battery to be placed at the very rear, and for the Arduino board and the H-Bridge to be brought forward into its place. This would solve all issues to do with wiring, there would be no need for soldering, and the wiring of the Ultrasonic sensors wouldn’t be at such a stretch. Having the battery at the rear would also work out a lot better to do with weight distribution. Having the battery at the back would make the robot less likely to tip over when driving and coming to a stop.

I’m overall happy with my chassis and how it was printed, but if i were to create another chassis one day, it would definitively have improvements and changes for the better.

Wiring Diagram Video

This here is a video in 4x speed. Originally being 12 minutes long, is now around 3 minutes. In the video you can see me labeling all of the components and using Photoshop to my advantage.I first used the patch tool to remove the writing on the battery, where i could then just use text boxes to complete all of the other tasks. I used ShareX to capture my video, it took me a while to get it going and how to use it, but in the end I got it working. I have little experience in Photoshop, have only used it for muck around purposes before, this is why it took me a while to get this done. A bit of a hiccup at the end trying to upload this video, as the video was not saved as an MP4, and i had to convert it over in the end. But I got it done 🙂