This shows you the differences between two versions of the page.
pm:prj2022:cstan:crystal_ball [2022/05/27 23:23] adriana.costan |
pm:prj2022:cstan:crystal_ball [2022/05/27 23:50] (current) adriana.costan |
||
---|---|---|---|
Line 11: | Line 11: | ||
===== General Description ===== | ===== General Description ===== | ||
- | |||
All you need to do to use the Crystal Ball is to ask a yes/no question then to slightly shake the breadboard that contains the display, and you will hear a sound which indicates that your question was answered, this is possible due to the tilt sensor, meanwhile a thematic song is running in the background and the LEDs would flicker during the entire functioning of the toy. | All you need to do to use the Crystal Ball is to ask a yes/no question then to slightly shake the breadboard that contains the display, and you will hear a sound which indicates that your question was answered, this is possible due to the tilt sensor, meanwhile a thematic song is running in the background and the LEDs would flicker during the entire functioning of the toy. | ||
Line 17: | Line 16: | ||
**Block diagram:** | **Block diagram:** | ||
+ | {{ :pm:prj2022:cstan:blockdiagramcrystalball.png |}} | ||
===== Hardware Design ===== | ===== Hardware Design ===== | ||
**__Components list:__** | **__Components list:__** | ||
- | *Arduino Uno R3 | + | *Arduino Uno R3 x2 |
*Breadboard | *Breadboard | ||
*Tilt sensor | *Tilt sensor | ||
Line 33: | Line 33: | ||
**__Electric schematic:__** | **__Electric schematic:__** | ||
- | |||
{{ :pm:prj2022:cstan:electricschematiccrystalball.png |}} | {{ :pm:prj2022:cstan:electricschematiccrystalball.png |}} | ||
Line 40: | Line 39: | ||
===== Software Design ===== | ===== Software Design ===== | ||
- | For this project I used the library LiquidCrystal_I2C.h such that I can display on the I2C LCD the answers given by the Crystal Ball. In order to make this toy to work I am running the sketch CrystalBall.ino. | + | For this project I used the library LiquidCrystal_I2C.h such that I can display on the I2C LCD the answers given by the Crystal Ball. In order to make this toy to work I am running the sketches CrystalBall.ino and Music.ino. |
In CrystalBall.ino: | In CrystalBall.ino: | ||
- | I have defined the notes for the background song, the melody and the notes duration; then I have initialized the pins for the tilt sensor, piezo and speaker. | ||
+ | Firstly, I have initialized the pins for the tilt sensor, piezo. | ||
In setup() I have displayed the initial message on the LCD: "Ask the Crystal Ball!" | In setup() I have displayed the initial message on the LCD: "Ask the Crystal Ball!" | ||
+ | In loop() I initialized the sequence of the LEDs flickering in order to play constantly during the functioning of the toy and using a switch-case algorithm the toy would generate 1 out of 8 possible answers. | ||
+ | |||
+ | In Music.ino: | ||
- | In loop() I initialized the sequence of the LEDs flickering and the background music playout in order to play constantly during the functioning of the toy and using a switch-case algorithm the toy would generate 1 out of 8 possible answers. | + | First I have defined the notes for the background song, the melody and the notes duration and initialized the pin for the speaker. |
+ | In loop() I have the for with which I play on repeat the background music. | ||
===== Obtained results ===== | ===== Obtained results ===== | ||
+ | |||
+ | {{ :pm:prj2022:cstan:resultscrystalball1.jpeg |}} | ||
+ | |||
The initial message: | The initial message: | ||
- | {{ :pm:prj2022:cstan:resultscrystalball1.jpeg?300 |}} | ||
- | One of the 8 possible answers: | + | {{ :pm:prj2022:cstan:resultscrystalball2.jpeg |}} |
- | {{ :pm:prj2022:cstan:resultscrystalball4.jpeg?300 |}} | + | One of the 8 possible answers: |
- | The breadboard arrangement: | + | {{ :pm:prj2022:cstan:resultscrystalball3.jpeg |}} |
- | {{ :pm:prj2022:cstan:resultscrystalball2.jpeg?300 |}} | ||
===== Conclusions ===== | ===== Conclusions ===== | ||
Line 63: | Line 68: | ||
===== Download ===== | ===== Download ===== | ||
- | {{:pm:prj2022:cstan:crystalball.7z|}} | + | The code: {{:pm:prj2022:cstan:crystalball.7z|}} |
+ | The PDF version of the project: {{:pm:prj2022:cstan:crystal_ball.pdf|}} | ||
===== Bibliography/Resources ===== | ===== Bibliography/Resources ===== | ||
Link for Project Crystal Ball: [[https://ocw.cs.pub.ro/courses/pm/prj2022/cstan/crystal_ball]] | Link for Project Crystal Ball: [[https://ocw.cs.pub.ro/courses/pm/prj2022/cstan/crystal_ball]] |