Because of Covid-19, we have started school virtually. My engineering teacher has put together kits for us to use so we can continue through hands on projects. This kit includes an A-B cable, arduino uno, continuous rotation servo screws and servo horns, a breadboard, ultrasonic distance sensor, HM-10 bluetooth module, AA battery holders (4), and 16 AA batteries.
We are going to include automation to make robots in this project.
Above are the steps we will use to guide us through this project. This project will prepare us for our next project.
Today we learned what circuit diagrams are. They are drawing of circuits which incorporate symbols to explain the tools being used. Above, the horizontal lines on the left represent the power source, the battery. On the right is the symbol used to demonstrate LEDs.
This closed circuit includes a battery and an LED. The battery powers the LED. We used Tinker CAD to make the simulation of this simple circuit.
This robot seems to have the same ultra sonic distance sensor as the one in our kits, it is located on the front. The arduino and wires sit behind the sensor and the breadboard is most likely on the belly. This robot is made out of legos, which is a good example to use for my research. Legos are items that are found scattered around my house.
This robot looks more advanced because of the metal frame at the bottom. But this robot contains a breadboard and arduino just like from the kit. To make this robot, I would need other tools which I do not have in my house.
This dainty little robot has the ultra sonic sensor as the eyes. The electronics are most likely inside the body which makes a clean, finished look. I can use cardboard from packages, to make a similar robot.
I have decided to build with legos to make my project like in this photo. I have legos at my house which I can use to make a similar model. I can also experiment with the legos to give the design more pazazz.
This is a two servo arduino picture we found, which we are basing our technology configuration off of.
This is the diagram I made in the circuit diagram editor website. The two circles with the m inside represent the motors. The large rectangle with the letters and numbers demonstrates the arduino.
This is a GIF I made of the configuration I have now. The arduino cord will end up being replaced by batteries so the robot can travel.
#include <Servo.h>// you will only need this line once, and it refers to a library that controls servos.
Servo myservo; // just defines a device called servo that is . controlled by the servo library.
Servo myservo2;
void setup() // this is where you set things up (only occurs once)
{
myservo.attach(9); // myservo is controlled by pin 9
myservo2.attach(10);
}
void loop() { // anything within void loop happens infinitely
myservo.write(0); // turn myservo clockwise at full speed
myservo2.write(180); // counterclockwise motion
delay(2000); // for two seconds
}
To the left you will see my lego robot prototype. The code tells it to move in a constant straight line. Below the GIF is an updated picture of the circuit. All of those electronics are fitted onto my robot.
I coded my robot to move in a box or plus format. This was practice to figure out how the robot responds to the code we program for the arduino. I also added cardboard wheels with hotglue around them to increase the grip on my wood floors. Below you will find the code.
void setup() // this is where you set things up (only occurs once)
{
right.attach(9); // myservo is controlled by pin 9
left.attach(10);
}
void loop() { // anything within void loop happens infinitely
right.write(0);
left.write(180);
delay (2000);
left.write(0);
right.write(180);
delay(2000);
left.write(0);
right.write(0);
delay(2000);
left.write(180);
right.write(180);
delay(2000);
}
My course plan to the right explains in which path I will code my robot to go. For my course plan, I am telling my robot to go to the fridge.
Forward
Short amount of time
Right
Short amount of time for a 90 degree turn
Forward
Long amount of time
Right
Short amount of time for a 90 degree turn
Forward
Short amount of time
Using the final code below I coded my robot, Fred or Freddie, to travel from my dining room to the refrigerator.
#include <Servo.h>
Servo right;
Servo left;
void setup() // this is where you set things up (only occurs once)
{
right.attach(9); // myservo is controlled by pin 9
left.attach(10);
}
void loop()
{
delay(2000);
right.write(0);
left.write(180);
delay(6000);
left.write(109);
right.write(100);
delay(3000);
right.write(0);
left.write(180);
delay(44000);
left.write(109 );
right.write(100);
delay(3000);
right.write(0);
left.write(180);
delay(10000);
right.write(90);
left.write(90);
delay(3000);
}
1) When my robot would travel down my hallway, it curved to the right, so I had to make the left wheel bigger. Making the left wheel bigger made it go faster.
2) When my robot completed its right tank turn, the robot would not turn all the way. Then the robot started moving much slower. I switched the wires from vin and the breadboard, and my robot began to move faster again. The problem was the servos burn more power than the arduino.
3) My robot is made of legos, so a few times my robot crumbled if I applied to much pressure when inserting a wire.
4) I had to revise my code many times to get the delays correct.
For this assignment, I coded my robot from instructions that my teacher gave me.
#include <Servo.h>// you will only need this line once, and it refers to a library that controls servos.
Servo right; // just defines a device called servo that is . controlled by the servo library.
Servo left;
void setup() // this is where you set things up (only occurs once)
{
right.attach(9); // myservo is controlled by pin 9
left.attach(10);
}
void loop() { // anything within void loop happens infinitely
left.write(0);
right.write(0);
delay(5000);
left.write(0);
right.write(180);
delay(5000);
left.write(90);
right.write(90);
delay(3000);
left.write(90);
right.write(0);
delay(3000);
right.write(0);
left.write(180);
delay(5000);
left.write(180);
right.write(180);
delay(8000);
left.write(0);
right.write(0);
delay(6000);
left.write(90);
right.write(90);
delay(2000);
}
This diagram shows how I will connect my ultrasonic sensor to my arduino, which is connected to my robot.
This image explains the mechanics of the ultrasonic sensor. This sensor measures distance. It releases an ultrasonic frequency which bounces off surfaces back to the sensor.
A function is a named command that executes a defined set of code. In other words, an action which is explained thoroughly, step by step through code. Below is an example.
void setup()
{
right.attach(9);
left.attach(10);
}
void Forward() {
right.write(0);
left.write(180);
}
void RightTankTurn() {
left.write(180);
right.write(180);
}
void loop()
{
Forward();
delay (6000);
RightTankTurn();
delay (3000);
Forward();
delay (44000);
RightTankTurn();
delay (300);
Forward();
delay (10000);
}
This GIF is an example of how the sensor works. I am holding a paper and as I get farther from the sensor with the paper, the distance increases. As I get closer, the distance decreases. Below is the code.
// defines pins numbers
const int trigPin = 2;
const int echoPin = 4;
// 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
}
void loop() {
// Clears the trigPin
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);
// Calculating the distance
distance= duration*0.034/2;
// Prints the distance on the Serial Monitor
Serial.print("Distance: ");
Serial.println(distance);
}
I moved the sensor to face the front, so when the robot is coded, it will sense the walls and boundaries.
This was an extra credit assignment. The robot had to move to the beat of the music.
You will make an awesome final body of your robot, it must be unique, creative and your own idea.
These are spider servo robots. They are all a little different. For the one above, I liked the googly eyes and the blockiness of it. The colors are very neat, and it looks partially 3D printed. My brother has a 3D printer, so I could execute this design.
The electronics are not covered on this spider robot. But the legs were very cool to me. I was thinking of adding the servos to two of the legs and adding a bigger body on top to hide the electronics.
This spider robot is very simple and I picked it because the electronics are hidden, and there are also wheels on it. So obviously, I want to pursue a spider design. They will most likely be a mixture of all three.
To the left, I have drawn three possibilities for the design of my robot. I decided to do a spider design because that seemed unique and fitting for this project. Below you can see that I decided to go with the bottom left design.
This is the final design chosen. I will 3D print a platform, legs, and a dome to enclose the electronics in. The electronics will fit underneath the dome, it will not be attached. The servos will go on opposite sides with little wheels on the other legs for balance. The servo will be on the top of the dome, where a little cutout will be for it to sit.
Above are three pictures explaining the two parts of the shell of my new robot design. The dome, I modeled off of my last year dodecahedron design, will cover the electronics and sit on top of the legs with the platform. The rectangles on the inside of the platform help keep the dome in place when it is on.
This is a picture of my wiring in my robot. All of this is located in the dome area, which is kind of like the head. The breadboard and Arduino fit inside of it with the battery packs glued to the top of the dome.
#include <Servo.h>
Servo right;
Servo left;
void setup() // this is where you set things up (only occurs once)
{
right.attach(9); // myservo is controlled by pin 9
left.attach(10);
}
// I WANNA DANCE WITH SOMEBODY
void loop()
{
left.write(180); //right turn
right.write(90);
delay(4000);
left.write(90); //left turn
right.write(0);
delay(4000);
left.write(180); //right turn
right.write(90);
delay(1000);
left.write(90); //left turn
right.write(0);
delay(1000);
left.write(180); //right turn
right.write(90);
delay(1000);
left.write(90); //left turn
right.write(0);
delay(1000);
left.write(90); //stop
right.write(90);
delay(800);
right.write(0); //front
left.write(180);
delay(500);
left.write(0); //back
right.write(180);
delay(500);
right.write(0); //front
left.write(180);
delay(500);
left.write(0); //back
right.write(180);
delay(500);
right.write(0); //front
left.write(180);
delay(500);
left.write(0); //back
right.write(180);
delay(500);
left.write(90); //stop
right.write(90);
delay(1000);
left.write(180); //right turn
right.write(90);
delay(4000);
left.write(90); //left turn
right.write(0);
delay(4000);
left.write(180); //short right turn
right.write(90);
delay(250);
left.write(90); //short left turn
right.write(0);
delay(250);
left.write(180); //short right turn
right.write(90);
delay(250);
left.write(90); //short left turn
right.write(0);
delay(250);
left.write(180); //short right turn
right.write(90);
delay(250);
left.write(90); //short left turn
right.write(0);
delay(250);
left.write(180); //short right turn
right.write(90);
delay(250);
left.write(90); //short left turn
right.write(0);
delay(250);
left.write(180); //short right turn
right.write(90);
delay(250);
left.write(90); //short left turn
right.write(0);
delay(250);
left.write(180); //short right turn
right.write(90);
delay(250);
left.write(90); //short left turn
right.write(0);
delay(250);
left.write(90); //stop
right.write(90);
delay(1000);
right.write(0); //front
left.write(180);
delay(500);
left.write(0); //back
right.write(180);
delay(500);
right.write(0); //front
left.write(180);
delay(500);
left.write(0); //back
right.write(180);
delay(500);
right.write(0); //front
left.write(180);
delay(500);
left.write(0); //back
right.write(180);
delay(500);
left.write(90); //stop
right.write(90);
delay(1000);
}
Design and build five functioning and engaging gears.
The gears should be engaging.
One of the gears should end up making a cool design when engaged.
The gears should be sandwiched into two pieces of acrylic.
Everything that needs to be printed should fit inside an 11 by 12 piece of wood.
5 different gears with unique designs.
The three photos above were pictures that inspired my designs for my gears. They are kinetic sculptures, when the parts spin and cross, they create beautiful designs.
These are some sketches of possible designs for my gears. I took durability, size, and appeal into consideration. The spider gear on the top left was a design I thought of in my engineering class in my middle school engineering class.
These designs were the first templates for my gears. I used Inkscape to create them. The bottom two big gears were too thin, and I was worried they would break so as you can see in the next picture, I make them thicker and adjusted the design.
This step consisted of arranging the gears so they would run smoothy and be appealing to look at. The biggest gear would have another gear going the opposite way to make a cool effect.
Making sure the holes fit was important because if the holes touched the edge or the area around the hol was too thin, the gear would break.
This was what my Inkscape document looked like previous to printing out the pieces. Because of Covid-19, I did not have access to my school to print this. Luckily, My engineering teacher had the laser printer at her house, she printed the pieces for me. I picked up the pieces and assembled them at my house.
After using the pieces to fit the gears between the acrylic, the gears were not running smoothly. I took it apart and started again. I ended up accidentally breaking the smallest gear and the long shaft. After re-printing, I finally got it right.
Using Inkscape we were prompted to make a face that would cut out from the laser cutter in one piece. I decided to make a detective or villain. It is up for interpretation.
I mostly used ellipses for the face. To make the mouth and eyebrows, I put an ellipse in to another and differenced them. This created the half circle effect. For the mustache, I grouped a bunch of ellipses together and differenced them from the face. For the nose, I differenced a small circle from the face and unified two smaller circles for the nostrils. I did the same for the eyes.
The hair is multiple ellipses joined together on both sides.
For the hat, I added a long skinny rectangle and a taller, larger rectangle. Then I differenced smaller shaped from the inside to create the outline effect.
During this step we started to go over the Inkscape software to become more familiar with the tools. We talked about keeping the pieces connected or else they would fall out when being printed by the laser cutter. Above you can see the small project we did, making faces on Inkscape. If you look closely at the eyes and nostrils, they are still connected to the cutout circle because if they weren't, the face would not have pupils or nostrils at all. The main tools used are align and distribute, difference, group, and union.
We made this gear as a class to get familiar with Inkscape.
First, I created two small ellipses. Next, I made another ring, except it was more of an oval and I cut it in half. Then, I joined the half circle and two ellipses. After that, I got two smaller circles and differenced them with the ellipses I already made. Then, I had to make more of that design. So I went to create tiled clones and put in my desired amount and degrees. I joined the six designs together to make one piece and added a larger circle in the middle to make it more stable. I then moved over to my gear and differenced a large circle from inside it. Finally, I fit the design inside the gear, joined it together and differenced the hole for the axel.
Create ellipse
Allign/distribute ellipse horizontally and vertically to gear
Create interesting shape with stars/polygon function
Select the ellipse --> path --> path effects --> + --> object to path
Copy your interesting shape
Paste on path on clipboard
Select repeated stretch
Fix to be desired shape
Select revolved shape pattern and gear --> path --> difference
For this step, I sketched a lot of gears in my notebook and played around with designs on Inkscape. It is important to make the designs centered in the gear so that when you make a center hole for the gear, it is not lopsided. It was good to practice with inkscape because we can make our designs on inkscape to see if they fit the constraints and have an aesthetic appeal.
The motors on the opposite side of the cloudy plexi glass are turning the tri cams. The cams are turning in a rotational motion, a smaller wheel like piece of plexi glass is engaging with the tri cam, following the edge. When the cam rotates, the mechanical slot on the back of the object guides the shafts to go up and down, or into a linear motion. Gravity pulls the shaft down to the small indents in the cam which brings it down, and the taller parts push the shaft upwards. All this is what makes the numbers move.
The drive shaft, or hand crank turns the drive gear. 2 gears are touching the drive gear, the gear to the left of the drive gear turns the bottom layer of the biggest gear. The gear to the right of the drive gear turns another gear which turns the top layer of the biggest gear. Having 2 different gears turn 2 layers allows the biggest gear to turn in opposing directions creating a cool design effect.
Today we were required to plan our final project using the items in our kits. First we had to decide which direction we were going. I decided to pursue the advanced option. That is one opposing gear and cams.
For this step, all of us picked up gears that did not have designs in them and worked on our layouts on cardboard. This gives us an idea on what size gears we need and how many. My layout changed a little bit to fit within the size constraint of the acrylic, but it mainly stayed the same. Below you can see how my final digital file compares to my original layout.
This is how my gears will fit once everything it cut out.
The pink is acrylic, which will act as the casing to my gears. The two holes on the left piece of acrylic are the holes for the electronic sensor. The yellow areas are the sheets of wood from which the gears and other trinkets will be cut from. At the top you can see an additional piece of acrylic, that will not be cut out but it shows the layout of my gears.
/* Control Speed of a DC Motor from serial monitor
More info: http://www.ardumotive.com/how-to-drive-a-dc-motor-with-transistor.html
Dev: Vasilakis Michalis // Date: 13/7/2015 // www.ardumotive.com */
//Transistor 'Base' pin or input pin of motor driver ic to Arduino PWM Digital Pin 3
const int motorPin = 3;
int Speed; //Variable to store Speed, by defaul 0 PWM
int flag;
void setup()
{
pinMode(motorPin, OUTPUT); //Set pin 3 as an OUTPUT
Serial.begin(9600); //Init serial communication
//Print a message:
Serial.println("Give a number from 50 to 255."); //Why minimun value 50? Because with values below 50 the motor doesn't spin ;)
Serial.println(""); //Blank line
}
void loop()
{
//Check if incoming data is available:
if (Serial.available() > 0)
{
// If it is, we'll use parseInt() to pull out only numbers:
Speed = Serial.parseInt();
flag=0;
}
//Valid range is from 50 to 255
if (Speed>=50 && Speed<=255){
//Send PWM value with analogWrite to Arduino pin 3 and print a message to serial monitor
analogWrite(motorPin, Speed);
//Print message only once
if (flag==0){
//Print PWM value
Serial.print("Motor spinning with ");
Serial.print(Speed);
Serial.println(" PWM");
flag=1;
}
}
delay(1000);
}
//
This step is tedious because often times, you have to rework your configuration a couple of times. It took me a while to put my gears together with the correct amount of spacers. I also had to reprint gears because they broke after being put in wrong. It also took a few tries putting the acrylic on top because it has to be rolled on. Often my gears got stuck and I had to take the acrylic off to re configure them, a lot of hot glue was used.
const int motorPin = 3;
int Speed; //Variable to store Speed, by defaul 0 PWM
int flag; //Variable to store Flag
const int trigPin = 9; //defines the pin that sends the pulse
const int echoPin = 11; //defines the pin that receives the pulse
long duration; //defines variable for how long it takes for the sound to return
int distance; //defines variable for distance away
void setup()
{
pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
pinMode(echoPin, INPUT); // Sets the echoPin as an Input
pinMode(motorPin, OUTPUT); //Set pin 3 as an OUTPUT
Serial.begin(9600); //Init serial communication
//Print a message:
Serial.println("Give a number from 50 to 255."); //Why minimun value 50? Because with values below 50 the motor doesn't spin ;)
Serial.println(""); //Blank line
}
void loop()
{
// Clears the trigPin
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);
// Calculating the distance
distance = duration * 0.034 / 2;
// Prints the distance on the Serial Monitor
Serial.print("Distance: ");
Serial.println(distance);
//Check if incoming data is available:
// if (Serial.available() > 0)
// {
// // If it is, we'll use parseInt() to pull out only numbers:
// Speed = Serial.parseInt();
// flag = 0;
// }
//Valid range is from 50 to 255
if (distance <= 10);
{
//Send PWM value with analogWrite to Arduino pin 3 and print a message to serial monitor
Speed = 100;
analogWrite(motorPin, Speed);
// Place additional code here to make your motor have at least 5 speeds.
}
Serial.print("Motor spinning with ");
Serial.print(Speed);
Serial.println(" PWM");
// flag = 1;
}
Because of time constraints and my complicated design, we had to post pone the sensor and motor component of my gear box. The sensor worked great, and the motor did spin but the motor did not have enough power to turn all my gears.
We decided to keep the project as is with the hand crank!
This is the best part of the project because you can sit back and admire the beauty of your project! A big part of production is craftsmanship, fine tuning all the parts to make them look squeaky clean and work as it is supposed to. In the video, you can see how smoothly my gears are running, with the exception of a few jerky turns. You can also see that there is no visible glue or parts to make it look like it is still in the testing process.
The school year of 2020-2021 was the year during the pandemic Covid-19. This year was tough because we did not get the in person instruction as we normally do so we had to execute our projects on our own. But we managed to build 2 really cool projects like the robot and gear box! The most challenging part of this year was trying to explain and understand the projects over zoom. I am a tactile learner so seeing the prompt through the screen without a concrete example was hard for me. In the end, I am proud of how motivated I have stayed during this school year but also these projects. This includes the end result of my robot, my GHP application, and both gear boxes I made. There were times where I was severely frustrated but I persevered!