The assignment of this week is making a smart device that perform a certain function using multiple input components to control multiple action components.
I was inspired by this idea from math games on Google store, and here in instructables.
This game will make the math very easy for kids and youth too.
Software
to simulate the circuit of the game before making the real circuit
For writing the code and run it
Tools
Components
Breadboard
for connecting all the components
Arduino Uno
for connecting all the inputs and run the device
LCD+I2C
to display a message
KeyPad
to enter the numbers
Buzzer
to produce a sound
potentiometer
acts as an adjustable voltage divider.
Jumper Wires
to connect the components with Arduino and Breadboard
Arduino cable USB
To connect the Arduino with laptop
Circuit View
Firstly, I designed my circuit using TinkerCad.
Then, I wrote my code using Arduino IDE.
- I added my libraries at first.
- Then defined all my components and divided them into inputs and outputs.
- I defined a variable for storing random number to use random question from the array.
Secondly, I added an array included of all the questions as String value.
And added an array for the correct answer as integer value.
Then, I initialized the lcd and added welcome message with name of the game to user.
start checking for the pressed button in each column one by one.
compare the time elapsed since the question is displayed.
If the time of your answer > the defined time (10 seconds), Then
will display "out of time" message on lcd and you will lose, and print the final score.
The buzzer will produce a sound in case the answer is wrong or out of time.
Then will reset the Arduino to back to the welcome message at the beginning.
function to display the questions
function to store the typed number in an array(keypad[])
this function checks the answer stored in array keypad[] to the real answer stored in solutions array
Finally, I copied the code from Arduino IDE and paste it in TinkerCad and made a simulation to my circuit to test it, And it worked perfectly!
Firstly, I connected the components in the real circuit, and connected the Arduino with laptop using Arduino cable USB and run the code to test the circuit.
The Circuit
Then, I made a cardboard box and put my components inside it. I explained everything in details in this video.
I faced 3 problems, the first one in the coding, When I run the code, I found errors and asked my friend (Ibrahim) and he told me to download library for lcd that is called LiquidCrystal_l2c instead of the lcd library in TinkerCad, he told me that TinkerCad uses a different library.
Then, I faced another problem, when I put the LCD screen and all components in cardboard, I found that the screen is off, and discovered that this small piece with circle around it should be in this part.
When I put it in this part, It worked well finally. So it is an important part, don't miss it!
And finally, the last problem, I found that the LCD screen isn't responding for any action. It is just turning on without any words.
I asked E. Menna and she told me to try the code with "hello world" example. It worked then I copied the setup part into my code and it worked well.
I learned how to show message in LCD using the coding and make action. I will do the same action in my final project, so I am ready now to write my final project code!
We built a simple representation of a smart home system. This system senses the light in a room, as well as, weather parameters (temperature and humidity) in order to control a DC lamp. I made this circuit with my team mates Ahmed Atef and Yosr.
Smart Home System
Smart Home System
I made a safety box using Arduino connected with keypad, buzzer, LCD, and servo motor.