We started the 2020-2021 school year virtually, but that did not stop us from having an engineering project. The items we will be using are, A-B Cable, Arduino Uno, Continuous Rotation Servo with Servo, Screws and Servo Horns, Breadboard, Ultrasonic Distance Sensor, HM-10 Bluetooth Module, AA Battery Holders (4), and AA Batteries. Using these tools will allow us to have a full fledged engineering project from home! The project that we will be doing is creating a free moving robot. This robot will be able to roll using wheels and will be made up of household materials such as cardboard. We will use the products to the left in order to code and get the robot working. Some other activities that it may be able to accomplish are to detect when something is close and be able to connect to a phone or other device that is Bluetooth compatible.
First project planning period: circuit diagrams and circuit pictures.
https://drive.google.com/open?id=1Dyizzm69Qo3RJNq8urusw_2N3vNpDL3s3qB6dplk2os&authuser=2
The first robot is a rolling robot that is processed using a motherboard and Arduino. This robot is pretty simple as it has an servo that is free rolling. this also looks like the base is metal
This second robot is also a rolling robot as it can roll on its own using code. This looks like it has a plastic base and it has an extra wheel on the front as well. This also has a battery pack on the back. This is powered by an Arduino as well.
This robot is also a free rolling robot. As you can see, in the front you can see eye like sensor which is a distance sensor. This will detect how far an object is and will stop or turn at the designated object. This is also powered by an arduino uno as with the other robots. On the sides are also servos which are seen by the wheels. This will allow the robot to move to preform the code.
This a picture of the circuit picture that we used in order to wire and make the robot preform actions.
This is a image of a circuit diagram. This shows the wires and the certain colors used to connect to the Arduino. This gives us a way to tell where to put the wires into which places.
I coded my robot to do multiple 360 turns in a single turn. This code was fairly simple as it was one of the first codes that we learned. My code include the left servo going clockwise while the right servo is going counterclockwise. This is my code listed below:
#include <Servo.h>// you will need this line once, and it refers to a library that controls servos.
Servo myservo;
Servo myservo2;//just defines a device called servo that is controlled by the servo library
void setup()// this is where you set things up(only occurs once)
{
myservo.attach(9); // myservo is controlled by pin 9
myservo.attach(10);
}
void loop() { // anything within void loop happens indefinitely
myservo.write(0); // turn myservo clockwise at full speed
delay(2000); // for two seconds
myservo.write(180); // turn myservo clockwise at full speed
delay(2000); // for two seconds
}
This is a image of a circuit diagram. This shows the wires and the certain colors used to connect to the Arduino. This gives us a way to tell where to put the wires into which places.
This a picture of the circuit picture that we used in order to wire and make the robot preform actions. Unlike the first picture, this one uses batteries as the power source.
Forward
short amount of time
Turn right short amount of time
Forward
short amount of time
right
make a right 90 degree turn
forward medium amount of time
When I plugged in my robot to try to code it, it would run perfectly. Later when I removed the charger and put it with batteries, the code would not preform. After a number of attempts, my robot would still not work. All it took was for me to change the wiring and it worked with the charger. Unfortunately, this did not change the outcome when pairing with batteries. I will continue t figure out this problem.
2. When I first made my robot, it was all flat and the carboard did not fit any of my parts. This was a big problem so i figured that I put my Arduino and servos on the bottom and I will attach another piece of carboard upright where I will put my breadboard. This has helped me a lot as I have more space to wire. This also gave me balance for my Servos.
3.When I ran my first code, my computer would not recognize my Arduino. This was a major problem because if my computer could not recognize the Arduino, the code would not transfer to the Arduino. This ultimately resulted in me changing the Arduino entirely. The problem was solved almost immediately. It was a night and day comparison from the two Arduino.
4. On one of the first days in class, we went through our materials to make sure we had everything we needed to be successful in this project. I quickly relied that I had only 3 working battery packs and not 4. This was a big problem as if I had 3 battery packs, my robot would not receive the power it needed in order to work. This later resulted in my teacher stopping by and dropping off another battery pack.
After the weekend, my robot had a small problem where there was something stuck in between the 5v port, which is he port that would power the robot. So I fixed the solution and manually put the wire onto a piece of the Arduino where it can still work and run the code. It is not the biggest problem but it is definitely an inconvenience
#include <Servo.h>
Servo Right;
Servo Left;
void setup()
{
Left.attach(9);
Right.attach(10);
}
void loop() {
Right.write(180); //striaght
Left.write(0);
delay (3000);
Right.write(90);//right turn
Left.write(180);
delay (2000);
Right.write(180);//striaght
Left.write(0);
delay (3000);
Right.write(90);//right turn
Left.write(180);
delay (2000);
Right.write(180);//go straight
Left.write(0);
delay (3000);
}
I had a path in an "L" shape in which the robot would go straight for 3 seconds, would make a right turn for 2 second then repeat it going straight for 3 seconds.
In class we labelled our wires in order to cause less confusion. The picture the the right is my robot and battery pack with the new labelled wires.
The ultra sonic sensor will be connected by the pins on the white breadboard to the right. There are also wires that are required to connect the sensor to the Arduino in order to make a connection.
This is the link to the source: https://www.studentsheart.com/interface-ultrasonic-sensor-hcsr04/
the ultrasonic sensor is a module that is no contact. This means that the sensor can detect things In front of the module at a minimum of 2cm and a maximum of 4m This can be powered from a 5v power supply. The measuring angle is at 15 degrees as well.
Today, My teacher wanted to give us a quiz in which she would give us a pseudo code, in which she would tell us the direction it needs to take and we would figure out the code. Here is my pseudo code:
180 degree tank turn to the left
Backwards for 5 seconds
Stop for three seconds
90 degree standard turn to the left
Forward for 5 seconds
Extra credit: Tank turn to the right then tank turn to the left
#include <Servo.h>
Servo Right;
Servo Left;
void setup()
{
Left.attach(9);
Right.attach(10);
}
void loop() {
Right.write(0); //Left Tank
Left.write(0);
delay(2000);
Right.write(0); //backward for 5 seconds
Left.write(180);
delay(5000);
Left.write(90);//stop for three seconds
Right.write(90);
delay(3000);
Left.write(90);//turn to the left 90 degrees.
Right.write(0);
delay(2000);
Right.write(180); //forward seconds
Left.write(0);
delay(5000);
Left.write(180);//right tank turn
Right.write(180);
delay(3000);
Left.write(0);//left tank
Right.write(0);
delay(3000);
}
Our teacher gave us the following instructions to do during the day:
Move your breadboard to the front of your robot so that the parallel lines on the breadboard are going across the robot from left to right (they can't be going diagonal or from front to back. If you don't want to move around your robot parts, you can come to my house and get some "male-female" connectors (everyone is going to need them eventually) anyway. Set up your robot so that the "eyes" face towards the front and are located in a location on your robot where nothing is in front of them. If you are using the male-female connectors, attach / mount your "eyes" facing forward on the front of your robot somehow (temporarily). DO NOT GLUE IT, but you can tape it (the tape can't go over the "eyes). It needs to be firmly attached to the front of your robot. Make sure it is still wired and working.
The video shows my robot moving autonomously , or by it's self. This video shows to capability of the robot and the ultrasonic sensor. The wall which is represented by my hand shows that when the ultrasonic sensor comes within around 10 centimeters of an object, the robot will move backward, moving away from the object.
Video of my robot receiving distance readings.
#include <Servo.h>
Servo Left;
Servo Right;
const int trigPin = 5;
const int echoPin = 6;
// defines variables
long duration;
int distance;
void setup() {
// put your setup code here, to run once:
Left.attach(9);
Right.attach(10);
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 Forward() {
Left.write(180);
Right.write(0);
}
void Lefttankturn() {
Left.write(0);
Right.write(0);
}
void Righttankturn() {
Left.write(180);
Right.write(180);
}
void Backward() {
Left.write(0);
Right.write(180);
}
void loop() {
// put your main code here, to run repeatedly:
// 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);
if (distance < 10) {
Backward();
delay(1000);
Righttankturn();
delay(1000);
}
else(Forward);
}
This is a description of the Link of the circuit picture: The Bluetooth module works on serial communication. This Bluetooth module works with an android app. To work the android app, you must first download the app. Pair your device to the Bluetooth module. Install the LED app on your phone, and then open the LED application. Afterwards, there will be a button, either saying turn on or off. You can turn the led on or off. Link:https://create.arduino.cc/projecthub/mayooghgirish/arduino-bluetooth-basic-tutorial-d8b737
circuit picture of ultrasonic sensor
the item in the top left hand corner is the ultra sonic sensor, to the left is the arduino uno, and underneath the ultrasonic sensor. The ultrasonic sensor detects walls or other items in the way. Based on the code that
#include <Servo.h>
Servo Left;
Servo Right;
const int trigPin = 5;
const int echoPin = 6;
// defines variables
long duration;
int distance;
void setup() {
// put your setup code here, to run once:
Left.attach(9);
Right.attach(10);
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 Forward() {
Left.write(180);
Right.write(0);
}
void Lefttankturn() {
Left.write(0);
Right.write(0);
}
void Righttankturn() {
Left.write(180);
Right.write(180);
}
void Backward() {
Left.write(0);
Right.write(180);
}
void loop() {
// put your main code here, to run repeatedly:
// 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);
if (distance < 10) {
Backward();
delay(1000);
Righttankturn();
delay(1000);
}
else(Forward);
}
Getting ready for school
Wake up
Brush my teeth
Wash my face
Eat breakfast
Get ready for class
Go to class
function call
If I wake up on time and do everything in a good pace, I will more than likely be ready and on time for class, else, I will be late for class and will be off schedule all day
A function gives a code steps to complete them in. A real life example is making a sandwich. First, get your ingredients, spread mayonnaise on bread, top toppings in between the bread, and enjoy.
An example for a robot would be to go forward, go backward, turn left, and do a tank turn right. These words tell you what the robot is going to do. The function would be a name called do a "Journey"
The grey wors to the write explain what the function is step by step. They colored words are the actual code, in which the robot will listen too and complete
To end the semester, our teacher decided to let us choose what we could improve. A, which was to make the robot look more aesthetically pleasing. Or B, add a Bluetooth module onto the robot. I came to the conclusion that I wanted to do the second option which was to make add a Bluetooth module so I could possibly connect the robot to my phone
The is the wiring for my Bluetooth module, the only changes I changed the 5v port to the red port.
This is the best and easiest video I have found. It is very difficult finding a video that it simple but yet shows you everything.
This is a website that I found that seems pretty simply and gives a step by step of what to do. It is just difficult using an iphone as pretty much every other video is an android
This Bluetooth module is blinking the signifies that the module is working and is ready. And when connected to the certain app, the Bluetooth module will be solid red. This as occurred but I have had problems finding code and controlling the robot. The video below will show the robot being looked for a Bluetooth device, and the other video with show the light showing solid red meaning that it has found a connection.
#include <SoftwareSerial.h>
#include <Servo.h>
SoftwareSerial mySerial(0, 1); // RX | TX
Servo servo;
int servoPin = 9;
int servoAngle = 0; // servo position in degrees
char command;
void setup() {
Serial.begin(9600);
mySerial.begin(9600);
Serial.println("You're connected via Bluetooth");
servo.attach(9);
}
void loop() {
if (mySerial.available())
{
command=(mySerial.read());
if (command=='1')
{
Serial.println("Servo motor to 10 degrees");
servo.write(160);
delay(2000); // Wait for 2000 millisecond(s)
servo.write(70);
delay(2000); // Wait for 2000 millisecond(s)
servo.write(20);
delay(2000); // Wait for 2000 millisecond(s)
}
else if (command=='0')
{
Serial.println("Servo motor to 120 degrees");
servo.write(120);
delay(500);
}
}
}
#include<SoftwareSerial.h>
#include <Servo.h>
Servo myservo;
SoftwareSerial mySerial(2, 3); // RX, TX
int Position ;
void setup()
{
myservo.attach(11);
mySerial.begin(9600);
Serial.begin(9600);
}
void loop()
{
if(mySerial.available()>0)
{
Position = mySerial.read();
Position = map(Position, 0, 180, 180, 0);
myservo.write(Position);
}
}
This is a video of me successfully controlling my robot with my phone
Video and explanation about my Bluetooth robot
#define CUSTOM_SETTINGS
#define INCLUDE_GAMEPAD_MODULE
#include <Dabble.h>
#include <Servo.h>
Servo Left;
Servo Right;
int a = 180;
int b = 0;
int c = 200;
void setup() {
// put your setup code here, to run once:
Left.attach(9);
Right.attach(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() {//define forward
Left.write(180);
Right.write(0);
}
void Leftturn() {//define left tenk turn
Left.write(80);
Right.write(0);
}
void Rightturn() {//define right tank turn
Left.write(180);
Right.write(100);
}
void Backward() {//define backward
Left.write(0);
Right.write(180);
}
void Adjustspeed() {
}
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");
Left.write(180);
Right.write(0);
delay(150);
}
else {
Left.write(90);
Right.write(90);
}
if (GamePad.isDownPressed())
{
Serial.print("DOWN");
Left.write(0);
Right.write(180);
delay(150);
}
else {
Left.write(90);
Right.write(90);
}
if (GamePad.isLeftPressed())
{
Serial.print("Left");
Left.write(90);
Right.write(0);
delay(150);
}
else {
Left.write(90);
Right.write(90);
}
if (GamePad.isRightPressed())
{
Serial.print("Right");
Left.write(180);
Right.write(90);
delay(150);
}
else {
Left.write(90);
Right.write(90);
}
if (GamePad.isSquarePressed())
{
Serial.print("Square");
}
if (GamePad.isCirclePressed())
{
Serial.print("Circle");
}
if (GamePad.isCrossPressed())
{
Serial.print("Cross");
}
if (GamePad.isTrianglePressed())
{
Serial.print("Triangle");
Left.write(180);
}
else {
Left.write(90);
}
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();
}
Questions we will answer throughout the project.
goal of our project
how do i make the mechanical motion into something cool
In inkscape, we were told to make a face that would be cut all into one piece. For the face, all of parts of the face, is made up of simple parts. The nose was very simple as I used ovals and circles to make the size of a nose.
In class we made this gear to get familiar in inkscape. One thing that I would change would be to group it all together versus having it two different items. Also I would add something in the middle to connect and group it all together.
My second gear-brainstorm and analyze
This is my second gear where I took squares and circles. Then, I would make a shape and do the path difference command. This would ultimately create the shape that you see here and after, I would group it and did the object to path command.
I did the following steps:
Create ellipse
Align/distribute to put it in the center
create your shape
select he shape, then go to path, path effects, and object to path
copy the shape
paste it on the inkscape
fix it to be a desired shape
select the shape pattern and then go to gear and do the path difference command
This sculpture has the following:
Drive shaft
drive gear
layers
opening directions
This sculpture is powered by MS white's hand as she is turning the crank on the gear causing the sequence to move. It looks like the biggest gear is moving because she has two layers on the body of the gear. one layer of the body is going clockwise and the second layer oft he biggest gear is going counter clockwise to create an illusion. The drive gear has all three layers of the gear. The second biggest gear is controlling the farthest layer of the gear
video link:
https://twitter.com/i/status/1308085269745356800
This video shows i sculpture made by someone in which you can tell time with led light while they are going up and down. This is moved by cams which are the triangular pieces at the bottom. This is moving in a linear motion, which is going up and down.
This is a video explaining my gears showing how two of the gears move in the same direction and also how one gear moves at 1/2 of the speed of another gear
this is a picture of my functioning prototype for our kinetic sculpture
We have been putting work into or cardboard prototype. The carboard prototype above is functioning like how I would like my sculpture. The only downside is that some of the calculations are off and do not work as they should. In the middle I plan on the gears to be going in the opposite direction, making for a cool design and look. This is apart of the improve your design portion as I have changed and learned for the final design.
This is a approved gear. In the top right hand corner, is the drive gear, which would control the full gear. In the bottom middle, are the smallest two gears. These gears would move in opposite directions of each other. They will make for a good "illusion", This apart of the development as this helped me create the wooden gears in real life.
Circuit diagram-development
Video of circuit motor
This circuit diagram is apart of the development in the engineering design process. Doing steps like these were I would make diagrams would help me prepare for the final project.
Th is ultrasonic sensor diagram is also apart of the development step. This helped me bring my diagram to life as you can see with the final project
Brainstorm- You want to find some solutions to this problem. In this case look for some ideas that you could put into your project
Plan- make a blueprint for your project. We did this by making and practicing inkscape
Create- You want to follow your plan and built what you have designed. We designed the wooden gears in our case.
Test- Make sure the design works and if it does not meet the constraints, make your design better
Share- Show and present your design
This is an example of the science in ultrasonic sensor. The detected object will show on the ultrasonic sensor and based on the code, the ultrasonic sensor will preform a task based on the distance. Some include a motor moving or a servo will move .
This project incorporates technology from the wires, to the Arduino uno, and the sensor. This project is one of the most technology based we have ever used
This project uses the engineering design process. We have used this throughout every project we have had. This was the best way for us to stay organized during this school year
We used arts and math as we had to construct a unique design for our gears project. Also we had to calculate how and where this would fit in order to have a full rotation and control of the gear
This school year was the year of covid. The most challenging part of engineering by far was going to get supplies when something broke. Before covid, the only thing we had to do was ask our teacher who was in the classroom, now we have to contact a teacher, meet on zoom, and hope that we figure out the problem within the time. This was definitely a setback of our engineering class. In the end, i am proud of my project accomplishments. i was able to complete a remote controlled robot and also a motion detected gear simulator. I am very proud of these projects especially during this year of zoom.
This looks like a very good claw. I like the claw shape and the arm aswell
This arm claw is my inspiration. I like the joints in the arm and the claw shape