Today in engineering we used tinkercad to learn how to wire a servo. We also learned how to search for, find, and partially interpret the code to control a servo.
/* 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
}
}
In this activity, we transferred our code from tinkercad to the Arduino program. Doing this allowed us to make a servo move back and forth in real life.
In this activity, we used the same code from the previous activities, but instead we wired two servos.
In this activity we edited the code from the previous activities in order to make the two servos function independently.
/* 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> // this is a preprogrammed library that helps control servos
Servo myservo; // this defines the servo and names it myservo
// twelve servo objects can be created on most boards
Servo secondservo;
int pos = 0;
void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the servo object
secondservo.attach(8); // attaches the servo on pin 8 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);
for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
secondservo.write(pos); // tell servo to go to position in variable 'pos'
delay(10); // waits 15ms for the servo to reach the position
}
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
secondservo.write(pos); // tell servo to go to position in variable 'pos'
delay(10); // waits 15ms for the servo to reach the position
}}}
In this activity we only used batteries to wire our Arduinos and make the servos spin. The Arduino stores the last code that was uploaded to it, so we did not have to use the computers to make them spin. Below you will find a screenshot of this circuit diagram on Tinkercad, where we planned the circuit before putting it together in real life.
To begin our robot project, we created prototype bodies for our robots. We used cardboard to build these and fit our arduinos, batteries, wheels, servos, and all other parts on this cardboard,
In this activity we had to make our robots move forwards, backwards, to the left, and to the right. We used the arduino program to code our servos.
In this activity, we had to get our robot to travel throughout a predesigned path. My robot drifted to the left so it frequently got off track even if my code was correct. Due to this, I could only complete part of the track before my robot would drift out of the path.
I tested my robot's body to make sure the weight was distributed evenly, and that my robot was sturdy and well built. To avoid walls, I programmed my ultrasonic sensor to avoid objects within a certain distance, so that it had enough time to avoid the object in its path.t
In my robot, I incorporated a triangular design and the complementary colors, red and blue.
In this activity, we coded and wired an ultrasonic sensor, a sensor which measures distance by using ultrasonic waves. We will use this in the future so that our robot can detect obstacles and avoid them.
This circuit diagram shows how the two servos and the ultrasonic sensor are wired within my robot. Circuit diagrams are useful so that we can easily see how the components are (supposed to be) wired.
In this activity, we used the ultrasonic sensor to give our robot the ability to detect and avoid obstacles.
In this activity we created and utilized gearboxes to increase the speed of our robots. When the goal is to increase speed, the gearbox works by attaching a big "parent" gear, to a smaller "child" gear, so that the child gear moves much faster.
In this activity, we coded and implement Bluetooth control within our robots. We will be using this in the future to control our robots' direction and speed wirelessly.
In this activity, we implemented Bluetooth control within our robots, allowing us to control our robots from our phones. Using the Bluetooth control, my robot can go forward, backward, left, right, and stop. In my code, I used functions and if statements to make my robot respond to the buttons on my phone.
Today we voted on our next project, we decided to create a lock box.
This page shows all of the box benchmarks that we are going to need to document for this project
This page shows all of the lock benchmarks that we are going to need to document for this project
The table saw cuts primarily along the length of the wood (rip cut), and it only cuts in straight lines.
Safety: Wear safety glasses, remove loose clothing, never put your finger within 6 inches of the blade when it's moving, always unplug saw when finished.
Using the table saw, we made rip cuts in these pieces of wood.
The planer uses a blade to remove material from the top of the material in order to reduce its thickness, make the material smooth, or make the material a uniform thickness.
Safety: Wear ear and eye protection, only put wood through the planer, unplug when done, adjust cutting thickness to within 1/16" of the material thickness prior to cutting. Don't put fingers near the opening.
We used the planer to make the wood thinner so that we could use them to make our LockBox.
A miter saw cuts across the length of the wood, this is called a cross cut. It can also cut at angles.
Safety: Wear safety glasses, firmly secure material with your hand outside of the hand placement line, reduce exposure to blade. Don't cut material that requires your hand to be inside of the hand placement line, don't measure the material while it's on the saw.
Using the Miter saw, I cut the wood pieces that I would need to make my LockBox.
Cuts "biscuit shaped" holes on your material so that you can assemble your parts to be both perfectly aligned and sturdy. Once you biscuit, you glue your parts together, creating a "glue up".
Safety: Wear safety glasses, make sure it is set for the appropriate size of biscuit, clamp a block in front of material each time. Don't put your fingers near the blade, or assume the blade won't come out of the material.
It uses input from a cad file to cut or carve the material into complex shapes.
Safety: Wear safety glasses, wear ear protection, vacuum after use, run the dust collector, etc. Don't leave the CNC while it's running or go near the gantry while it's running.
VCARVE PRO is used to develop simple designs for cutting/engraving. Onshape files are used for more complex designs. Shopbot software actually controls the machine and runs the CAD files.
Using the CNC machine, we made wood cutouts with our names carved into them. I will be using this as part of the lid for my box.
The orbital sander smooths out flaws, prepares wood for staining by smoothing out the wood's surface, and resolve edges that don't perfectly match up.
Safety: Wear safety glasses, keep sander moving at all times, do not place sander on skin. Don't touch the sand paper while the sander is operational or put the sander on surfaces that can be damaged by the sander.
Using the orbital sander, we sanded our box to make the sides even, and make the wood smooth.
How does it work?
Like a manual lock, an electronic lock uses a bolt to lock the door and requires a key to open it. The difference between these two lies in the keys. An electronic lock may use something like a code, keycard, etc. to open it, whereas a manual lock would require a physical key or something similar. Some electronic locks, called smart locks, can be controlled by mobile phones.
Is it feasible to make in class (could be out of a different material), and why?
No, making a fully functioning electrical lock would likely take much longer than making a manual lock. It would take a long time to build and wire the circuits, in addition to the time it takes to code and work out all the errors.
Does it meet the constraints for this project and why?
Yes it meets the constraints for this project, in the project brief, it says that both electronic and manual locks are allowed.
A combination lock is a type of lock in which a sequence of numbers, letters, or symbols is required for it to be opened. There are multiple types of combination locks like single dial, multiple dial, and electronic. Single dial locks can be commonly found on lockers and consist of a single dial that is rotated to input a code. Multiple dial locks consist of multiple dials that all have to be rotated to the correct number, symbol, letter, etc. in order to unlock it. Electronic combination locks usually consist of a keypad which is used to input a code.
It would be feasible to make a combination lock in class. These can be made out of materials like wood, which we have access to in class.
This type of lock does meet the constraints for this project because it qualifies as a mechanical lock.
A deadbolt lock is a lock that requires a key to be opened, these locks are most commonly used to secure doors. In deadbolt locks, there is a cylinder attached to the keyhole, when the key is inserted and turned, a bolt inside the cylinder protrudes outward (into the doorframe) and locks the door.
It would not be feasible to make a deadbolt lock in class. This type of lock would require a key and would require us to drill into our boxes so that the bolt can protrude into it.
This type of lock does meet the constraints for this project because it qualifies as a mechanical lock.
A cam lock also requires a key to be opened. Cam locks consist of a cylindrical barrel attached to the cam, which is a rectangular piece at the end of the barrel. When the key is inserted and turned, it rotates the cam and unlocks the system.
It would be feasible to make a cam lock in class. These do not appear to require a lot of materials to make.
This type of lock does meet the constraints for this project because it qualifies as a mechanical lock.
Do: Wear gloves, always stain over a drop cloth, put a small amount of stain on rag, use cotton cloth to apply stain
Don't: Mix stains, leave staining materials out, leave stain rags out, waste gloves.
In class, we stained our boxes to add color while maintaining the texture and pattern of the wood.
Idea Development
A combination lock is a type of lock in which a sequence of numbers, letters, or symbols is required for it to be opened. There are multiple types of combination locks like single dial, multiple dial, and electronic. I am taking inspiration from single dial locks which can be commonly found on lockers and consist of a single dial that is rotated to input a code.
Material List:
Washers (x3)
Teeth/Tabs (x3)
Rotors (x3)
Springs (x2)
Shackle
Shackle collar
Case
Back plate
Latch
Lever
Dial
To create this part I mainly used the rectangle, dimension, and trim tools to create an irregular shape with exact dimensions and measurements. This part was laser cut and is the bolt which locks the mechanism.
To create this part, I used tools such as the center point circle, dimension, rectangle, and tangent arc. This is one of the three rotors that got laser cut and is used to unlock the mechanism when it is aligned with the actuator and the other two rotors.
To create this part I used the center point circle, three point arc, rectangle, dimension, and various constraint tools. This part got laser cut and it is the actuator which is turned by the handle to unlock the mechanism.
In the video to the left, I give a detailed explanation of the parts (the actuator, rotors, bolt, knob, etc.) that I used in my wooden combination lock, and I show how it works.
Create file in Onshape
Save file to computer as a DXF
Login to Glowforge
Upload the file to glowforge
For cardboard select 1/8" corrugated cardboard
During this class, I had not yet decided which type of lock I would incorporate into by Lockbox, so I watched YouTube videos on various types of locks and their inner workings in an attempt to gain an idea of which type of lock I'd like to use.
During this class, I began cutting out and gluing together pieces which I would use for my lock's cardboard prototype.
During this class, I wired an Arduino and some buttons to turn a servo when pressed. I connected the Arduino to battery power via breadboard.
I assembled and glued together most of my cardboard prototype, I added many spacers to fill the space between the front and the back.
I started on my wooden lock by cutting out and assembling the same pieces used for my cardboard lock.
I assembled most of my wooden lock and overcame a problem with the servo. To overcome this problem of the servo turning independent of the actuator, I attached the servo to a piece and attached that piece to the floor of the lock, causing the actuator to rotate every time the button is pressed.
Above is a video of my mechanical + electrical lock working with my box. In the video, I explain how my lock works, how I crafted it, and show it successfully locking my box.
During this unit, I learned how to create my very own machine learning model using python and Google Colaboratory. The goal for my machine learning model was to be able to recognize four related objects at 90% accuracy or higher. I chose to use wet wipes, rubbing alcohol, hand soap, and hand sanitizer as my related items.
Hand Sanitizer
Hand Soap
Rubbing Alcohol
Wet wipes
To collect the data, I use the pycharm program and code which allowed me to swiftly take black and white pictures of all of the objects. I took two hundred pictures of each object at varying angles to use for training my model to recognize these objects. Each of these grayscale images are 48x48 pixels in size, and there are 800 images in total.
Hand Sanitizer
Hand Soap
Rubbing Alcohol
Wet wipes
Above is the machine learning model that I created using python and Google Colaboratory. This model is able to accurately label images of the four items above, it has a 100% accuracy rate using the testing data. Below, you can find more information about my data and the process of building the model.
Above is the data that I used to train and test the machine learning model. Each folder holds 200 images of each particular item, for a total of 800 images that are each 48x48 pixels. To gather this data, I used a program that took pictures rapidly so that I could efficiently create a large dataset.
To the left is the code that I used to create the model, along with a summary of the model. The first line creates and defines input by using a keras command and the training tensors that were created and defined earlier in the code. The second line creates and defines layer by creating 1024 neurons, adding a sigmoid activation function, and feeding the input into it. The third line creates and defines output by adding a softmax activation function and feeding layer into it. The fourth line defines model by using a keras command and the previous input and output lines, while the last line returns a summary of the model.
The model identified this image as Rubbing Alcohol, which is the correct label for the image.
The model predicted that this image depicted wet wipes, which is correct.
The model accurately predicted that this item was hand sanitizer.