We will learn about Robotics in this project, along with their context in this world.
By the end of this project I will have a rolling robot that I created, that I can control through my phone
In TinkerCAD I wired up an Arduino to make a servo motor go back and fourth. I also learned where to get example code from off the internet.
/* Sweep
by BARRAGAN <http://barraganstudio.com>
This example code is in the public domain.
modified 8 Nov 2013
by Scott Fitzgerald
http://www.arduino.cc/en/Tutorial/Sweep
*/
#include <Servo.h>
Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most boards
int pos = 0; // variable to store the servo position
void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop() {
for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
}
This is where I took what we did on TinkerCAD in the previous assignment, and applied it to real life.
I added one more small factor for this. I hooked another servo into the circuit. Now I have two servos running off of the same pin.
I went a little more in depth about coding here. I added a servo to our code, and now I am able to make them run independently, off different pins.
#include <Servo.h> //this refers to a "library" that knows how to conrtol servos
Servo firstservo; //this defines a servo object and names it "firstservo"
Servo secondservo;
void setup() {
firstservo.attach(9); //attaches the "servo" object onto pin 9
secondservo.attach(10 );
}
void loop() {
firstservo.write(0); //make the servo object named "firstservo" rotate at full speed counter clockwise
secondservo.write(180); //in order to make the servo go clock wise at full speed use 180 as the number
delay(500);
/*firstservo.write(90);
secondservo.write(90);
delay(1000);
*/
}
Today I wired two battery packs with a total of four AA batteries, to power our Arduino and servo motors. This is important because I now don't have to be connected to the computer, and the robot can move can move around freely.
Here is a circuit diagram of where I currently am in the project. I have two servos controlled independently and powered by batteries, not the computer.
We each built our own prototype robot body out of cardboard. There was a lot of creativity and no one had the same robot. This one is fine, but I will definitely do some revising to the prototype. It currently isn't very stable and slips because there is little weight over the wheels.
For this assignment I coded our Arduinos to move our robots forward for one second, backward for one second, and then left and right for one second each. It was a good practice for coding and controlling our robot in more specific ways.
#include <Servo.h> //this refers to a "library" that knows how to conrtol servos
Servo firstservo; //this defines a servo object and names it "firstservo"
Servo secondservo;
void setup() {
firstservo.attach(9); //attaches the "servo" object onto pin 9
secondservo.attach(10 );
}
void loop() {
firstservo.write(180); //make the servo object named "firstservo" rotate at full speed counter clockwise
secondservo.write(0); //in order to make the servo go clock wise at full speed use 180 as the number
delay(1000);
firstservo.write(0);
secondservo.write (180);
delay(1000);
firstservo.write(0);
secondservo.write(0);
delay(1000);
firstservo.write(180);
secondservo.write(180);
delay(1000);
}
My robot was very tall and unbalanced, because of that it would drift and fall easily. I redesigned pretty much the entire thing. I made it slim, lower to the ground and balanced. The robot no longer drifted and it had much better traction and grip. To get to the end of the path, I would just see if I could get the right distance with the time. I would just see if I could get the right distance with the time. firstservo.write(180); scondservo.write(0); delay(3000); That would make my robot go forward for 3 seconds but if it needed more or less time I would change the delay. I would change the length of the delay in between commands. delay(3000); > delay(4000) to make one second longer
#include <Servo.h> //this refers to a "library" that knows how to conrtol servos
Servo rightservo; //this defines a servo object and names it "firstservo"
Servo leftservo;
void setup() {
rightservo.attach(9); //attaches the "servo" object onto pin 9
leftservo.attach(10);
}
void forward(){
rightservo.write(180);
leftservo.write(0);
}
void backward(){
rightservo.write(0);
leftservo.write (180);
}
void left(){
rightservo.write(0);
leftservo.write(0);
}
void right(){
rightservo.write(180);
leftservo.write(180);
}
void loop() {
forward();
delay(1000);
backward();
delay(1000);
left();
delay(1000);
right();
delay(1000);
}
After learning the wiring for them and how to use them, we used our new ultrasonic sensors to measure the distance between my hand and the sensor. We did this by watching the serial monitor.
This assignment had us combining two different codes, one of which was the code for our new ultrasonic sensor. It can detect when the robot is about to hit a wall, and using that we made it turn when it gets close to a wall.
#include <Servo.h> //this refers to a "library" that knows how to conrtol servos
Servo rightservo; //this defines a servo object and names it "firstservo"
Servo leftservo;
const int trigPin = 4;
const int echoPin = 5;
long duration;
int distance;
void setup() {
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
Serial.begin(9600);
leftservo.attach(9);
rightservo.attach(10);
}
void forward() {
rightservo.write(180);
leftservo.write(0);
}
void backward() {
rightservo.write(0);
leftservo.write (180);
}
void left() {
rightservo.write(0);
leftservo.write(0);
}
void right() {
rightservo.write(180);
leftservo.write(180);
}
void loop() {
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = duration * 0.034 / 2;
Serial.print("Distance: ");
Serial.println(distance);
forward();
if (distance < 6) {
right();
delay(500);
forward();
}
}
This was my first time using ink scape to design something. I made my custom Gearbox to it inside my robot. I then used the glow forge laser cutter we have in the engineering room to cut the design into wood and make it functional.
This assignment had us constructing our gear box and documenting our increase in speed, as well as exploring other ways to increase speed.
This is my robot partially through its building process. so far I have most of the pieces and just have to assemble them together. Here's a list of things that are requirements. However like I said, It is yet to be assembled so once it is It will meet everything.
Limited to no slipping -- currently meeting I've already made the wheels
Weight must be balanced -- currently can't evaluate
Must be stable -- currently can't evaluate
Avoids walls/objects when desired -- currently can't evaluate
Can be controlled by Bluetooth -- currently can't evaluate
Can fit into bin (width and length only) -- currently can't evaluate
Usability Requirements
Fully enclosed. -- currently can't evaluate
Has a removable door/ cover. -- currently can't evaluate
Has easy access to batteries. -- currently can't evaluate
Has easy access to red row/5V. -- currently can't evaluate
Has easy access to the reset button. -- currently can't evaluate
Has easy access to the "B" end of the A-B Cable -- currently can't evaluate
Aesthetic Requirements
Pieces and parts match up -- currently can't evaluate
Clean Glue Edges -- currently can't evaluate
Design is unique -- currently meeting
Complimentary Colors are Implemented -- currently can't evaluate
#define CUSTOM_SETTINGS
#define INCLUDE_LEDCONTROL_MODULE
#include <Dabble.h>
void setup() {
Serial.begin(9600); // make sure your Serial Monitor is also set at this baud rate.
Dabble.begin(9600); //Change this baudrate as per your bluetooth baudrate. Connect bluetooth on digital pin 2(RX) and 3(TX) for Uno/Nano and on Serial3 pins for Mega.
}
void loop() {
Dabble.processInput(); //this function is used to refresh data obtained from smartphone.Hence calling this function is mandatory in order to get data properly from your mobile.
Serial.print("Led:");
Serial.print(LedControl.getpinNumber());
Serial.print('\t');
Serial.print("State:"); //0 means OFF, 1 means ON
Serial.print(LedControl.getpinState());
Serial.print('\t');
Serial.print("Brightness:");
Serial.println(LedControl.readBrightness());
}
I redesigned the entire body of my robot. It is much more balanced and now it looks a lot better too. The design I settled on was something I just thought of out of the blue, but I like to think that it was inspired a little bit by the Tesla Cybertruck.
This is the testing of my new robot design. This was to make sure that the weight is balanced and everything worked correctly.
This assignment had us wiring and coding our Bluetooth modules. We coded a new way to command our robot. For this assignment we only hooked up a small LED light on the Arduino, but in the future we will be able to command our entire robot's movements. It is small, but you can see the tiny LED on the Arduino blink whenever I do something on my phone. This is through our new Bluetooth modules.
This is the final iteration of our robot fully built codded to avoid walls. Making this was very stressful since I had not made a big robot like this one before. It took more time than anticipated and I had to stay after school and work on it at home into the night.
This is me fully controlling my robot through Bluetooth on a phone. There was one obstacle that was a bug in the Dabble app on my phone. However, I quickly overcame this obstacle by using a different phone that didn't have the bug.
#define CUSTOM_SETTINGS
#define INCLUDE_GAMEPAD_MODULE
#include <Dabble.h>
#include <Servo.h>
Servo rightservo;
Servo leftservo;
void setup() {
// put your setup code here, to run once:
Serial.begin(250000);
Dabble.begin(9600);
leftservo.attach(9);
rightservo.attach(10);
}
void loop() {
Dabble.processInput();
Serial.print("KeyPressed: ");
if (GamePad.isUpPressed())
{
Serial.print("UP");
leftservo.write(180);
rightservo.write(180);
}
if (GamePad.isDownPressed())
{
Serial.print("DOWN");
leftservo.write(0);
rightservo.write(0);
}
if (GamePad.isLeftPressed())
{
Serial.print("Left");
leftservo.write(180);
rightservo.write(0);
}
if (GamePad.isRightPressed())
{
Serial.print("Right");
leftservo.write(0);
rightservo.write(180);
}
if (GamePad.isSquarePressed())
{
Serial.print("Square");
leftservo.write(90);
rightservo.write(90);
}
if (GamePad.isCirclePressed())
{
Serial.print("Circle");
}
if (GamePad.isCrossPressed())
{
Serial.print("Cross");
}
if (GamePad.isTrianglePressed())
{
Serial.print("Triangle");
}
if (GamePad.isStartPressed())
{
Serial.print("Start");
}
if (GamePad.isSelectPressed())
{
Serial.print("Select");
}
Serial.print('\t');
int a = GamePad.getAngle();
Serial.print("Angle: ");
Serial.print(a);
Serial.print('\t');
int b = GamePad.getRadius();
Serial.print("Radius: ");
Serial.print(b);
Serial.print('\t');
float c = GamePad.getXaxisData();
Serial.print("x_axis: ");
Serial.print(c);
Serial.print('\t');
float d = GamePad.getYaxisData();
Serial.print("y_axis: ");
Serial.println(d);
Serial.println();
}
This was our final grade for this robot project. When we walking in that morning, we were met by a massive course spanning across the entire engineering room. I drove my robot through the entire course including the optional dead end route. If you went all the way the the dead end and back with out touching walls you would get an extra 10 points. The video is sped up a bit so you won't have to sit through the entire thing.
The table saw is justTo be safe using the table saw, make sure you
-wear glasses -use the shoulder/saw stop -don't wear loose clothing
The table saw makes long straight cuts. Today we used the table saw to cut 2x4's so we can make our box.
The Planer is a tool you kind of feed the wood to and it will shave the wood down. To use this tool safely, make sure you
-wear ear protection and safely glasses. -adjust the thickness-vacuum afterwards -keep fingers away rom blade -unplug after
We used the planer to shave down the planks that we cut with the table saw. They were very rough and uneven, so we used the planer to fix this.
It can easily make cross cuts, and can cut at angles accurately. To use the Miter Saw safely
-don't go further than the safety line. -safety goggles. -watch where the cord is plugged into. -hold to wood firmly
What I used the Miter saw for today was cutting the separate pieces of my box. I took the wood that I first cut with the table saw, and then shaved with the planer, an cut it into shorter pieces. The pieces have been measured out so that they will combine to make a box.
I cuts small "biscuit shaped" holes to help align pieces. Make sure you.
-wear safety glasses. -make sure it is set for the right size biscuit. - line the machine up quickly
Today, I combined the two pieces of wood that will make the top and bottom of my box. I used the biscuit jointer to cut the holes and then used the wooden biscuits to put and hold them together.
It uses an input from a CAD file to cut carve and shave a shape out of wood. To use this tool safely...
-Run the dust collector -Vacuum after use -wear eye and ear protection -Secure your material with clamps or screws and design around them
Using the CNC Machine we made custom front plates with our name on them.
The orbital sander is a hand held device that vibrates a piece of sand paper in a circular motion. To use it safely, make such you,
-wear safety glasses -always keep your sander moving -be carful around your skin -don't operate without teacher permission
With the Orbital sander we are sanding down our boxes so that they are smooth and a lot cleaner. It will provide a much tidier final product, and improve craftsmen ship.
It works with one piece of wood that has notches in it. When it is in the locked position small wooden pieces fall into the notches, preventing the piece to move. to unlock there has to be a key that perfectly fits into the notches to lift the wood pieces from below so the dead bolt can move out of the way. It is very possible to make because it is so simple. It can meet constraints because it an be used for a sliding r hinged lid and it is strong enough.
This lock works through Arduino code. it will take inputs from a number pad and when the correct code is entered, the Arduino tells the servo to move and it unlocked the dead bolt. It is possible to do because we have all the components, and the only possible obstacle of fabricating the dead bolt and that wont be to hard. It meets constraints because it is very secure and keep be used in conjunction with other locks.
To properly stain wood, make sure you wear gloves, go over a drop cloth, and use a cotton cloth to apply stain, don't mix stains, leave staining materials out, or waste gloves.
here is my completed stained box. It looks a whole lot better with the stain and has personalized my box even more.
For my personal lock, I decided on my own variation of the key lock, seen above. It uses a key to lift up pins from groves in the slider so that it can move freely out of the locked position.
Here is a quick sketch that I drew up to show all the pieces I will need. As far as materials all I need is Onshape to design it on and the laser cutter to cut the wood.
Here are some of the Onshape sketches I drew for the class lock. These pieces in particular are the actuator, one of the dials, and the front panel.
Here is a video of the final functioning class lock. It is a combination lock, where you must rotate a circular dial to align several rotors. Once the rotors are aligned then the actuator can slide down which moves the bolt out of the locked position. I designed and modeled my lock on Onshape and laser cut the pieces.
Today I started designed all the files on Onshape. That way I should be able to laser cut a prototype into cardboard next class, assuming everything goes to plan.
Today I took all t files that I had made last class and combined them to file and cut them. I cut them on the laser cutter and started the glue some of the pieces. Because some are so small it is very tedious, but progress is being made.
Today I managed to put everything together and working. Since it is still cardboard it doesn't work the best with the small pieces, but when it I cut into wood it will work well. I had to recut, and shave down some pieces, but i managed to et it working pretty well.
Here is a video of the prototype lock and how I may able able to use it. After presenting to my peers I got some valuable feedback that I will institute into my final design, such as the use of small springs.
This is a picture of the final cad file that I cut with the laser cutter to make the final product. It has a small adjustment to the pin housing for the springs to work better, along with a longer key so it will reach the lock inside the box. Aside from some little tweaks like making the pins a little smaller and, having a small notch on the slider to prevent the lock from sliding out, the design really hasn't changed much from the original model.
This is my final lock box with the lock installed and functioning. There is a key hole in the back and slot in the front for the bolt to slider into. Something I forgot to mention in the video is that the final lock has springs in it so can work sideways, not relying on gravity. The box lid stays shut when it is locked and the whole product came out very well. I am very happy with this project and will keep and probably use this lock box when the project is over.
I made this poster to present at the school event Space is the New Place. It had to be an informational poster about a machine learning model. I chose Apple's face detection. I learned about machine learning through our machine learning unit with Georgia Tech Professor Pascal Hentenryck.
Machine learning is where a computer can learn and train itself to complete tasks without human input. They are used more often than you would think with all image recognition models using machine learning, along with other things such as autopilot in cars and planes.
My machine learning model is an item recognition model, so its goal is to recognize items within images. There are four items that my model can recognize the theme being computer accessories. They include a mouse, keyboard, charger, and headphones. My model uses a data set of pictures to train itself and then learn what the item in the image is.
The data collection process consisted of me holding each of my objects in front of a white background in view of a computer's camera. On the computer, we ran a code that took pictures of my objects as I rotated them around to get different viewpoints. The code took a total of 250 images per item. Grayscale 48x48 pixel images, so the machine learning model would better be able to handle them later on.
This to the left is my machine learning model. It goes through the process of item recognition. It imports the libraries, connects the code to google drive, and all the other things needed for item recognition. It converts all the images into a readable format being a one-dimensional tensor, builds the model, and trains it. There are also a couple of blocks of code at the bottom that do things like, pick a random picture and test its accuracy and pick out incorrectly predicted items.
These lines of code are the actual model itself. The first line basically converts the two-dimensional image files into a readable one-dimensional line of values. The second line of code creates the first layer of the model and makes it 1024 neurons large, plotting the data in a sigmoid function. The next line defines the inputs with softmax. It says the will be four outputs, one for each item. The next line just names the inputs and outputs, I keep them named input and output to keep it simple. The last line just displays the summary of the model.
Here are three correct predictions. My item recognition model had 100% accuracy. These were all correct because they had a clear and easily distinguishable images along with a consistent set of images to go with them. It was like this for all the images in my data set so the model can easily predict all the items without fail.
I didn't have any incorrect predictions. That is because trained my model with good data and I had 100% accuracy with the model. However, things to consider are that I used the same four objects in my testing. If I had used a different keyboard, or a different wired mouse, the accuracy may have changed. I also only use four objects, this isn't like some model that can recognize plants and identify which plant is in the picture. Those models have thousands of items and the pictures also look relatively similar. My model had four very differently shaped objects all neatly photographed with a blank background. Those are some of the reasons I have 100% accuracy, and no mislabeled images.