Engineering Applications Bag 1
This is a kit that contains multiple engineering components. We will use these components to build a robotic arm.
Circuit Diagram
We created circuit boards using an online tool. A circuit diagram is a visual representation of all of the parts and connections in a circuit. This will better help us when we work on real circuit boards in the future.
Circuit Picture
We created circuit pictures. This allows us to see how different pieces connect. This can be very beneficial for when we put the actual pieces together because we already know what to do.
Draw bots
There are many types of Draw bots. Some are used on vertical surfaces, some can laser engrave images, and some can even draw on eggs. The one thing that all of these devices have in common are how they work. They all use multiple motors and servos to move with great precision. In order for these servos and motors to operate, they are connected to a device that relays code to them. In the end you have a bot that draws accurately.
Drawbot 1
This Drawbot is very simple. There is an Arduino that is connected to two servos via wiring. Each servo is connected to a string. The ends of the strings are connected to a contraption that holds a pen or marker and allows them to rotate using bearings. Using the Arduino software, code is uploaded to the Arduino which makes the servos rotate in a fashion that creates a nice image.
Drawbot 2
This Drawbot does not have an arduino present on the build but we could still make something similar. There are cables that go from a computer into the machine that relay code which is what allows it to move in a certain pertain to create images. There is a power supply on the left which powers everything. One servo is at the base and is used to move the entire arm. There is a second servo at the end of the arm that is connected to the first via to metal strips. It rotates what I would consider the hand and allows for the creation of the more precise parts of the drawings. The second servo holds the marker via another metal strip.
The Plan
I have chosen this drawbot as the direction I want to go in. I have done this for quite a few reasons. For one, it is extrememly simple and requires a small amount of parts. Another reason is these parts are available to me. The final reason is this is achievable with the way our parts work.
Circuit Diagram
This is a visual representation of my two servos. It shows the many wires that stem from the Arduino. The wires are color coded such as the black wires which go to gnd.
Circuit Picture
This is another visual representation that represents my two servos. However, this one is more realistic to how it will actually look. The drawback is it is harder to understand which is why we make both the circuit picture and circuit diagram.
Two Servos Moving and Code
This video shows the code below in action controlling the two servos.
#include <Servo.h>
int servoPin = 3;
int servoPin2 = 4;
Servo Servo1;
Servo Servo2;
void setup() {
// We need to attach the servo to the used pin number
Servo1.attach(servoPin);
Servo2.attach(servoPin2);
}
void loop(){
// Make servo go to 0 degrees
Servo1.write(180);
Servo2.write(20);
delay(1000);
// Make servo go to 90 degrees
Servo1.write(160);
Servo2.write(0);
delay(1000);
// Make servo go to 180 degrees
Servo1.write(140);
// Make servo go to 180 degrees
Servo2.write(20);
delay(1000);
}int redPin = 11;
int greenPin = 10;
int bluePin = 9;
The Three Patterns
This is a video of me explaining the three patterns.
Project Brief
In the project brief, we get an understanding of what the project is or what the problem is. Our teacher gave us the project brief when she explained what we were trying to create.
Research
During research you must conduct client interviews and understand competitive products. We researched many drawbots to get an idea of what we wanted to make.
Idea Development
During this, you brainstrom potential solutions, sketch ideas, and narrow feasability. This is where we finalized what types of drawbots we could make.
3D Prototyping
This is where you create multiple physical or electronic models of potential solutions. We created prototype drawbots during this phase.
Evaluation and Testing
You get feedback from colleagues and clients, assess aesthetics and functionality of prototype. We showed our videos of our drawbots and got feedback.
Production
Finally you create the final product/solution out of real materials and implement it. We will create our final drawbots.
Robotic Arm with 4 Servos
This is a robotic arm that contains 4 servos. The bottom one rotates the arm. The middle two control the crane mechanism and the top servo controls the claw.
Circuit Picture
This is a cicruit picture representing the arm.
Robotic Arm with 4 Servos
This is a robotic arm that contains 4 servos. The bottom one rotates the arm. The middle two control the crane mechanism and the top servo controls the claw.
Circuit Picture
This is a cicruit picture representing the arm.
Robotic Arm with 4 Servos
This a robotic arm with the bottom servo rotating the arm, the middle one controlling the crane mechanism, and the top two controlling the specific and precise motions of the claw mechanism.
Circuit Picture
This is a cicruit picture representing the arm.
Parts
These are the parts that we will use to build our robots.
Assembled Base
This is the base of our robot. There is a large bottom piece that is used to hold up the base that the two side pieces that contain slots for servos are inserted into. There are two pieces on either side to hold the servo pieces up.
Calibrated Servos
We put in code to make each servo rotate slowly. This was a text to make sure our servos were calibrated.
Robot Build Progress
This is our progress on our robot. We added a metal rod to connect the two servos and placed spacers and other pieves on the rod. We added another metal rod to connect to the previous one with spacers and more wood pieces.
Forward and Back
This is a video of my robot arm moving forwards and backwards. There is a servo in the side of the box which controls certain actions of the arm. It was coded to do this.
#include <Servo.h>
Servo Left;
Servo Right;
int Leftpos= 0;
int Rightpos = 0;
void setup() {
Left.attach(3);
Right.attach(4);
}
void loop() {
for (Rightpos = 0; Rightpos <= 90; Rightpos += 1) {
Right.write(Rightpos);
delay(15);
}
delay(3000);
//this is back
for (Rightpos = 105; Rightpos >= 0; Rightpos -= 1) {
Right.write(Rightpos);
delay(15);
}
delay(5000);
}
Up and Down
This is a video of my robot arm moving forwards and backwards. There is a servo in the side of the box which controls certain actions of the arm. It was coded to do this.
#include <Servo.h>
Servo Left;
Servo Right;
int Leftpos= 0;
int Rightpos = 0;
void setup() {
Left.attach(3);
Right.attach(4);
}
void loop() {
for (Leftpos= 0; Leftpos<= 90; Leftpos+= 1) {
Left.write(Leftpos);
delay(15);
}
delay(3000);
for (Leftpos= 55; Leftpos>= 0; Leftpos-= 1) {
Left.write(Leftpos);
delay(15);
}
delay(5000);
}
Base Moves Left and Right
This is a video of my robot arm's base moving left and right. There is a servo inside of the box connected to the base platform which allows the entire arm to move. It was coded to do this.
#include <Servo.h>
Servo Base;
int Basepos= 90;
void setup() {
Base.attach(5);
}
void loop() {
for (Basepos = 0; Basepos <= 1800; Basepos += 1)
{ Base.write(Basepos);
delay(15);}
delay(1000);
for (Basepos = 180; Basepos <= 0; Basepos -= 1)
{ Base.write(Basepos);
delay(15);}
delay(1000);
}
The Claw
This is the claw. There is a servo in the center that controls both claw pieces by being attached to one and having them connect via a wooden cog piece.
Fully Functioning Robot
This is my fully functioning robot. There are 4 servos inside of it. The one at the base controls how the arm rotates to the left and right. There are two servos which control how the arm bends. Finally, there is a servo at the top which controls the claw. Unfortunately, the claw servo stopped functioning properly so I was unable to show the arm picking something up but everything else worked smoothly.
#include <Servo.h>
Servo Left;
Servo Right;
Servo Base;
Servo Claw;
int leftpos ;
int rightpos;
int basepos;
int clawpos;
void setup() {
Left.attach(D3);
Right.attach(D4);
Base.attach(D5);
Claw.attach(D6); }
void loop() {
Claw.write(45);
delay(1000);
Base.write(180);
delay(1000);
Right.write(115);
delay(1000);
Left.write(40);
delay(1000);
Claw.write(45);
delay(1000);
Claw.write(90);
delay(1000);
Left.write(130);
delay(1000);
Right.write(70);
delay(1000);
Base.write(60);
delay(1000);
Right.write(110);
delay(1000);
Left.write(110);
delay(1000);
Claw.write(45);
delay(1000);
}
Robot successfully making repetitive movements
Unfortunately, the claw servo stopped functioning properly so I was unable to show the arm picking something up but everything else worked smoothly. I was able to make the robot start on one end touching the ground and make it lift up, rotate to the other side and touch the gorund again.
#include <Servo.h>
Servo Left;
Servo Right;
Servo Base;
Servo Claw;
int leftpos ;
int rightpos;
int basepos;
int clawpos;
void setup() {
Left.attach(D3);
Right.attach(D4);
Base.attach(D5);
Claw.attach(D6); }
void loop() {
Claw.write(45);
delay(1000);
Base.write(180);
delay(1000);
Right.write(115);
delay(1000);
Left.write(40);
delay(1000);
Claw.write(45);
delay(1000);
Claw.write(90);
delay(1000);
Left.write(130);
delay(1000);
Right.write(70);
delay(1000);
Base.write(60);
delay(1000);
Right.write(110);
delay(1000);
Left.write(110);
delay(1000);
Claw.write(45);
delay(1000);
}
Circuit Picture
This is a circuit pucture that I created to represent my robot. In the picture, each red wire is 5V and each black wire is GND. The other wires are the ones that go to the certain pins that allow the whole robot to function.
Circuit Diagram
This is a circuit diagram that I created to represent my robot. In the diagram, the red wires on the left are 5V and the black wires are GND. The colorful wires on the right are the ones that go to the certain pins that allow the whole robot to function.
Real Life Functions
A function is something that instructs something to perform a task to get a certain result. A real life example of a psuedo code of a function could be found in the culinary arts. Recipes instruct you to perform a task that gives a certain result. For example, Making a Sandwich:
Function Definition:
Place bread
Add mayo
Add Ham
Add Cheese
Robot Code with Function Code
#include <Servo.h>
Servo Left;
Servo Right;
Servo Base;
Servo Claw;
int leftpos ;
int rightpos;
int basepos;
int clawpos;
void setup() {
Left.attach(D3);
Right.attach(D4);
Base.attach(D5);
Claw.attach(D6); }
void loop() {
Claw.write(45);
delay(1000);
Base.write(180);
delay(1000);
Right.write(115);
delay(1000);
Left.write(40);
delay(1000);
Claw.write(45);
delay(1000);
Claw.write(90);
delay(1000);
Left.write(130);
delay(1000);
Right.write(70);
delay(1000);
Base.write(60);
delay(1000);
Right.write(110);
delay(1000);
Left.write(110);
delay(1000);
Claw.write(45);
delay(1000);
}
Jingle Bells
We decided in class that we would use the next several class periods to refine our coding skills by getting our robots to dance to jingle bells. I was able to successfully obtain a new servo and install it into my robot.
Robot Dancing to Jingle Bells
This is my robot dancing to jingle bells. During during different parts of the song, different servos are moving in the same rythm. There are points where the arm is dancing and points where the claw is dancing. In all of these instances, the robot and the song are in sync.
#include <Servo.h>
Servo Left;
Servo Right;
Servo Base;
Servo Claw;
int leftpos = 90;
int rightpos = 90;
int basepos = 90;
int clawpos = 75;
void setup() {
Left.attach(3);
Right.attach(4);
Base.attach(5);
Claw.attach(6);
}
void loop() {
Claw.write(75);
delay(1000);
for (rightpos = 90; rightpos >= 70; rightpos -= 1) { //
Right.write(rightpos);
delay(15);
}
delay(1000);
for (leftpos = 90; leftpos <= 130; leftpos += 1) {
Left.write(leftpos);
delay(15);
}
delay(1000);
Base.write(100);//left
delay(100);
Base.write(80);//right
delay(100);
Base.write(100);//left
delay(100);
Base.write(80);//right
delay(100);
Base.write(100);//left
delay(100);
Base.write(80);//right
delay(100);
Base.write(100);//left
delay(100);
Base.write(80);//right
delay(100);
Base.write(100);//left
delay(100);
Base.write(80);//right
delay(100);
Base.write(100);//left
delay(100);
Base.write(80);//right
delay(100);
Base.write(100);//left
delay(100);
Base.write(80);//right
delay(100);
Base.write(100);//left
delay(100);
Base.write(80);//right
delay(100);
Base.write(100);//left
delay(100);
Base.write(80);//right
delay(100);
Base.write(90);//center
delay(100);
Claw.write(45);
delay(1000);
Claw.write(75);
delay(1000);
Claw.write(45);
delay(1000);
Claw.write(75);
delay(1000);
Claw.write(45);
delay(1000);
Claw.write(75);
delay(1000);
Claw.write(45);
delay(1000);
Claw.write(75);
delay(1000);
Claw.write(45);
delay(1000);
Claw.write(75);
delay(1000);
Claw.write(45);
delay(1000);
for (rightpos = 70; rightpos <= 115; rightpos += 1) {
Right.write(rightpos);
delay(25);
}
delay(1000);
for (leftpos = 130; leftpos >= 70; leftpos -= 1) {
Left.write(leftpos);
delay(15);
}
delay(1000);
Claw.write(75);
delay(1000);
for (leftpos = 70; leftpos <= 130; leftpos += 1) {
Left.write(leftpos);
delay(15);
}
delay(1000);
for (rightpos = 115; rightpos >= 70; rightpos -= 1) {
Right.write(rightpos);
delay(25);
}
Base.write(60);
delay(1000);
Base.write(120);
delay(1000);
Base.write(60);
delay(1000);
Base.write(90);//center
delay(1000);
Claw.write(45);
delay(1000);
Claw.write(75);
delay(1000);
Claw.write(45);
delay(1000);
Claw.write(75);
delay(1000);
Claw.write(45);
delay(1000);
Claw.write(75);
delay(1000);
Claw.write(45);
delay(1000);
Base.write(55);
delay(1000);
Base.write(125);
delay(1000);
Base.write(55);
delay(1000);
Base.write(125);
delay(1000);
Base.write(55);
delay(1000);
Base.write(125);
delay(1000);
Base.write(55);
delay(1000);
Base.write(125);
delay(1000);
Base.write(55);
delay(1000);
Base.write(125);
delay(1000);
Base.write(55);
delay(1000);
Base.write(90);
delay(1000);
for (rightpos = 70; rightpos <= 115; rightpos += 1) {
Right.write(rightpos);
delay(15);
}
delay(1000);
for (rightpos = 115; rightpos >= 70; rightpos -= 1) {
Right.write(rightpos);
delay(15);
}
delay(1000);
for (rightpos = 70; rightpos <= 115; rightpos += 1) {
Right.write(rightpos);
delay(15);
}
delay(1000);
for (rightpos = 115; rightpos >= 70; rightpos -= 1) {
Right.write(rightpos);
delay(15);
}
delay(1000);
for (rightpos = 70; rightpos <= 115; rightpos += 1) {
Right.write(rightpos);
delay(15);
}
delay(1000);
for (rightpos = 115; rightpos >= 70; rightpos -= 1) {
Right.write(rightpos);
delay(15);
}
delay(1000);
for (rightpos = 70; rightpos <= 115; rightpos += 1) {
Right.write(rightpos);
delay(15);
}
delay(1000);
for (rightpos = 115; rightpos >= 70; rightpos -= 1) {
Right.write(rightpos);
delay(15);
}
delay(1000);
}
Pinball Machine
This is what we are trying to create in this class. This will be our first project of the 2021 semester. We will create prototypes before eventually creating a final product.
Functional Prototype Requirements
This includes many aspects of the functional prototype. It has dimensions, mechanical components, electronic components, and design requirements.
Final Pinball Machine
This is the requirements for the finished product. It has dimensions, mechanical components, electronic components, and design requirements.
Personal Requirements
This lists what you have to do personally while taking part in this project. It involves demonstration of mastery and the utilization of STEAM.
Professional Arcade Pinball Machine
This is a pinball machine that you would find in an arcade. It is full size with glass over the top and contains multiple electric powered componnents and multiple paths for the ball to travel. Under the machine, there is space for all of the electric components that control the rest of the machine.
Wooden Pinball Machine
This is a medium sized pinball machine made out of wood. It contains mechanical components and offers less paths for the ball to travel. There is no cover over the top.
Cardboard Pinball Machine
This is very small pinball machine made out of cardboard. Much like the wooden one, there are no electric components and no glass cover. However, it offers even less paths for the ball to travel and has a more significant slope than the other two.
Prototype Dimensions
This is a drawing of my dimenions for my prototype gameboard.
Pinball Body Prototype
This is my pinball body prototype. It meats all of the dimension constraints including the back is elevated 5" above, it is 18" by 30", and it is sturdy.
Document the plan for your bottom half
This is my bbottom half plan. You can see where the flippers are and the obstacles for the pinball.
Install Flippers and make Them Function Reliably
These are my flippers functioning properly. Connected to each flipper piece is a wooden rod that goes through the board. On the other side, also connected via the wooded rods, are two wooden blocks that move with the flippers. I attached two arches and fed cardboard pieces through them that you use to push the wooden blocks. There are rubber bands that are also connected to both the arches and the blocks that allow the flippers to retract when no force is applied to the cardboard pieces.
Make and Install both flippers and your "V"
I installed both flippers and added my "V" to block the ball from passing. I did not have a marble on hand but the ball I used was heavier indicating that my flippers are strong. Connected to each flipper piece is a wooden rod that goes through the board. On the other side, also connected via the wooded rods, are two wooden blocks that move with the flippers. I attached two arches and fed cardboard pieces through them that you use to push the wooden blocks. There are rubber bands that are also connected to both the arches and the blocks that allow the flippers to retract when no force is applied to the cardboard pieces.
In this pinball launcher a rod is fed through a spring so that when it is pulled back, the spring pulls it forward which then hits the ball. His rod is metal and the rest of it is wood. I could replace the metal rod with a wooden one and use cardboard instead of wood.
In this pinball launcher a rod is fed through a spring so that when it is pulled back, the spring pulls it forward which then hits the ball. All of his pieces are metal so I could replace the rod with a wooden one and the other metl pieces with cardboard.
In this pinball launcher a rod is fed through a spring so that when it is pulled back, the spring pulls it forward which then hits the ball. He has a metal rod and a wooden handle and end piece. He also used screws to connect them. I could use a woden rod and cardboard with hot glue conjoining them all.
This is a slo-mo video which allows you to really see how it works. In this pinball launcher a rod is fed through a spring so that when it is pulled back, the spring pulls it forward which then hits the ball. Everything is made out of metal meaning I would have to replace the rod with a wooden one and replace the other pieces with cardboard.
Pinball Plunger
This is a video of my pinball plunger. There is a dowel with a handle piece on one end and a piece that hits the ball. This dowel has been fit through the bottom of the board. The rubber band acts as most springs do in normal pinball machines. When the dowel is pulled back, the rubber band is stretched so that upon realease, it flings forward, striking the ball and propelling it.
I like this design because there is quite a bit going on but it remains relatively symmetrical and streamlined.
I like this one because the colors are very vibrant and eye-catching.
This one is very simple and fits the materials that we are already using. This makes the creation of something similar managable.
A take away from this one is the fact that it is very aesthetically pleasing. The materials are smooth and cohesive.
I like this one because it is very artistic and has verticality.
Like the previous cardboard pinball machine, this one is very simple and fits the materials that we are already using.
Curcuit Diagram
There are three wires required for the neopixel to work. They are shown above.
Neopixel
This is my neopixel. The lights change colors along the strip.
Circuit Diagram
These are the wires required for the capacitive touch sensor to work.
Capacitive Touch Sensor
This is a video showing you how the capacitive touch sensor works. When I press my finger down on the penny, the light changes.
#include <CapacitiveSensor.h>
CapacitiveSensor Sensor = CapacitiveSensor(4, 6);
long val;
int pos;
#define led 13
void setup() {
Serial.begin(9600);
pinMode(led,OUTPUT);
}
void loop() {
val = Sensor.capacitiveSensor(30);
Serial.println(val);
if (val >=20 && pos == 0)
{
digitalWrite(led, HIGH);
pos=1;
delay(500);
}
else if (val >= 20 && pos ==1)
{
digitalWrite(led, LOW);
pos = 0;
delay(500);
}
delay(10);
}
Circuit Diagram
These are the wires required for the servo to work with the capacitive touch sensor.
Capacitive Touch Sensor Controlling Servo
This is a video showing you how the capacitive touch sensor works with the servo. When I press my finger down on the penny, the servo rotates.
#include <CapacitiveSensor.h>
CapacitiveSensor Sensor = CapacitiveSensor(4, 6);
long val;
int pos;
#define led 13
#include <Servo.h>
int servoPin = 9;
Servo SensorServo;
void setup() {
Serial.begin(9600);
pinMode(led,OUTPUT);
SensorServo.attach(servoPin);
}
void loop() {
val = Sensor.capacitiveSensor(30);
Serial.println(val);
if (val >=20 && pos == 0)
{
digitalWrite(led, HIGH);
pos=1;
SensorServo.write(90);
delay(500);
}
else if (val >= 20 && pos ==1)
{
digitalWrite(led, LOW);
pos = 0;
SensorServo.write(0);
delay(500);
}
delay(10);
}
Circuit Diagram
These are the wires required for the photoresistor to operate.
Photoresistor Controlling LED
This is a video of my photoresistor controlling my LED. When something is near the photoresistor, the LED turns on.
const int ledPin = 12;
const int ldrPin = A0;
void setup() {
Serial.begin(9600);
pinMode (ledPin, OUTPUT);
pinMode (ldrPin, INPUT);
}
void loop() {
int ldrStatus = analogRead(ldrPin);
if (ldrStatus >=300) {
digitalWrite(ledPin, HIGH);
Serial.println("LDR is DARK, LED is ON");
}
else{
digitalWrite(ledPin, LOW);
Serial.println("-------------");
}
}
(Asynchronous) Physical Build Progress
This is a video of my incorporation of what we have been doing in class into my pinball machine. When I press the button, the servo rotates opening up what I built releasing the ball into the plunger track.
#include <CapacitiveSensor.h>
CapacitiveSensor Sensor = CapacitiveSensor(4, 6);
long val;
int pos;
#define led 13
#include <Servo.h>
int servoPin = 9;
Servo SensorServo;
void setup() {
Serial.begin(9600);
pinMode(led,OUTPUT);
SensorServo.attach(servoPin);
}
void loop() {
val = Sensor.capacitiveSensor(30);
Serial.println(val);
if (val >=20 && pos == 0)
{
digitalWrite(led, HIGH);
pos=1;
SensorServo.write(90);
delay(500);
}
else if (val >= 20 && pos ==1)
{
digitalWrite(led, LOW);
pos = 0;
SensorServo.write(0);
delay(500);
}
delay(10);
}
Circuit Diagram
This is a circuit diagram representing my scoreboard wiring.
Scoreboard Wiring
This is my functioning scoreboard.
// include the library code:
#include <LiquidCrystal.h>
int score = 0;
// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
//const int rs = 3, en = 4, d4 = 5, d5 = 6, d6 = 7, d7 = 2;
LiquidCrystal lcd(3, 4, 5, 6, 7, 2);
void setup() {
lcd.begin(16, 2);
lcd.print("hello, world!");
}
void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
lcd.print(score);
}
Circuit Diagram
This is an image of the wring for my sensor that recognizes the presence of ahand and displays begin.
Adding Another Electronic Element
Unfortunately my phone ran out fo storage so I was unable to take video but the pictures display the photoresistor connected to the prototype handle and the message that is displayed when your hand triggers the photoresistor.
/*
LiquidCrystal Library - Hello World
Demonstrates the use a 16x2 LCD display. The LiquidCrystal
library works with all LCD displays that are compatible with the
Hitachi HD44780 driver. There are many of them out there, and you
can usually tell them by the 16-pin interface.
This sketch prints "Hello World!" to the LCD
and shows the time.
The circuit:
* LCD RS pin to digital pin 12
* LCD Enable pin to digital pin 11
* LCD D4 pin to digital pin 5
* LCD D5 pin to digital pin 4
* LCD D6 pin to digital pin 3
* LCD D7 pin to digital pin 2
* LCD R/W pin to ground
* LCD VSS pin to ground
* LCD VCC pin to 5V
* 10K resistor:
* ends to +5V and ground
* wiper to LCD VO pin (pin 3)
Library originally added 18 Apr 2008
by David A. Mellis
library modified 5 Jul 2009
by Limor Fried (http://www.ladyada.net)
example added 9 Jul 2009
by Tom Igoe
modified 22 Nov 2010
by Tom Igoe
modified 7 Nov 2016
by Arturo Guadalupi
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/LiquidCrystalHelloWorld
//https://ictronic.wordpress.com/2016/07/02/interfacing-16x2-lcd-with-arduino-without-potentiometer/ but use 4 and 5 instead of 0 and 1
*/
// include the library code:
#include <LiquidCrystal.h>
int score = 0;
//set pin numbers
//const won't change
const int ledPin = 13; //the number of the LED pin
const int ldrPin = A0; //the number of the LDR pin
// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
//const int rs = 3, en = 4, d4 = 5, d5 = 6, d6 = 7, d7 = 2;
LiquidCrystal lcd(3, 4, 5, 6, 7, 2);
void setup() {
Serial.begin(9600);
pinMode (ledPin, OUTPUT); //initialize the LED pin as an output
pinMode (ldrPin, INPUT); //initialize the LDR pin as an input
lcd.begin(16, 2);
lcd.print("");
}
void loop() {
int ldrStatus= analogRead(ldrPin); //read the status of the LDR Value
Serial.println(ldrStatus);
//check if the LDR status is <=300
//if it is, the LED is HIGH
if (ldrStatus <=50) {
digitalWrite(ledPin, HIGH);
lcd.print("begin");
//turn LED on
Serial.println("LDR is DARK, LED is ON");
}
else {
digitalWrite(ledPin, LOW); //turn LED off
Serial.println("----------------");
}
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
lcd.print("");
}
Circuit Diagram
This is an image of the wiring for my photoresistor controlling my scoreboard.
Photoresistor controls Scoreboard
This video shows me putting my hand over the photoresistor which makes the number on the scoreboard go up.
/*
LiquidCrystal Library - Hello World
Demonstrates the use a 16x2 LCD display. The LiquidCrystal
library works with all LCD displays that are compatible with the
Hitachi HD44780 driver. There are many of them out there, and you
can usually tell them by the 16-pin interface.
This sketch prints "Hello World!" to the LCD
and shows the time.
The circuit:
* LCD RS pin to digital pin 12
* LCD Enable pin to digital pin 11
* LCD D4 pin to digital pin 5
* LCD D5 pin to digital pin 4
* LCD D6 pin to digital pin 3
* LCD D7 pin to digital pin 2
* LCD R/W pin to ground
* LCD VSS pin to ground
* LCD VCC pin to 5V
* 10K resistor:
* ends to +5V and ground
* wiper to LCD VO pin (pin 3)
Library originally added 18 Apr 2008
by David A. Mellis
library modified 5 Jul 2009
by Limor Fried (http://www.ladyada.net)
example added 9 Jul 2009
by Tom Igoe
modified 22 Nov 2010
by Tom Igoe
modified 7 Nov 2016
by Arturo Guadalupi
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/LiquidCrystalHelloWorld
//https://ictronic.wordpress.com/2016/07/02/interfacing-16x2-lcd-with-arduino-without-potentiometer/ but use 4 and 5 instead of 0 and 1
*/
// include the library code:
#include <LiquidCrystal.h>
int score = 0;
//set pin numbers
//const won't change
const int ledPin = 13; //the number of the LED pin
const int ldrPin = A0; //the number of the LDR pin
// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
//const int rs = 3, en = 4, d4 = 5, d5 = 6, d6 = 7, d7 = 2;
LiquidCrystal lcd(3, 4, 5, 6, 7, 2);
void setup() {
Serial.begin(9600);
pinMode (ledPin, OUTPUT); //initialize the LED pin as an output
pinMode (ldrPin, INPUT); //initialize the LDR pin as an input
lcd.begin(16, 2);
lcd.print("hello, world!");
}
void loop() {
int ldrStatus= analogRead(ldrPin); //read the status of the LDR Value
Serial.println(ldrStatus);
//check if the LDR status is <=300
//if it is, the LED is HIGH
if (ldrStatus <=10) {
digitalWrite(ledPin, HIGH);
score +=1;
//turn LED on
Serial.println("LDR is DARK, LED is ON");
}
else {
digitalWrite(ledPin, LOW); //turn LED off
Serial.println("----------------");
}
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
lcd.print(score);
}
IR Sensor In Progress
int IRSensor = 2; // connect ir sensor to arduino pin 2
int LED = 13; // connect Led to arduino pin 13
void setup()
{
pinMode (IRSensor, INPUT); // sensor pin INPUT
pinMode (LED, OUTPUT); // Led pin OUTPUT
}
void loop()
{
int statusSensor = digitalRead (IRSensor);
if (statusSensor == 1)
{
digitalWrite(LED, LOW); // LED LOW
}
else
{
digitalWrite(LED, HIGH); // LED High
}
}
Circuit Diagram
This is the wiring required for my IR sensor to function properly.
IR Sensor
This is my functioning IR sensor. The video displays the IR sensor itself and the display of the readings that it was recieving when I moved my hand over it. Unfortunately I did not have the proper resistor to wire it which is most likely why the readings are so minor.
IR Sensor
int ifRead;
int LED = 13;
void setup() {
Serial.begin(9600);
pinMode(A0, INPUT);
pinMode (LED, OUTPUT);
}
void loop() {
int statusSensor = analogRead (ifRead);
ifRead = analogRead(A0);
Serial.println(ifRead);
if (statusSensor == 0)
{
analogWrite(LED, HIGH); // LED LOW
}
else
{
analogWrite(LED, LOW); // LED High
}
}
Pinball Machine Prototype
This is my functioning pinball prototype. It consists of flippers and a functioning launcher system, multiple paths for the ball to travel, and a sturdy gameboard. It meets all of the requirements.
Pinball Board Brief
In the project brief, you get an understanding of what the project is or what the problem is. For this particular project we were tasked with was the creation of a functioning pinball machine. The base of all pinball machines is the board itself so obviosuly that is an extremely important aspect to focus on. For this particular brief we were given certain constraints. Those constraints included: the edges must keep the ball on the board, the back is elevated 4"-6" above the gameboard, the gameboard is 18"x24" to 24"x36", and the gameboard is stable and sturdy.
Pinball Board Research
During this stage, you view other finished products in the hope to give us an idea for what you want to do in later steps. Specifically, we researched many different pinball machines. In order to get a general idea I researched pinball machines that were created from wood, pinball machines that were created from cardboard, and even pinball machines that you would find in an arcade. Once I found six good examples, I figured out which aspects of each one that I liked and wanted to recreate in my own project.
Pinball Board Idea Development
All this step requires is for you to figure out what you want to do. Once I was satisfied with my research, I began to sketch out ideas. It took a few tries but I eventually found the design and dimensions that I liked. They had to fit the dimensions that we were given in the project brief so in the end I decided on 18"x30". I also had to figure out the elevation of the back of the gameboard and had to stay within the constraints presented in the brief. I eventually decided on a 4" elevation in order to keep it simple and managable. I also decided to sketch out legs which was not a requirement but I was still unsure if I wanted to have legs in the final product.
Pinball Board 3D Prototyping
During this stage, you take everything from the previous steps and create a physical representation of your final product. In my case, I needed to first obtain the materials. To do this, I went to my dad's job and picked up a lot of cardboard which I would later use. Once that was done I skteched out lines on the cardboard that would represent where I needed to cut in order to get a smooth result. After having all the pieces, all that was left to do was combine it. I carefully hotglued each piece together before letting it dry. The end result was a strong sleak pinball board prototype.
Pinball Board Evaluation and Testing
During evaulation and testing, you recieve feedback from colleagues in order to assess aesthetics and functionality of the prototype. For the board, there was not too much testing to be done. First I dropped it a few times in order to test the strength which resulted in no chnages. After that, I rolled my ball along the board with my hand in order to see if there was any problems but there was nothing to change. Once that had concluded I uploaded images of my board in order to recieve feedback from my teacher. All she had to say was that it was essentially perfect and that I was ready to move on to the next step.
Pinball Board Production
This is the final step and requires you to make your final product. Using all the knowledge that I had obtained from the previous steps, I pretty much reiterated everything I had done prior to this stage and ended up with a near perfect final product. I also implemented the design that I had come up with. I am a big fan of soccer and have been involved with it my whole life. Because of this, I decided to mdel my pinball board after a soccer pitch. To do this I first used primer across the board in order for the secondary coat to come out in the most ideal way possible. I ran into a slight problem after the primer was complete because I did not own any green paint. To solve this problem, I ventured to Walmart and returned with the green paint that I desired. Finally, after the paint had been applied, the paint dried and my board was almost complete. In order to get the lines of the soccer pitch I cut out pieces of copy paper and assembled them on the board in the appropriate manner.