the assignment was to Program an Arduino UNO to read a signal from a single input component
I wanted to Make the idea of the music box when the sensor is on it play sound and rotate
but in the assignment it's required to use one action so it's gonna rotate only
http://fabacademy.org/2020/labs/talents/students/doaa-allshureih/weeks/week11.html
Softwares: Tinkercad to simulate the circuit before phisically doing it
Arduino IDE
Materials:
Breadboard, Arduino, Motor, Sensor -i wanted to use tilt at first bu ended using photoresistor module-,Jumper Wires
Tinkercad
Tinkercad
Sensor
servo motor
First I googled some previous examples to help
some examples were applicable
I decided to use Tilt sensor with dc motor The Idea was when the box is opened the sensor will move and the motor will rotate
When I tested the the tilt sensor with LED it didn't work
I Replaced it with photoresistor Module so when the box i opened the Motor will work
the DC Motor was Rotating so fast when I used L298N it didn't work
When the speed was less than 100 the motor needed to be pushed I don't know why :'D
Tilt Sensor
Dc Motor Problem
Dc Motor Problem
I Connected The servo to GND 5V and pin A0
I Connected The Sensor to GND 5V and pin A0
Programmed the Arduino
Tested on TinkerCad
Connection on Tinker Cad
I Used old Processing code to help me make the code - As processing is the only programming experience I have-
we need to use variable to make servo rotate on slower motion
We need While to make the first condition to check the sensor
the If is used to make the servo rotate 1 degree each time and the servo only rotates 180 so when it reaches this it goes back to zero
if the while loop is not happening - the sensor is off- the servo will stop in its position
Code on Tinker Cad
Processing Code
I tried to make the servo rotate back in the same speed it did but the problem was in the condition
simulation Video
I connected the circuit as in tinker cad
uploaded the code from arduino
circuit
I had a problem Connecting the DC Motor I asked one of my Peers to Turn out I connected wrong wires
I didn't know all the components in the Kits so I used Google to define which was which
i guess the final project should have Arduino So this week Knowledge will be used
Tinker cad Blocks For Programming, It was simple to use
I was so happy with the 3D printed holder it looked so cool :D
you can Name the assignment pocket Sized pin holders