We will be learning about robotics .
At the end of the project I will have a rolling robot that I can control with my phone!
This is a video of a circuit diagram we created today in class.
Today in class we programmed our servo to move back and forth.
/* 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
}
}
Today in class I was able to write a code in order for my servo to move back and forth.
Today in class I was able to write a code in order for my servos to move independently. This means that one is doing one thing while the other is doing a separate action.
#include <Servo.h> // this refers to a "library" thats knows how to control servos
Servo firstservo; // this line of code defines a "servo" object and names it "firstservo"
Servo secondservo; // this line of code defines a "servo" object and names it "firstservo"
//int pos = 0; //
void setup() {
firstservo.attach(9); // attach the "servo" object name "myservo" to pin 9
secondservo.attach(10); // attach the "servo" object name "myservo" to pin 10
}
void loop() {
firstservo.write(0); // make the "servo" object name "firstservo" rotate at full speed counterclockwise
secondservo.write(180);// make the "servo" object name "firstservo" rotate at full speed counterclockwise
// in order to make the servo go clockwiseat full speed, use "180" sa the number
delay(500);
firstservo.write(180); // make the "servo" object name "firstservo" rotate at full speed counterclockwise
secondservo.write(0); // make the "servo" object name "firstservo" rotate at full speed counterclockwise
delay(500);
}
Today in class we were able to make our servo battery powered.
This is my circuit diagram of my battery powered servos.
This is my prototype of my robot we made in class today.
This is a picture of my robot prototype. This is just one of the 10 ideas I have! :)
Today in classed we programmed our servo to move forward, backwards, left and right.
#include <Servo.h>
Servo myservo;
Servo secondservo;
// create servo object to control a servo
// twelve servo objects can be created on most boards
void setup() {
myservo.attach(9);
secondservo.attach(10); // attaches the servo on pin 9 to the servo object
}
void loop() {
myservo.write(180); // tell servo to go to position in variable 'pos'
delay(1000); // waits 15ms for the servo to reach the position
// goes from 180 degrees to 0 degrees
myservo.write(0); // tell servo to go to position in variable 'pos'
delay(1000);
secondservo.write(180); // tell servo to go to position in variable 'pos'
delay(1000); // waits 15ms for the servo to reach the position
// goes from 180 degrees to 0 degrees
secondservo.write(0); // tell servo to go to position in variable 'pos'
delay(1000); // waits 15ms for the servo to reach the position
}
Describe at least one “physical” iteration to your robot that you have made, answering these prompts:
How did you know that you needed to make a change to your robot (describe the testing process and what you learned from testing). Include a picture if you are able.
On my robot the wheels where slipping and it was hard for my robot to work.
What specifically did you change?
I had to fix my wheels and find better ways for it to stop slipping.
How did you know/verify that your change helped your robot’s function?
I know when I tested it and it was not slipping as much anymore it was starting to go straight.
Describe at least three “iterations” to your code that you have made, in order (three successive changes):
How did you know that you needed to make a change to your code (describe the testing process and what you learned from testing). Include a line of code to aid in your description if you are able. Originally, when attempting to get my robot to go forward, I typed:
I know I need to make changing to my code when I wanted to make a slight left and it was going all the was to the left or I wanted it to travel an amount of distance and it would go too far.
What specifically did you change? Include a line of code in your description.
What I was playing with with my code was I was playing around with my speed and distance.
rightservo(90)
secondservo(180)
Today in class I finished programming my ultrasonic sensor. Mt ultrasonic sensor determine the distance between it and an object in front of it.
In class my teacher Miss. White helped me trouble shoot my ultrasonic sensor till it worked. When I put my robot together you will be able to see it better. When I put my hand in front of the ultrasonic sensor, the gearbox changes directions!
#include <Servo.h>
Servo leftservo;
Servo rightservo;
const int trigPin = 9;
const int echoPin = 10;
long duration;
int distance;
void setup() {
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
Serial.begin(9600);
leftservo.attach(4);
rightservo.attach(5);// attaches the servo on pin 9 to the servo object
}
void forward() { //defines the function that makes the whole robot move forward
leftservo.write(0);
rightservo.write(180);
}
void backwards() { //defines the function that makes the whole robot move backwards
leftservo.write(180);
rightservo.write(0);
}
void left() {
leftservo.write(180); // tell servo to go to position in variable 'pos'
rightservo.write(180); // tell servo to go to position in variable 'pos'
}
void right() {
leftservo.write(180); // tell servo to go to position in variable 'pos'
rightservo.write(180);
}
void stop() {
leftservo.write(90); // tell servo to go to position in variable 'pos'
rightservo.write(90);
}
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 < 17 and distance > 0) {
right();
delay(500);
forward();
delay(500);
}
// forward();
// delay(3000); // waits 15ms for the servo to reach the position
// backwards();
// delay(3000); // waits 15ms for the servo to reach the position
//
// // tell servo to go to position in variable 'pos'
// delay(3000);
}
Today in class we made a gear box. Gear boxes can increase the speed of the child gear.
#include <Servo.h>
Servo leftservo;
Servo rightservo;
const int trigPin = 9;
const int echoPin = 10;
long duration;
int distance;
void setup() {
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
Serial.begin(9600);
leftservo.attach(9);
rightservo.attach(10);
}
void forward() {
leftservo.write(0);
rightservo.write(180);
}
void backwards() {
leftservo.write(180);
rightservo.write(0);
}
void left() {
leftservo.write(180);
rightservo.write(180);
}
void right() {
leftservo.write(180);
rightservo.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);
if(distance < 6){
right();
delay(1000);
forward();
}
// forward();
// delay(3000);
// backwards();
// delay(3000);
// left();
// delay(3000);
// right();
// delay(3000);
}
This is the progress for my robot.
This is my final prototype of my fully functioning and working robot. In this video you can see that the ultrasonic sensor is receiving input and when my robot gets close to an object or a wall it turns to miss the object or wall!
This is a video of me controlling my robot with my bluetooth controller working.
/*
Gamepad module provides three different mode namely Digital, JoyStick and Accerleometer.
You can reduce the size of library compiled by enabling only those modules that you want to
use. For this first define CUSTOM_SETTINGS followed by defining INCLUDE_modulename.
Explore more on: https://thestempedia.com/docs/dabble/game-pad-module/
*/
#define CUSTOM_SETTINGS
#define INCLUDE_GAMEPAD_MODULE
#include <Dabble.h>
void setup() {
// put your setup code here, to run once:
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 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");
}
if (GamePad.isDownPressed())
{
Serial.print("DOWN");
}
if (GamePad.isLeftPressed())
{
Serial.print("Left");
}
if (GamePad.isRightPressed())
{
Serial.print("Right");
}
if (GamePad.isSquarePressed())
{
Serial.print("Square");
}
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();
}
These are the pictures of my final robot.
This is my robot just moving around being my robot.
#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); // 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.
leftservo.attach(6); // attach the "servo" object named "myservo" to pin 9
rightservo.attach(5); // attach the "servo" object named "myservo" to pin 10
}
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);
rightservo.write(180);
}
void right() {
leftservo.write(0);
rightservo.write(0);
}
void stopping() {
leftservo.write(90); //make the "servo" object named "firstservo" rotate at full speed counterclockwise
rightservo.write(93);
}
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())
{ forward();
Serial.print("UP");
}
else{
stopping();
}
if (GamePad.isDownPressed())
{
backwards();
Serial.print("DOWN");
}
if (GamePad.isLeftPressed())
{
left();
Serial.print("Left");
}
if (GamePad.isRightPressed())
{
right();
Serial.print("Right");
}
if (GamePad.isSquarePressed())
{
Serial.print("Square");
}
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 is my LED blinking on my Arduino using a Bluetooth controller.
This is my robot going through the path and completing it successfully without touching any walls and doing the bonus points!
After almost a month of working and programming my robot it is finally finished. This is a quick short video showing how my robot evolved and the different types of prototypes I went through. looking back after doing this project I feel really good about it. I met all of the constraints and this is something I can try and build again in the future but even better.
Table Saw
The table saw is a tool that you use to cut things. somethings you would want to know when using a table saw is wear safety glasses and use a push stick so you don't have to use your hands.
Today we used the table to cut 2x4s into flatter pieces so that we can use them to make are box
Planer
This is a planer it can reduce the thickness of your material and also makes you material smooth/nice. Some safe rules are you need to wear ear plugs and safety glasses.
Today with the planer we just sanded are peace of wood so it would look nice and smooth.
Miter Saw
the miter saw is a saw that cuts angles. some safe rules are you should wear glasses and not make you hand get to close to it.
Today I cut my wood the size it need to be so i could make my box
Biscuit Joiner
The biscuit joiner helps you assemble your stuff so it can fit nicely. Its one of the tools are teacher will let us use on are own.
We made these wholes in the wood so we could put the wood together.
CNC Machine
it uses input from CAD file to cut, or carve parts/pieces.
Orbital sander
Wear safety glasses. keep your sander moving at all time.
Lock Research
When wood staining you should wear clothes that can get messy and and use cotton cloth to apply stain
Things I need?
For this to work you need a couple of things such as a micro servo, Arduino UNO, finger printer scanner, 9v battery, a lock and sew.
How does this work?
when you scan you fingerprint and it is the right fingerprint the micro servo well move and it unsew the sew so it can move the lock handle.
For this 3D printed key lock you would need a couple different parts how this works is in the inside of the lock there are these parts the are exactly the size to fit the lock. In the video it shows if you put the wrong key it would not work because it is not fit the right way.
How these keypad lock works are you have a keypad with a code that you create when you are doing the coding and if it is the right code the lock should unlock. how the lock works are when you put in the right code the latch on the lock thing will move and push itself in so you can unlock it.
How this works is you will need to register a card into Arduino and for the lock part, it is a 3D printed lock you will need to 3D print there is a servo that you program to move back and forth at the right distance to open and close the 3D printed lock.
these are the pieces that i would need to make my lock they was five pieces that fit together.
How the lock works is the servo would be program to move when the right key is scanned and it well move the servo which well move the lock to open it.
This is my final lock video to the left of the screen.
This is the front panel of the lock the bigger whole is where the knob pieces go and the rotors go. the small whole is where the actuator goes.
This is an actuator. The actuator is the part that is holding the locking part together so when you put in the right combination it well lock.
This is the rotor. The rotors are the three look alike pieces that are on the dowel that rotates so the so you can unlock the lock.
Today in class I started trouble shooting my code I need to make for my box.
I finished my lock in class today :).