This week's assignment is to Design and program a smart device that performs a certain function or solves a problem.
I had a brain block this week so I kept searching for an idea till I found my inspiration in one of the ACC sessions when we made a piano with push buttons and a buzzer, every push button had a different tone, I searched in google nd found a project as my idea ARDUINO PIANO USING BUZZER.
For software: TinkerCad to set and simulate the circuit, ArduinoIDE to set the code.
For modeling: glue gun, tape , scissors, card board.
FOR hardware: Arduino Uno as the brain, breadboard to connect components, colored LEDs as output, buzzer as output, bush buttons as input, switch as input, jumpers.
For tinker cad circuit desgin :
First, connect 5v and the ground of Arduino to the positive and negative of the breadboard, put 5 push buttons and connect with the ground, and put 5 colored LEDs and connect with the ground.
Connect the pizzo buzzer the positive to Arduino at pin 12 and the negative to the ground at the breadboard.
Then connect the push button to Arduino, the first bush buttons from left at pin 2, the second bush button at pin 3, next at pin 4, next at pin 5, and the final push button at pin 6.
connect the switch to the breadboard the termnal2 to positive, terminal 1 with negative, and common to pin 13 at Arduino.
Now connect the colored LEDs to Arduino, connect the white led to pin 7, the yellow led to pin 8, the green led to pin 9 the blue led to pin 10, and finally connect the red led to pin 11.
and finally, that's the full circuit with all components.
For Arduino IDE code:
1-Start defining each pin with a name (variable) to change it if you want easily.
3-For manual mode: use condition if the switch pin mode is high (on) if press on first bush button make the first tone and red LED blink, if press the second push button make the other tone and blue LED blink, etc.
2-Define the pin modes in the void setup.
4- For auto mode: complete the first" if" condition, else the switch mode is low, if press the first bush button it plays the melody tone "Pirates of the Caribbean "and the red LED is on.
video of simulation in tinker cad
For the circuit :
prepare the components, first connect the ground of Arduino to the negative of the breadboard.
Then connect the colored LED the negative (short leg) to the ground of the breadboard and the positive (long leg) to 220 Ω resistance, then connect it to Arduino from pin 7 to pin 11.
now connect the push buttons the negative to the ground of the breadboard and the positive to Arduino from pin 2 to pin 6.
then connect the buzzer to the breadboard's ground and pin 12 of Arduino.
finally connect the switch's first pin to 5v, the middle pin to pin 13 of Arduino, and the last pin to the breadboard's ground.
upload the code from Arduino IDE to the device.
For the cardboard:
first arrange the breadboard with components on the cardboard.
then put the Arduino, mark the dimensions, and fix the wires with tape at the base.
at the surface of the cardboard mark the places of the LED and make a circle hole at the cardboard fixes with the LED size to show its lights.
then mark the dimensions of the first push button (the larger one) and make a circular hole that is adapted to it, the make small holes for the legs of the jumpers that connect to the small push buttons, and a place to the switch
fold the cardborad and use the glue gun to close the sides together.
finally add the two sides and lets play some music🎶.
at first, because there were many wires I replaced the wires of the LEDs pins then I recognized it and fixed the problem.
and I wanted to make the melody tone on my own but it was very difficult for me so I searched for the tones of songs and found many songs that facilitate the code to e and it was very interesting(pirates of Caribbean) .
I learned how to arrange my ideas in a Sodo code first, and to make maulti functions code.