Week 7 - Journal
Ideation
Tell us about your assignment's idea for this week. Why do you care about this idea? What inspired you? (Please include images or links to sources of inspiration)
The assignment idea was Design and program a smart device that perform a certain function or solve a problem: program Arduino UNO to read signals from multiple input components (Sensor, Switch, or variable resistor) to control multiple action components (Motor, Buzzer, LED...etc) using Arduino C (Text Code). and I coudn't find somthing suitable on Instructables and Arduino Project Hub, So I picked (Ultarasonic, Pushbutton, buzzer and leds ) randomly to design the smart device.
Tool Chain
Which software/machines/materials did you use in the assignment? Why?
I used tinkercad to design the circuit, then I moved to Arduino Idm to wite down the code and next step was returning to tinkercad to simulate the code and the circuit together and fix the errors
Design/Preparation Process
Explain the design and/or preparation process of your assignment. How did you use the tool or software to design and/or prepare your assignment before fabrication/implementation?
I designed the circuit first on tinkercad
the code was written on Arduino IDM
simulation on thinkercad for both curcit and code
conncet the wires on real
RUN the code
Development/Implementation Process
Explain the development/implementation process of your assignment. How did you use the machine/tool to manufacture or implement the design of your assignment?
Materials:
cardboard
Arduino uno
ultrasonic
pushbutton
leds
Jumpers
breadboard
resistors
the whole implementation process was in the code, So
I started the code with the ultrasonic defination , Which I searched about it:
long readUltrasonicDistance(int triggerPin, int echoPin)
{
pinMode(triggerPin, OUTPUT); // Clear the trigger
digitalWrite(triggerPin, LOW);
delayMicroseconds(2);
// Sets the trigger pin to HIGH state for 10 microseconds
digitalWrite(triggerPin, HIGH);
delayMicroseconds(10);
digitalWrite(triggerPin, LOW);
pinMode(echoPin, INPUT);
// Reads the echo pin, and returns the sound wave travel time in microseconds
return pulseIn(echoPin, HIGH);
}
Then I defined the inputs and the outputs :
pinMode(7, OUTPUT);
pinMode(6, INPUT);
pinMode(2, INPUT_PULLUP);
pinMode(11, OUTPUT);
pinMode(10, OUTPUT);
pinMode(9, OUTPUT);
pinMode(3, OUTPUT);
The last paragraph was about the conditions I wrote based on distances I need:
if (0.01723 * readUltrasonicDistance(7, 6) > 50 && digitalRead(2) < HIGH) {
digitalWrite(11, HIGH);
digitalWrite(10, LOW);
digitalWrite(9, LOW);
noTone(3);
} else {
if (0.01723 * readUltrasonicDistance(7, 6) < 50 && (0.01723 * readUltrasonicDistance(7, 6) > 30 && digitalRead(2) < HIGH)) {
digitalWrite(10, HIGH);
digitalWrite(11, LOW);
digitalWrite(9, LOW);
noTone(3);
} else {
if (0.01723 * readUltrasonicDistance(7, 6) < 30 && (0.01723 * readUltrasonicDistance(7, 6) > 5 && digitalRead(2) < HIGH)) {
digitalWrite(10, LOW);
digitalWrite(11, LOW);
digitalWrite(9, HIGH);
noTone(3);
} else {
if (0.01723 * readUltrasonicDistance(7, 6) < 5 && (0.01723 * readUltrasonicDistance(7, 6) > 0 && digitalRead(2) < HIGH)) {
digitalWrite(10, LOW);
digitalWrite(11, LOW);
digitalWrite(9, LOW);
tone(3, 523, 1000); // play tone 60
}
}
}
}
delay(10);
The conditions are:
switch on and distance more than 50 -> green led is on
switch on and distance less than 50 and more than 30 -> yellow led is on
switch on and distance less than 30and more than 5-> red led is on
switch on and distance less than 5 and more than 0-> buzzer is on
Community of Learning
Did you ask for feedback? What are the ideas that others have contributed or suggested? What was someone else’s idea that you built upon? How did you help your peers? How did your peers help you?
I didn't ask for the feedback. I didn't help anyone and noone helped me.
Overcoming Challenges
When you got stuck, what/who did you turn to? At what point did you have to pause to research or learn more before moving on? What are some mistakes, pitfalls, or challenges that others can avoid if they were doing this assignment?
I worked on tinkercad till it works like expected, but when I connected thed wires on real, It didn't work!!
I stayed about 2 hours checking the code and the wires and I couldn't find thr wrong thing. After relaxing and concentrarting on the circuit I found out that I switched the VCC and TRIG wires cause they are aside. when I put them in the right pins, It works.
Final Project
How can you use the skills and knowledge that you've acquired this week in your final project?
That wil help me to write down the code on my final project independtly.
WOW!
What is the coolest thing that you've learned this week? What is something that you will never forget from this week?
working on the smart home project at saturday