Thursday, December 7, 2017

Videos and Pictures


Here is where it actually works. Just not for what it's made to do.



Me turning it on by the Switch on the side.





It just stayed on red the whole time. I turned it on and off many times and never worked. I also tried holding it at various heights as my mom drove the car.



Here are some pictures of my project and it's box










Here are some videos of my project working with 3 LEDs and a buzzer out side of the box.




This is what it was suppose to do. Every time I tried to put it in the box and make it work, it just didn't.


Argh



     Okay so I have had to make many adjustments because it hates being in a box. I think the stuff I have been using is wearing out. I think the connections in the little holes of the breadboard are kind of iffy sometimes. I would have to jiggle the sensor around until it would work when it was directly plugged into the breadboard. 

     I deleted the buzzer from the project because for the intended use it was going to be too quiet to alert some one in a car. 

     I have also added to where it hooks up to a battery and switch. I bought the toggle switch at Home Depot. 

     I found a good sized box that used to be gift box and I painted it to put my project in. I made holes for the sensor, LEDs, and the switch. Everything fits quite snug without it just being squished in.

     I had 3 LEDs originally, but not all three would ever work together once I put it in the box, so I took out the yellow LED. So along with this adjustment I also need to update my code. I move my green LED over to the place of the yellow LED. So in my code I just replaced yellow with green and deleted out the extra greens along with the coding for my buzzer that I am no longer using.

     To make my LEDs reach the hole I made for them comfortably, I attached each of the legs to an alligator clip and then the alligator clips to the little things that go into the breadboard. For my sensor to reach, I soldered some wire I bought at Home Depot and then taped one of the little wires to the breadboard wires and then to the breadboard. It looks really horrible, but it turned out to work the best. 

Here's my updated code:

#define echoPin 10 // Echo Pin
#define trigPin 9 // Trigger Pin



const int dur = 20;
const int red1 = 11;
const int green1 = 13;




int maximumRange = 200; // Maximum range needed
int minimumRange = 0; // Minimum range needed
long duration, distance; // Duration used to calculate distance



void setup() {
  // put your setup code here, to run once:{
 pinMode(trigPin, OUTPUT);
 pinMode(echoPin, INPUT);
 pinMode(green1, OUTPUT);
 pinMode(red1, OUTPUT);

 digitalWrite(green1, HIGH);
 digitalWrite(red1, HIGH);


 delay(300);

 digitalWrite(green1, LOW);
 digitalWrite(red1, LOW);

}



void loop() {
  // put your main code here, to run repeatedly: {
/* The following trigPin/echoPin cycle is used to determine the
 distance of the nearest object by bouncing soundwaves off of it. */ 
 digitalWrite(trigPin, LOW); 
 delayMicroseconds(2); 


 digitalWrite(trigPin, HIGH);
 delayMicroseconds(10); 

 digitalWrite(trigPin, LOW);
 duration = pulseIn(echoPin, HIGH);

 //Calculate the distance (in cm) based on the speed of sound.
 distance = duration/58.2;


 if (distance < 121){
   digitalWrite(green1, LOW);
   digitalWrite(red1, HIGH);
   
   
 } else if (distance < 152){
   digitalWrite(green1, HIGH);
   digitalWrite(red1, LOW);
   

   
 }

 //Delay 50ms before next reading.
 delay(50);
}






I kept trying to get it to work outside, but it would never recognize the car, but when
I brought it inside and raised it from the floor to the ceiling it worked just fine. Maybe it was stressing the cords when it was sitting upright.





My New Material List:



Tuesday, November 28, 2017

Final Project with Everything Together

Here I have attached the Ping Sensor, LED lights, the piezo buzzer, and the Aruduino.

Here is the code that I used for the Arduino
#define echoPin 10 // Echo Pin
#define trigPin 9 // Trigger Pin



const int freq = 5500;
const int dur = 20;
const int buzzer = 8;
const int red1 = 11;
const int yellow1 = 13;
const int green1 = 12;



int maximumRange = 200; // Maximum range needed
int minimumRange = 0; // Minimum range needed
long duration, distance; // Duration used to calculate distance



void setup() {
  // put your setup code here, to run once:{
 pinMode(buzzer, OUTPUT);
 pinMode(trigPin, OUTPUT);
 pinMode(echoPin, INPUT);
 pinMode(green1, OUTPUT);
 pinMode(yellow1, OUTPUT);
 pinMode(red1, OUTPUT);

 digitalWrite(green1, HIGH);
 digitalWrite(yellow1, HIGH);
 digitalWrite(red1, HIGH);


 delay(300);
 digitalWrite(green1, LOW);
 digitalWrite(yellow1, LOW);
 digitalWrite(red1, LOW);

 tone(buzzer, 4000, 3000);

}



void loop() {
  // put your main code here, to run repeatedly: {
/* The following trigPin/echoPin cycle is used to determine the
 distance of the nearest object by bouncing soundwaves off of it. */
 digitalWrite(trigPin, LOW);
 delayMicroseconds(2);


 digitalWrite(trigPin, HIGH);
 delayMicroseconds(10);

 digitalWrite(trigPin, LOW);
 duration = pulseIn(echoPin, HIGH);

 //Calculate the distance (in cm) based on the speed of sound.
 distance = duration/58.2;


 if (distance < 7){
   digitalWrite(green1, LOW);
   digitalWrite(yellow1, LOW);
   digitalWrite(red1, HIGH);


 } else if (distance < 15){
   digitalWrite(green1, HIGH);
   digitalWrite(yellow1, LOW);
   digitalWrite(red1, LOW);


 } else if (distance < 20){
   digitalWrite(green1, LOW);
   digitalWrite(yellow1, HIGH);
   digitalWrite(red1, LOW);


 } else if (distance < 25){
   digitalWrite(green1, LOW);
   digitalWrite(yellow1, HIGH);
   digitalWrite(red1, LOW);


 } else if (distance < 30){
   digitalWrite(green1, LOW);
   digitalWrite(yellow1, HIGH);
   digitalWrite(red1, LOW);


 }

 if(distance < 7){
   tone(buzzer, 4000, 3000);
   delay(5);
 } else if (distance < 15){
   tone(buzzer, freq, dur);
   delay(10);
 } else if (distance < 20){
   tone(buzzer, freq, dur);
   delay(15);
 } else if (distance < 25){
   tone(buzzer, freq, dur);
   delay(20);
 } else if (distance < 30){
   tone(buzzer, freq, dur);
   delay(25);
 }



 //Delay 50ms before next reading.
 delay(50);
}

 Here's the Final Result of putting it together and adding in the code.


Learning how to use the buzzer















I learned to change the pitch and make it change between pitches.


Tuesday, November 7, 2017

Atari Punk Console

 10/31/2017
 10/31/2017
 10/31/2017
 10/31/2017
 11/02/2017
 11/02/2017
11/02/2017
11/02/2017
I broke D2 in half trying to it out. Had to Re-order it.

Tuesday, October 31, 2017

Final Project Proposal

    

I'm going to create a parking sensor with an arduino. As the object, such as a car, moves closer to the sensor it will go from orange to green(being perfect distance to stop) and then to red (which is too close and you've run through the garage. This can probably be classified as a tool.

Materials: 


  • Arduino Uno(Have)
  • Breadboard(Have)
  • Ping Sensor(Amazon)
  • LED Lights (Yellow, Green, Red)(Have)
  • Box to keep Final Outcome in.(Amazon, Walmart, or Hardware/Craft Store)
  • Piezzo Speaker/Buzzer (Amazon)
  • 220 Ohm resistor(Have)
  • Soldering Kit (Have)
  • Wires and Alligator Clips (Have)
  • Arduino Software and Kit (Have)


https://create.arduino.cc/projecthub/mmcguire/using-an-arduino-as-a-garage-car-parking-sensor-c58c2d?ref=search&ref_id=Sound%20sensors%20and%20led%20lights&offset=4

https://www.youtube.com/watch?v=Vk1fpPXUIJU

http://www.instructables.com/id/Arduino-Ultrasonic-Sensor-HC-SR04/

https://www.youtube.com/watch?v=HynLoCtUVtU




Monday, October 30, 2017

Drawings 1-7

 Drawing One
 Drawing Two
 Drawing Three
 Drawing Four
 Drawing Five
 Drawing Six
Drawing Seven