This shows you the differences between two versions of the page.
pm:prj2022:cstan:crystal_ball [2022/04/22 15:15] adriana.costan [General Description] |
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, immediately after the LEDs would start to flicker and you will hear a sound which indicates that your question was answered, this is possible due to the tilt sensor which can have its sensitivity adjusted from the potentiometer, in this way the ball would need a more or less vigorous shake in order for you to receive your answer. | + | |
| | ||
**Block diagram:** | **Block diagram:** | ||
- | [[pm:prj2022:cstan:crystal_ball|{{ :pm:prj2022:cstan:blockdiagram.png |}} | + | {{ :pm:prj2022:cstan:blockdiagramcrystalball.png |}} |
- | ]] | + | |
===== Hardware Design ===== | ===== Hardware Design ===== | ||
**__Components list:__** | **__Components list:__** | ||
- | *Arduino Uno R3 | + | *Arduino Uno R3 x2 |
- | *2 X Breadboard | + | *Breadboard |
*Tilt sensor | *Tilt sensor | ||
- | *Potentiometer | + | *Speaker |
- | *LCD | + | *LCD i2c |
*Piezo buzzer | *Piezo buzzer | ||
*LEDs | *LEDs | ||
Line 31: | Line 30: | ||
*Jumper wires | *Jumper wires | ||
*Dupont wires | *Dupont wires | ||
+ | |||
**__Electric schematic:__** | **__Electric schematic:__** | ||
+ | {{ :pm:prj2022:cstan:electricschematiccrystalball.png |}} | ||
+ | |||
+ | |||
+ | |||
===== 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 sketches CrystalBall.ino and Music.ino. | ||
+ | |||
+ | In CrystalBall.ino: | ||
+ | |||
+ | 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 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: | ||
+ | |||
+ | 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: | ||
+ | |||
+ | {{ :pm:prj2022:cstan:resultscrystalball2.jpeg |}} | ||
+ | |||
+ | One of the 8 possible answers: | ||
+ | |||
+ | {{ :pm:prj2022:cstan:resultscrystalball3.jpeg |}} | ||
+ | |||
===== Conclusions ===== | ===== Conclusions ===== | ||
+ | In conclusion, it was a fun and challenging project that was totally worth it! :) | ||
===== Download ===== | ===== Download ===== | ||
+ | The code: {{:pm:prj2022:cstan:crystalball.7z|}} | ||
- | ===== Journal ===== | + | 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]] | ||
+ | |||
+ | **__Bibliography:__** | ||
+ | *Arduino Starting Kit Book | ||
<html><a class="media mediafile mf_pdf" href="?do=export_pdf">Export to PDF</a></html> | <html><a class="media mediafile mf_pdf" href="?do=export_pdf">Export to PDF</a></html> |