Today we learned how to wire a servo, and where to find the code to control a servo.
We've uploaded the code in order to get two servos operating properly using the Arduino IDE. Powered through the Computer USB port.
/* 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
}
}
//The Tinkercad circuit diagram is a visual model of what we //did physically that we can refer back to.
#include <Servo.h>
Servo hidari;
Servo migi;
void setup() {
// eugh eugh eugh
hidari.attach(9);
migi.attach(8);
}
void loop() {
// welcome, player, euuuuugh duude
hidari.write(0); //susumu | up
migi.write(0);
delay(2000);
// hidari.write(90); //chuushi |stop
// migi.write(90);
// delay(2000);
hidari.write(180); // ushiro he | back
migi.write(180);
delay(2000);
hidari.write(180); //hidari he | left
migi.write(0);
delay(1300);
hidari.write(0); //migi he | right
migi.write(180);
delay(1300);
}
//// * DATA / GATHERED INFORMATION
2000 ms / 1 Foot
We learned how to make two separate Servo objects in the Arduino IDE in order to allow them to function on different variables for movement.
We've learned how to power the Arduino with batteries rather than the computer as the power source.
I built a functional cardboard prototype around the battery-powered Servos and Arduino.
We've experimented gaining further knowledge of programming the robot prototype's movement with the fundamentals of code. In doing so, the robot is able to go, "Forwards, Backwards, Left, & Right".
#include <Servo.h>
Servo hidari;
Servo migi;
void f(int a){
hidari.write(0); //susumu | up
migi.write(0);
delay(a);
}
void b(int a) {
hidari.write(180); // ushiro he | back
migi.write(180);
delay(a);
}
void l(int a) {
hidari.write(180); //hidari he | left
migi.write(0);
delay(a);
}
void r(int a) {
hidari.write(0); //migi he | right
migi.write(180);
delay(a);
}
void s(int a) {
hidari.write(90); //chuushi |stop
migi.write(90);
delay(a);
}
void setup() {
// eugh eugh eugh
hidari.attach(9);
migi.attach(8);
}
void loop() {
// welcome, player, euuuuugh duude
f(4600); //#1
r(900);
f(5200); //#2
r(850);
f(3300); // #3
r(830);
f(1800); // #4
l(830);
f(7000);
l(830);
f(3000);
s(1500);
}
//// * DATA / GATHERED INFORMATION
//2000 ms / 1 Foot
My robot stands stably, moves in the proper directions when directed to, & makes fairly clean turns.
I reassembled my robot to allow for the whole of the direction of the robot's movement to rely on the frontal wheels, which operate on a positional micro servo. After ensuring a stable balance, I went on to had design features that make the robot take the form of a dog. It has the US Sensor for eyes, a snout, ears, & a tail in the back (not visible in current photo).
Using the dabble app & its library's template Gamepad code, I am able to control my robot's movement with my phone. The Bluetooth module reads a direction statement sent by my phone, & runs a function accordingly.
We coded the sensors to actively log the distance of what's in front of it.
I coded my robot to automatically turn either left or right if a wall is in mid-distance.
DO's
[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's
[Put your finger within 6" of the blade when it is moving, cross cut with rip fence, stand right in front of the blade, operate with gloves on, leave it plugged in]
DO's
[Wear ear protection & safety goggles, adjust the cutting thickness to within 1/16" of the material thickness prior to cutting, unplug when finished, attach the vacuum before use]
DON'T's
[Put fingers near the opening, pass any material but wood through the planer, pass wood with nail screws through the planer]
Cross Cut: cuts across the length of the wood.
1.) Also cuts at angles.
DO
[Wear safety glasses, firmly secure the material with your hand outside of the hand placement line up against the fence, vacuum after use, unplug the saw(in the classroom) 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 (material is too short for this application), plug in the saw with the cord across the body, measure while material is on the saw]
DO's
[wear safety goggles, make sure it is set for the appropriate size of biscuit, make sure you set the heightin the middle of the material, mark both sides of the material, clamp a block in front of the material each time]
DON'T's
[put your fingers near the blade when it is plugged in, assume the blade won't come out of the material]
VCARVE PRO is used to develop designs for cutting/engraving.
DO's
[run the dust collector, vacuum after use, wear ear protection, wear safety goggles, secure your material (with screws or clamps), design around your screws]
DONT's
[leave the CNC while it is running, go near the gantry while it is running]
Constraints & plan for our lockboxes that we will build in class.
A roadmap of our lockbox development process.
A list of tools supplied in our classroom for our use to build the lockboxes.
We went through a course to initiate our Onshape learning experience by becoming acquainted with the basics of navigating their website & software.
Following learning how to work our way around the website, we learned the fundamentals of using the actual software. Going on to create our first Onshape document with a Basic Sketching Exercise.
After going through the Onshape fundamentals, we created our first basic sketch to prove our retention of the information.
Programmed through the Arduino, the RFID Module scans the card necessary to trigger the lock function, which is a servo maneuvering the lock mechanism.
As Ms. White will not provide RFID modules, it is not feasible to make, unless by self-initiative to purchase a module.
Does it meet the constraints of this project?
Yes.
Padlocks are a mechanical lock that uses an internal pin tumbler lock to release spring tension & push out the shackle which can then be reinserted to relock the padlock.
I'm not sure if we have springs & such to make this happen.
Does it meet the constraints of this project?
Yes
When the proper key is inserted, it elevates metal pins inside the mechanism to all be at the same level where they can turn & open the lock.
I'm not sure if we have springs & such to make this happen.
Yes.
By programming the keypad operations into an Arduino circuit board, when the proper key combination is entered a specified function (particularly access to something secure) is invoked.
Keypads will not be supplied by our teacher.
Does it meet the constraints of this project?
It can, depending on how the lock mechanism that is triggered by the keypad is designed.