In this project, we are going to learn about robotics, and their context in the world.
At the end of this project, I will have a rolling robot that I can control wot my phone.
Today we practiced wiring up a servo and Arduino using TinkerCAD, and we also learned where to find our own starter code.
I implemented the code I used to make the virtual servo in TinkerCAD move into a physical servo that moves in real life.
I used the same code I used before to move 2 different servos at the same time.
This time, I altered my code to allow the two servos to move independent of one another.
My servos do not need to be plugged into the computer anymore to work. I have connected two battery packs to the Arduino.
This is the structure I will use for my prototype. It currently has two wheels and is very compact.
I coded my robot to go forward, backward, left, and right. It uses tank steering.
/* 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;
Servo myservo1; // create servo object to control a servo
// twelve servo objects can be created on most boards
int pos = 180;
int pos1 = 0;// variable to store the servo position
void setup() {
myservo.attach(9);
myservo1.attach(8);// attaches the servo on pin 9 to the servo object
}
void loop() {
myservo.write(180);
myservo1.write(0);
delay(1000);
myservo.write(0);
myservo1.write(180);
delay(1000);
myservo.write(0);
myservo1.write(0);
delay(1000);
myservo.write(180);
myservo1.write(180);
delay(1000);
// waits 15ms for the servo to reach the position
}
/* 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
*/
/*10 secs of going forward*/
#include <Servo.h>
Servo rightWheel;
Servo leftWheel;
int rForward = 180;
int lForward = 0;
int rBackward = 0;
int lBackward = 180;
void setup() {
rightWheel.attach(9);
leftWheel.attach(8);
}
_________________________________
//FUNCTION DEFINITIONS
void forward(){
rightWheel.write(rForward);
leftWheel.write(lForward);
}
void backward(){
rightWheel.write(rBackward);
leftWheel.write(lBackward);
}
void left(){
rightWheel.write(rForward);
leftWheel.write(lBackward);
}
void right(){
rightWheel.write(rBackward);
leftWheel.write(lForward);
}
_________________________________
void loop() {
delay(2000);//starting delay
//wheel test
/*rightWheel.write(rForward);
leftWheel.write(lForward);
delay(10000);*/
//straight 1
rightWheel.write(rForward);
leftWheel.write(lForward);
delay(6000);
//turn 1
rightWheel.write(rForward);
leftWheel.write(lBackward);
delay(245);
//straight 2
rightWheel.write(rForward);
leftWheel.write(lForward);
delay(6200);
//turn 2
rightWheel.write(rBackward);
leftWheel.write(lForward);
delay(340);
//straight 3
rightWheel.write(rForward);
leftWheel.write(lForward);
delay(5570);
//turn 3
rightWheel.write(rForward);
leftWheel.write(lBackward);
delay(800);
//straight 4
rightWheel.write(rForward);
leftWheel.write(lForward);
delay(3700);
//turn 4
rightWheel.write(rForward);
leftWheel.write(lBackward);
delay(700);
rightWheel.write(rForward);
leftWheel.write(lForward);
}
I coded my robot to follow a winding path. I had to reiterate my code a bunch of times. I knew I had to make a change to my robot when my wheels were not getting enough traction on the ground. My robot would kind of slide across the ground rather than roll when I started it up and that would make my robot not turn effectively or go fast. I changed what the wheels were made of. I first put tape around the wheels and that sort of helped, but then I put rubber bands on them and that really made a difference. I can tell that the rubber bands helped because I saw that the robot was more agile; it was turning faster and more precisely and it wouldn’t drift as much.
Robot went too far on first straight, lowered the delay time
Robot turned too much on first turn, increased delay time
Robot drifted to the left, made it turn right more.
/* 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
*/
/*10 secs of going forward*/
#include <Servo.h>
Servo rightWheel;
Servo leftWheel;
int rForward = 180;
int lForward = 0;
int rBackward = 0;
int lBackward = 180;
void setup() {
rightWheel.attach(9);
leftWheel.attach(8);
}
_________________________________
//FUNCTION DEFINITIONS
void forward(){
rightWheel.write(rForward);
leftWheel.write(lForward);
}
void backward(){
rightWheel.write(rBackward);
leftWheel.write(lBackward);
}
void left(){
rightWheel.write(rForward);
leftWheel.write(lBackward);
}
void right(){
rightWheel.write(rBackward);
leftWheel.write(lForward);
}
_________________________________
void loop() {
delay(2000);//starting delay
//wheel test
/*rightWheel.write(rForward);
leftWheel.write(lForward);
delay(10000);*/
//straight 1
rightWheel.write(rForward);
leftWheel.write(lForward);
delay(6000);
//turn 1
rightWheel.write(rForward);
leftWheel.write(lBackward);
delay(245);
//straight 2
rightWheel.write(rForward);
leftWheel.write(lForward);
delay(6200);
//turn 2
rightWheel.write(rBackward);
leftWheel.write(lForward);
delay(340);
//straight 3
rightWheel.write(rForward);
leftWheel.write(lForward);
delay(5570);
//turn 3
rightWheel.write(rForward);
leftWheel.write(lBackward);
delay(800);
//straight 4
rightWheel.write(rForward);
leftWheel.write(lForward);
delay(3700);
//turn 4
rightWheel.write(rForward);
leftWheel.write(lBackward);
delay(700);
rightWheel.write(rForward);
leftWheel.write(lForward);
}
I coded my ultrasonic sensor to work. It changes values on the serial monitor based on the distance between objects.
Today we made a functioning gearbox out of wood. It increases the speed of my robot. The parent gear (which is the big gear because it is being powered) is spinning the little gear which makes a positive gear ratio which makes the wheel spin faster.
This is my final robot. It has color, avoids walls, and has enormous wheels. I am proud.
This is the circuit diagram for my robot. It has two servos and an ultrasonic sensor. It is important to make circuit diagrams as they can help you visualize what you are going to do with your electronics.
My robot is now being controlled by a module I have attached to it. I am sending inputs through my phone in order to make it move around instead of a pre-written code.
I put big wheels on my robot mainly because they make it go faster. They also look very cool. It is minimal in order to increase agility and reduce weight.
I have made some modifications to my robot to allow for it to run the course effectively. I reversed the forward direction of the robot because it is more stable, and I have removed the ultrasonic sensor attachment.
To be safe using the table saw:
wear safety goggles
remove loose clothing
use either the rip fence or the miter gauge
use the feather board
rip cuts with fence
cross cuts with miter gauge
use a push stick
The table saw makes long, straight cuts. Today, we used it to cut two by fours into flatter pieces so that we can use them to make our lock box.
The planer makes the material smooth and reduces the thickness. To be safe using the table saw:
wear ear and eye protection
adjust cutting thickness within 1/16 of the material's thickness.
unplug when finished
attach the vacuum before use.
I smoothed out a plank of wood I am going to use for my box.
TO BE SAFE USING THE MITER SAW:
wear safety glasses
firmly secure the material
vaccum after use
unplug after use
reduce exposure to blade
Today we cut our large pieces into smaller planks to be able to assemble our boxes.
This section is about navigating the menu in Onshape. It teaches how to create and access files as well as using some basic tools.
This section teaches how to make 2D diagrams in the editor. It makes you lean how to use tools to edit diagrams.
This is the tutorial sketch that we made.
Cuts biscuit shaped holes to be able to assemble parts together.
To be safe using the Biscuit Jointer:
wear safety glasses
make sure it is is set to the appropriate size biscuit
make sure to set height in middle of material
mark both sides of material
clamp a block in front of material each time
I connected my pieces of wood together to make a wooden plate for my box.
uses input from a cad file to cut parts
to be safe using the cnc machine:
run the dust collector
vacuum after use
wear ear protection
wear saftey glasses
secure your material
design around your screws.
I engraved my name into the side of my box.
to be safe using the orbital sander:
wear safety glasses
keep the sander moving
do not let sander touch your skin
Keyed Padlocks are a type of lock that needs a specifically serrated key in order to open. The have pins inside of them, and when those pins are set to the correct height, the lock opens. The picture above is a version where 2 key are required to open it. There are 2 locking mechanisms in the lock This is feasible to make in class because we have access to 3d printers and laser cutters. This design also requires a separate key. It also meets the constraints for the projects by being resizable and simple to make thanks to the padlock design. It can also be mounted and attached to anything.
Combination locks are a type of lock that when a dial is turned to the correct angle several times, it unlocks. The picture above is a wooden version. I could laser cut the pieces of my lock and put it together. I could also 3d print it too.
Electronic door locks use something called actuators, which move the bolt of the lock into place so that they door can open. You simply have to trigger the actuator and your door will open. This is feasible to make in class because we have access to wireless electronics and servos.
Instead of a key, this type of lock system requires a numerical code to grant entry to a facility or property. The code is punched in by users via a numerical pad, similar to those on a basic calculator. If the correct code is entered, the door lock or deadbolt should release. This is feasible to make in class because we have access to many electronics including buttons.
to be safe while wood staining:
wear gloves
always stain over a drop cloth
put only a small amount of stain on rag
use cotton cloth to apply stain
This is the lock I will be taking inspiration from. It is very simple but the mechanics of it are complex. It is a simple bolt lock with tumblers in it. It has a separate key and is see through to easily see how it works.
This is my sketch. I will not need that many materials as it will be completely 3d printed.
We created a combination lock as a class to prepare us for construction of our personal lock projects.
The rotor is an important part of the lock. Once all 3 rotors are lined up, the handle can turn and the lock is unlocked.
This is the handle used for unlocking the lock. It is attached to an actuator that moves the bolt when turned.
This is the bolt that moves in or out when the lock is unlocked or locked.
This is a picture of my final class lock. I think it works pretty well and it is interesting to see all of the parts move.
I have started to research how my lock is going to work. I had decided that I was going to make a combination lock. I looked at other lock designs online and I have formulated a design that is suited for my box.
This is the laser cut file for all of the parts I am going to need to construct my lock. I measured distances and proportions and I had to scale pieces accordingly.
This is my cardboard prototype before i made my final lock. Laser cut my onshape file into cardboard, and put the pieces together like they wood be in the side of the box.
I received feedback from my teacher, and I made alterations to my design accordingly. The problem was that people could see what the combination was from the outside, so I added buffers on the bolts so that wouldn't be a problem anymore.
Today I made measurements and marks on by box to plan how i was going to fit my final design into it. I also cut holes in my bocks today to fit certain parts into my box.
Today I printed all of my parts out of thin wood. I then glued them all together and installed them into my box. I did a lot of testing and fine tuning so that it would lock and unlock without a hitch.
WHAT IS MACHINE LEARNING
Machine learning is where a computer can learn to perform human tasks on its own such as facial recognition through being trained with example inputs, and being tested with new inputs.
THE GOAL OF MY MODEL?
Black beans
Kidney Beans
Chickpeas
Lima Beans
The goal of my model is to identify different types of bean. They can be in cans, bags, dishes, or just raw.
THE DATA COLLECTION PROCESS:
For collecting data, I scraped pictures of each type of bean off of the internet. I then went through all of the pictures and took out the ones that were not related. I collected 516 images of different types of beans in total. There are 2304 pixels in each image as well.
MY MODEL:
My model is designed to be able to identify different types of beans. The four types of beans I am identifying are black beans, kidney beans, garbanzo beans, and lima beans. I picked these because they are all somewhat distinct. The model can also tell the difference between them whether they are in cans, bags, or mixed in with other dishes.
MY DATA
BUILDING THE MODEL
My model had 3 layers, an input layer, a dense layer, and an output layer.
ACCURATELY LABELED IMAGES
These correctly labeled images mean that my model is good at predicting these types of images.
MISLABELED IMAGES
These incorrectly labeled images mean that my model is not good at predicting these types of images.