For this project we'll be learning robotics
Following the directions I will have a rolling robot that can be controlled by my phone.
We practiced using wires and an Arduino to make a servo go back and forth on Tinkercad.
We put together our servo and Arduino and then uploaded the code into the Arduino program to make the servo spin.
Added an Arduino by putting wires in the same spots as the first Arduino. Two servos are spinning using the same Arduino and code in the Arduino program.
We typed a new code into the Arduino program to make two servos spin independently.
#include <Servo.h> //this refers to a "library" that knows how to control servos
Servo ABservo; //defines a "servos" object and names it "ABservo"
Servo BAservo; //defines a "servos" object and names it "BAservo"
//int pos = 0;
void setup() {
ABservo.attach(9); //attach "servo" object named "ABservo" to pin 9
BAservo.attach(11); //attach "servo" object named "BAservo" to pin 11
}
void loop() {
ABservo.write(0); //make the "servo" object named "ABservo" rotate at full speed counterclockwise
BAservo.write(180); //make the "servo" object named "BAservo" rotate at full speed counterclockwise
//in order tomake the go clockwise at full speed, use "180" as the number
delay(500);
ABservo.write(90); //make the "servo" object named "ABservo" rotate at full speed counterclockwise
BAservo.write(90); // make the "servo" object name "BAservo" rotate at full speed counterclockwise
delay(500);
}
We wired two servos powered by batteries, the servos are allowed to spin because the Arduino saved the code from the Arduino program.
We built/modeled our Arduino and servos on Tinkercad first before wiring everything with the bread board and servos in real life.
We created our robot prototypes from cardboard and glued the batteries, bread board, and servos to it. There's also a caster wheel on the bottom to help with turning.
We added more writing to our previous code to make the servo turn left and right and also move backwards.
#include <Servo.h> //this refers to a "library" that knows how to control servos
Servo leftservo; //defines a "servos" object and names it leftservo"
Servo rightservo; //defines a "servos" object and names it "rightservo"
//int pos = 0;
void setup() {
leftservo.attach(9); //attach "servo" object named "leftservo" to pin 9
rightservo.attach(10); //attach "servo" object named "rightservo" to pin 10
}
void loop() {
leftservo.write(0); //make the "servo" object named "leftservo" rotate at full speed counterclockwise
rightservo.write(180); //make the "servo" object named "rightservo" rotate at full speed counterclockwise
//in order tomake the go clockwise at full speed, use "180" as the number
delay(1000);
leftservo.write(180); //make the "servo" object named "leftservo" rotate at full speed counterclockwise
rightservo.write(0); //make the "servo" object named "rightservo" rotate at full speed counterclockwise
//in order tomake the go clockwise at full speed, use "180" as the number
delay(1000);
leftservo.write(0); //make the "servo" object named "leftservo" rotate at full speed counterclockwise
rightservo.write(0); //make the "servo" object named "rightservo" rotate at full speed counterclockwise
//in order tomake the go clockwise at full speed, use "180" as the number
delay(1000);
leftservo.write(180); //make the "servo" object named "leftservo" rotate at full speed counterclockwise
rightservo.write(180); //make the "servo" object named "rightservo" rotate at full speed counterclockwise
//in order tomake the go clockwise at full speed, use "180" as the number
delay(1000);
leftservo.write(180); //make the "servo" object named "leftservo" rotate at full speed counterclockwise
rightservo.write(0); // make the "servo" object name "rightservo" rotate at full speed counterclockwise
delay(5000);
}
#include <Servo.h> //this refers to a "library" that knows how to control servos
Servo leftservo; //defines a "servos" object and names it leftservo"
Servo rightservo; //defines a "servos" object and names it "rightservo"
//int pos = 0;
void setup() {
leftservo.attach(9); //attach "servo" object named "leftservo" to pin 9
rightservo.attach(10); //attach "servo" object named "rightservo" to pin 10
}
void loop() {
leftservo.write(180); //make the "servo" object named "leftservo" rotate at full speed counterclockwise
rightservo.write(0); //make the "servo" object named "rightservo" rotate at full speed counterclockwise
//in order tomake the go clockwise at full speed, use "180" as the number
delay(5000);
leftservo.write(90); //make the "servo" object named "leftservo" rotate at full speed counterclockwise
rightservo.write(90); //make the "servo" object named "rightservo" rotate at full speed counterclockwise
//in order tomake the go clockwise at full speed, use "180" as the number
delay(500);
leftservo.write(180); //make the "servo" object named "leftservo" rotate at full speed counterclockwise
rightservo.write(180); //make the "servo" object named "rightservo" rotate at full speed counterclockwise
//in order tomake the go clockwise at full speed, use "180" as the number
delay(700);
leftservo.write(90); //make the "servo" object named "leftservo" rotate at full speed counterclockwise
rightservo.write(90); //make the "servo" object named "rightservo" rotate at full speed counterclockwise
//in order tomake the go clockwise at full speed, use "180" as the number
delay(500);
leftservo.write(180); //make the "servo" object named "leftservo" rotate at full speed counterclockwise
rightservo.write(0); //make the "servo" object named "rightservo" rotate at full speed counterclockwise
//in order tomake the go clockwise at full speed, use "180" as the number
delay(700);
leftservo.write(180); //make the "servo" object named "leftservo" rotate at full speed counterclockwise
rightservo.write(180); //make the "servo" object named "rightservo" rotate at full speed counterclockwise
//in order tomake the go clockwise at full speed, use "180" as the number
delay(500);
leftservo.write(180); //make the "servo" object named "leftservo" rotate at full speed counterclockwise
rightservo.write(0); //make the "servo" object named "rightservo" rotate at full speed counterclockwise
//in order tomake the go clockwise at full speed, use "180" as the number
delay(1000);
}
When going through the course we had to update our codes a lot mostly just changing the delay when going forward or turning. If my robot went too far forward or turned too far then I would just reduce the delay.
#include <Servo.h> //this refers to a "library" that knows how to control servos
Servo leftservo; //defines a "servos" object and names it leftservo"
Servo rightservo; //defines a "servos" object and names it "rightservo"
//int pos = 0;
void setup() {
leftservo.attach(9);
rightservo.attach(10);
}
void forward () {
leftservo.write(0); //make the "servo" object named "leftservo" rotate at full speed counter clockwise
rightservo.write(180);
}
void backwards () {
leftservo.write(180); //make the "servo" oject named "leftservo" rotate at full speed clockwise
rightservo.write(0);
}
void left () {
leftservo.write(180);
rightservo.write(180);
}
void right () {
leftservo.write(0);
rightservo.write(0);
}
#include <Servo.h> //this refers to a "library" that knows how to control servos
Servo leftservo; //defines a "servos" object and names it leftservo"
Servo rightservo; //defines a "servos" object and names it "rightservo"
int pos = 0;
// defines pins numbers
const int trigPin = 4;
const int echoPin = 5;
// defines variables
long duration;
int distance;
void setup() {
pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
pinMode(echoPin, INPUT); // Sets the echoPin as an Input
Serial.begin(9600); // Starts the serial communication
leftservo.attach(9);
rightservo.attach(10);
}
void forward () {
leftservo.write(180); //make the "servo" object named "leftservo" rotate at full speed counter clockwise
rightservo.write(0);
}
void backwards () {
leftservo.write(0); //make the "servo" oject named "leftservo" rotate at full speed clockwise
rightservo.write(180);
}
void left () {
leftservo.write(180);
rightservo.write(180);
}
void right () {
leftservo.write(0);
rightservo.write(0);
}
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);
if(distance < 10) {
right();
delay(750);
forward();
delay(1000);
}
// foward();
// delay(3000);
// backwards();
// delay(3000);
// left();
// delay(3000);
// right();
// delay(3000);
}
We wired an ultrasonic sensor to our robot that is also connected to our Arduino. We combined two codes, first our previous function definitions code and then the code for the sensor.
Working gear box with servo from our old robot, the parent gear is connected to the servo and is pushing the child gear.
This is my robot currently. My robot has the gearboxes and wiring inside with the sensor poking out on the top.
Functional Requirements:
Limited to no slipping --currently not meeting/currently meeting/currently can't evaluate
Weight must be balanced --currently not meeting/currently meeting/currently can't evaluate
Must be stable --currently not meeting/currently meeting/currently can't evaluate
Avoids walls/objects when desired --currently not meeting/currently meeting/currently can't evaluate
Can be controlled by Bluetooth --currently not meeting/currently meeting/currently can't evaluate
Can fit into bin (width and length only) --currently not meeting/currently meeting/currently can't evaluate
Usability Requirements
Fully enclosed .--currently not meeting/currently meeting/currently can't evaluate
Has a removable door/ cover. --currently not meeting/currently meeting/currently can't evaluate
Has easy access to batteries. --currently not meeting/currently meeting/currently can't evaluate
Has easy access to red row/5V. --currently not meeting/currently meeting/currently can't evaluate
Has easy access to the reset button. --currently not meeting/currently meeting/currently can't evaluate
Has easy access to the "B" end of the A-B Cable --currently not meeting/currently meeting/currently can't evaluate
Aesthetic Requirements
Pieces and parts match up --currently not meeting/currently meeting/currently can't evaluate
Clean Glue Edges --currently not meeting/currently meeting/currently can't evaluate
Design is unique --currently not meeting/currently meeting/currently can't evaluate
Complimentary Colors are Implemented --currently not meeting/currently meeting/currently can't evaluate
#include <Servo.h> // this refers to a "library" that knows how to control servos
Servo rightservo; //defines a "servo" object and names it "firstservo"
Servo leftservo; //defines a "servo" object and names it "secondservo"
#define CUSTOM_SETTINGS
#define INCLUDE_GAMEPAD_MODULE
#include <Dabble.h>
void setup() {
leftservo.attach(9); // attach the "servo" object named "myservo" to pin 9
rightservo.attach(10); // attach the "servo" object named "myservo" to pin 10
Serial.begin(250000); // make sure your Serial Monitor is also set at this baud rate.
Dabble.begin(9600); //Enter baudrate of your bluetooth.Connect bluetooth on Bluetooth port present on evive.
}
void forward(){
leftservo.write(0); //make the "servo" object named "firstservo" rotate at full speed counterclockwise
rightservo.write(180);
}
void backwards(){
leftservo.write(180); //make the "servo" object named "firstservo" rotate at full speed counterclockwise
rightservo.write(0);
}
void left(){
leftservo.write(180); //make the "servo" object named "firstservo" rotate at full speed counterclockwise
rightservo.write(180);
}
void right(){
leftservo.write(0);
rightservo.write(0);
}
void stopping(){
leftservo.write(90);
rightservo.write(90);
}
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("KeyPressed: ");
if (GamePad.isUpPressed())
{
Serial.print("UP");
forward();
}
if (GamePad.isDownPressed())
{
Serial.print("DOWN");
backwards();
}
if (GamePad.isLeftPressed())
{
Serial.print("Left");
left();
}
if (GamePad.isRightPressed())
{
Serial.print("Right");
right();
}
if (GamePad.isSquarePressed())
{
Serial.print("Square");
stopping();
}
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();
}
Do
Wear safety glasses
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
Don't
Table saw makes straight long cuts
I cut a line down a wooden plank making two separate pieces
Do
Wear ear protection
Wear safety glasses
Adjust the cutting thickness to with 1/16" of the material thickness prior to cutting
Unplug when finished
Attach the vacuum before use
Don't
Put fingers near the opening
Pass any material but wood through the planner
Pass wood with nails/screws through the planer
It removes material from the top of the material to perform three functions:
Reduce the thickness of your material
Make the material a uniform thickness
Make your material smooth/nice
I smoothed out a plank of wood making it even on both sides
Do
Wear safety glasses
Firmly secure the material with your hand outside of the hand placement line and up againist the fence
Vacuum after use
Unplug the saw after use
Reduce exposure to blade
Don't
Touch or manually move the blade guard
Cut material that requires your hand to be inside of the hand placement line
Plug the saw in with your cord across your body
Measure while material is on the saw
It cuts across the length of the wood, this type of cut is a cross cut
I cut 9 pieces of wood using the measurements I wanted for my lock box
Do
Wear safety glasses
Make sure it is set for the appropriate size of biscuit
Make sure you set the height in the middle of the material
Mark both sides of the material
Clamp a block in front of material each time
Don't
Put your fingers near the blade when it is plugged in
Assume the blade won't come out of the material
I learned how to navigate my OnShape account and the basics of OnShape use.
I've completed the basic sketch exercise and tutorials for navigating OnShape documents.
Basic sketch I made on OnShape. I used the line button, circle button, and found the diameter of certain lines.
Cuts "biscuit shaped" holes on your material so that you can assemble your part to be both
Perfectly aligned
Sturdy
Once you biscuit, you glue your parts together creating what is called a "glue up"
Do
Run the dust collector
Vacuum after use
Wear ear protection
Wear safety glasses
Secure your material (with screws or clamps)
Design around your screws
Don't
Leave the CNC while it's running
Don't go near the gantry while it's running
Uses input from a CAD file to cut, or carve pieces /parts
Lock Research
How does it work?
Connect the keypad to the Arduino pins and when the code is typed in on the keypad it will be right according to the code imputed on the code uploaded to the Arduino. A servo will also be connected to the Arduino which will spin a wire that's connected to the deadbolt lock which open and close based on the code put in.
Is it feasible to make in class, why?
I think this lock is feasible to make in class because of the materials are openly ready and if not they can be easily made
Does it meet the constraints of the project?
This definitely meets the constraints of the project
How does it work?
The pins are positioned vertically so that the key can be inserted and push on the pins in the right which then triggers the bolt to open.
Is it feasible to make in class, why?
I believe this design is feasible to make because of uncomplicated the actual design of the pins has to be for the lock to work and also the lock can be 3D printed.
Does it meet the constraints of the project?
This meets all constraints, I would only be worried about how durable the material of the lock and not the lock itself.
How does it work?
The Arduino consists of a 6 buttons and eight LEDS which when clicked on in the right order will produce the green light and if not a red light. You can change the code by updating the code uploaded to the Arduino.
Is it feasible to make in class, why?
I think between all my other locks this is definitely the easiest to make with the most ready materials.
Does it meet the constraints of the project?
I think this lock would fit perfectly anywhere on the box and would be even more customizable by creating a personal combination.
How does it work?
When the combo knob is turned the right way in the right turns will fall into a notch which starts the combination
Is it feasible to make in class, why?
I think this lock is completely feasible to make in class because of all the parts could be 3D printed or cut out by a CNC machine
Does it meet the constraints of the project?
I think this fits most of the constraints, the only constraint I could possibly see being an issue would be is it fitting into the box or around it without overtaking the size of the box.
Do
Wear gloves
Always wear stain over a drop cloth
Put a small amount on stain on your rag
Use cotton cloth to apply stain
Don't
Mix stains
Leave staining materials out
Leave stain rags out
Leave waste gloves out
The lock has a preset code written into the code which is then uploaded to the Arduino. When the code is typed in correctly the servo will spin with wire connected to it which will then put the slider from the deadbolt thus unlocking the mechanism.
I drew every material and all the materials put together.
MDF Board
Arduino Uno
4x4 Type Keypad
Servo Motor
Wires
Metal Wire
Battery 9V
Blue Cord
This was one of the harder parts to create on OnShape only because some of the lengths weren't identified and you had to find them based on the lengths that were provided.
Out of the three this was the easiest to make because it's a basic shape, the points where the circles had to be and their radius' were provided, and the weird hump piece half shape diameter was also given.
This piece was only difficult when placing the grooves because it was hard placing them on a curve and getting their lengths to fit right.
The process making the final mechanical model was so frustrating because you had to figure out putting it together dry so that meant no glue. When you thought you would make a break through it would all fall apart or would be too stuck to take back apart. But I finally did it and got everything glued together to having it working efficiently. When you first start turning the knob you turn it until the first rotor's groove catches on the second rotor's rectangular groove which would then hit the third rotor's groove and would have the actuator bolt's indentations lined up. After that the final steps are to move the first rotor until it's indentation lined up with the second and third and pull the bolt in the middle to have the actuator's bolt slide through.
I started wiring my Arduino and finished making my prototype lock and bolt slider out of cardboard.
I completed my final cardboard model with laser cut cardboard with measurements that will fit into the wooden enclosure.
I've finished wiring the keypad and servo and I've put it in the laser cut enclosure.
I finished making the lock and bolt from laser cut wood, the servo is connected to the bolt with a paper hot glued to the handle.
I cut holes on the left side of my box for the switch and the html cable for when the batteries die. I also cut a hole up higher for the lock's latch to come out and actually lock the box.
I finally put all the pieces to my project together to have a fully functioning lock in my box.
#include <Keypad.h>
#include <Servo.h>
// Set up keypad variables:
int numKeyPresses = 0; // Track number of key presses
int maxKeyPresses = 3; // Only allow 3 digits to be entered
int keyPresses[3] = { 0, 0, 0 }; // Initialize an empty array to hold input
const byte numRows= 4; // # of rows on the keypad
const byte numCols= 4; // # of columns on the keypad
// Set up servo variables:
int angle = 0; // Angle in degrees to position servo [0-180]
int angleMultiplier = 1; // Multiply by each digit, divide by 10 on each input
Servo servo; // Create the servo object
int servoPin = 3; // Set the servo pin
char keymap[numRows][numCols]= // Setup the keypad layout
{
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'},
};
// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.
byte rowPins[numRows] = { 11, 10, 9, 8 };
// Connect keypad COL0, COL1 and COL2 to these Arduino pins.
byte colPins[numCols] = { 7, 6, 5, 4 };
// Create the Keypad
Keypad kpd = Keypad( makeKeymap( keymap ), rowPins, colPins, numRows, numCols );
void setup()
{
Serial.begin(9600); // Start up serial comms
resetAngleMultiplier(); // Start accepting numeric input
servo.attach( servoPin ); // Attaches the servo to the servo object
} // setup
void loop()
{
char key = kpd.getKey();
if( key ) // Check for a valid key
{
if( key >= 0x41 && key <= 0x44 || key == 0x23 || key == 0x2A )
{
resetInput();
Serial.println( "ERROR: Numeric input only!" );
} // ^ if invalid entry
else // Else, entry is valid:
{
angle += angleMultiplier * ( key - 0x30 );
angleMultiplier /= 10;
if( numKeyPresses == maxKeyPresses - 1 )
{
setServo( angle ); // Use the input to turn servo
resetInput();
}
else
{
numKeyPresses++;
}
Serial.println( (String) angle );
}
} // if( key )
} // loop
void setServo( int angle )
{
if( angle > 180 )
angle = 180;
Serial.println( "Setting servo to " + (String) angle + " degrees." );
servo.write( angle ); // Set the servo position
} // setServo
void resetAngleMultiplier()
{
angleMultiplier = 1;
/* We started out with a multiplier of 10^0 (or 1). For each
number we want to accept, we want to have a multiplier one
order of magnitude greater. So, for example, for 5 digits, the
multiplier starts out as 10 000. */
for( int i = 0; i < maxKeyPresses - 1; i++ )
angleMultiplier *= 10;
} // resetAngleMultiplier
void resetInput()
{
resetAngleMultiplier(); // Reset the numeric input
angle = 0; // Reset the angle
numKeyPresses = 0; // Reset number of key presses
}
Machine learning is the development of computer systems that are able to learn and adapt without following explicit instructions on what to do.
The goal of my model was for it to be able to tell the difference between four distinctly different phone cases. The labels I used for my objects were Cartoon case (top left), Butterfly case (top right), Wallet case (bottom left), and Circle case (bottom right).
In this project we had to choose four or more objects to be predicted, I chose my classmate's phone cases. The data for this project is pulled from the folder "Phone Cases" in my google drive where all 804 of my photos are. I had to test and train the model so it would accurately predict the labels for each image. I can proudly say that my model has 100% accuracy and can correctly predict the labels for all the images.
These 3 images shows that my model can correctly predict the images of the cases with 100% accuracy.
I had zero incorrectly labeled images, my model has 100% accuracy.
In the folders of my data set there are 201 pictures in each one, every picture is 48 by 48 pixels. In all my model runs through and can correctly predict around 800 pictures. Getting all the images only took a few minutes, the process included holding our items in front of Ms. White's computer and turning it in different directions.
1st line: Inputs keras library
2nd line: Creates a layer the size of 1024
3rd line: Outputs dense layer
4th line: Creates the keras model
5th line: Prints a summary of the model