Week 7 - Journal

Ideation

Tell us about your assignment's idea for this week. Why do you care about this idea? What were you inspired by?

This week's assignment idea was to design and program a "Smart Device" : GAME KIT. (2 fun games will be programmed).

My inspiration for this idea was the game kit given to us in week 1. The game kit which i programmed was customized to perform 2 fun games (1- counter 2- Piano), moreover, instead of tilt sensor i used ultrasonic sensor to control the speed of the counter.

I cared a lot about this idea as i wanted to challenge myself to program complex functions, and at the same time design and program a smart device that perform a certain function: to program Arduino UNO to read signals from multiple inputs components (i used ultrasonic sensor, keypad, slide switch and push button) to control multiple action components.( i used LCD I2C, buzzer and LED)

Tool Chain

Which software/machines/materials did you use this week? Why?

This week i was taken in dept in programming "Arduino IDE", so we can write the program more efficiently and does not consume more space. examples:

1) Creating new function: is it simple task to create a separate set of conditions and commands that the Arduino boards only reads it when its necessary.
2) For and while loop: it orders the Arduino board to perform certain commands or conditions repeatedly and does not have to wait till the full program is read and then it starts to repeat.
3) LCD I2C: it is the display where the Arduino board is instructed to give OUTPUT on it. there are many types of displays in the world. i explored 16x2 address 0x27, for which i had to download certain library for programming.
4)Libraries: these are like tools which help any programmer to help them write the code for a certain component easily and understand is completely with examples given. like for the LCD i installed (Liquidcrystal_I2C) library . this is the website which helped me more understand how and what is LCD.
5) Basic and compound conditions: to build a smart device which includes multiple input and output components, therefore, programming must be done efficiently to deal multiple inputs and outputs.
6) Open recitation advance electronics, i was introduced to new components capacitors, transistors, OP AMP and 555timer. i had the pleasure to learn it practically in the lab- offline sessions are more effective in learning advance knowledge.

Last but not the least, 3 case studies of smart devices where explored, which gave me confidence on designing and building new customized smart device of my own.

Design Process

Explain the design process of your assignment. How did you use the tool/software to design and/or simulate your assignment?

For this week's assignment i used "Arduino Text Code".


A- Opened the application and into new page.
B- Saved As new project.
C- The journey of programming started step by step, i started by programming the LCD as and output in pins A4 ,A5, 5V and ground( which included library and also setting cursor commands)
also defining every pin to save time and space. also creating integers before void setup()
D- Then to program the counter feature by using "For loop" so that this command must be repeated every certain amount of time.
used the math equation (value = 0 ; value <= 50; value += 1) for counter feature.
E- Added the push button as an input at pin 11 , so that the game can be played using it. This input was written as INPUT_PULLUP in void setup() (with all other input and output pinModes) so that when it indicated low the Arduino will check which number is on counter. and if the the number given matches the user is winner and if not then the user loser lost and the game starts again.
F- I explored new command "GOTO" : so that if i have multiple conditions i can command to go to certain function directly by skipping some if all is fulfilled( like i used GOTO command after the 2 conditions related to push button above so that after every step it can start a new game.
G- Then i added buzzer and LED as an OUTPUT at pins 10 and 13 , so that at every milestone indicates that milestone, like if winner then the buzzer will play tune for 1 second as well as the LED will light up. Both components were placed on bread board.
H-Instead of "Tilt sensor" from the original game kit i used ultrasonic sensor, which was programmed that if any thing is from range 0 to 100 cm the counter time will be slow(1000 milliseconds), and if from 101 to 200 cm range the counter time will be fast (750 milliseconds) and if 201 and above cm range the counter timer will speed up till (500 milliseconds).
I-To perform another game i used a slide switch as an INPUT at pin 12, so that it can switch between the 2 games according to the signal High or Low received.
J- Added keypad (3x4) as in input at pins 2 to 8 , and programmed it by adding keypad library , so that if any key is pressed it is displayed on LCD.
K- Programmed each keys with tunes (by the help of new customized library called tones) and used new function where each digit/ character of keypad is given specified tone. so that whatever number is pressed the buzzer will play that tone for 500 milliseconds. Also by adding manually library which has tone set in it by clicking control + shift+ N , write any name for that library in ".h" format. and include it on top of my codes by include "tones.h" before void setup().
L- Compiled and then uploaded it on Arduino UNO board.

Note: after every step i used to check by compiling and uploading on my Arduino UNO board to check whether the code is correct or not.
also while writing code i was cautious enough not to make any silly mistake like { and ; but still whenever any error came up i rechecked that error line and corrected it.

Designed wiring diagram on Tinkercad so that the reader can understand all my steps and visualize it correctly.

Fabrication/Implementation Process

Explain the fabrication/implementation process of your assignment. How did you use the machine/tool to manufacture or implement the design of your assignment?

As i had made the original game kit in week 1, so I decided not to fabricate anything other than my circuit diagram.

1) Fetched my components from the kit.(as shown in the pictures above)
2) Connected vcc 5V from the Arduino board to the + row of the breadboard, same for the ground from board to - row of the bread board.
3)As for the LCD wiring i connected the VCC 5V and ground on bread board in the first column of their respective rows. And then the other 2 pins SDA to A4 and SCL to A5 pin respectively.
4) Connected the push button, 1 end to the ground of bread board 2nd column of negative row, and other end at pin 11.
5) Ultrasonic sensor was connected next, it has 4 pins so i placed it on bread bored far from wires and jumpers so they does not interfere as obstacles and it has wide open space in front of it to measure any object distance efficiently. the wiring for it was as follow: first and the last were the positive and negative, which where connected to 3rd column in each rows. and the other 2 pins are trigger and echo. trigger which sends transmission so that echo receives it. They were allocated trigger at 9 pin and echo at A0 due not not enough space :)
6)Then inserted buzzer and LED both were added on bread board so that on the 4th column of negative was connected to the negative of buzzer and the 5th column negative of the LED which was connected by resistor 220 ohms. and as for the positive buzzer was connected on pin number 10 and LED on 13 respectively.
7)Slide switch has 3 pins, it was added little away from the jumper wires so that it can be easily accessible for the user, the 2 ends of the slide switch were connected to the positive and negative rows at column 6th , which will indicate high or low signal. As for the middle pin it was connected to 12th pin on the Arduino Board.
8)last but not the least, keypad 3x4 has 7 pins 3 for the columns and 4 for the rows, i used male to male jumper wires to connect it to the board directly, also started with the right side with column pins from pin number 2 to 4 and for the rows from pin number 5 to 8 respectively.

voila a complete circuit diagram completed.

Community of Learning

Did you ask for feedback? What are the ideas that others have contributed or suggested? What was someone else’s idea that you built upon? How did you help your peers? How did your peers help you?

During this week i asked for feedback from my peers and specially from my instructors along the week.
Many ideas were contributed such as Assistant director Ahmed Saeed gave his feedback in the lecture on my pre activity as i had some challenges. I learned that in any 2 pin cases like push button or even on/off switch i have to inset in the code (INPUT_PULLUP).
Also in smart home case study project i had a problem(shared on flip grid for feedback) that the DC Motor was not working in manual mode but worked in automatic mode, so both Assistant director (in open session time) and my Instructor Menna directed me to trouble shoot it and build again step by step which was a logic answer to find where was the problem.
Also was able to help my fellow peers also by giving suggestions and feedback throughout the sessions, nevertheless by helping out in anyway possible as in the session when my peer was designing it online i helped him to and commented for stuff he missed.
My peers also are kind enough to help me out throughout my week by giving me support and feedback like when i asked about my assignment one of my peer indicated to add any sensor which controls the speed of counter , which i implemented it and it gave a smart device touch.
I thank them all to guide me in best way possible and hope that i would return the same back to all one day.

Overcoming Challenges

When you got stuck, what/who did you turn to? At what point did you have to pause to research or learn more before moving on? What are some mistakes, pitfalls, or challenges that others can avoid if they were doing this project?

This week was amazing and full of challenges and got stuck every step, i will discuss here the few main major ones.
1) In the assignment i wanted to use mercury tilt sensor, but had hard time finding it correct value to control it. So i to stop and search for it on google also asked about it, in the end, i used alternative sensor in my assignment but got my answers in open time the original code of game kit and now i am able to configure it correctly.
2) The craziest challenge was in smart home project when the DC motor was not working, i doubled and tripled checked my wiring and the code still could not find any fault, till i searched about it and asked for feed back , got to know that in electronics anything has a life double check everything :)

Silly mistakes by me were many i would recommend the readers to take every opportunity arises like open time session and recitation sessions which answers many types of questions.

Final Project

How can you use the skills and knowledge that you've acquired this week in your final project?

Writing code more efficiently was the take away which i say that i tried to acquired this week like making our own functions and For and while loops. All these will definitely hep me in writing code for my final project.

WOW!

What is the coolest thing that you've learned this week? What is something that you will never forget from this week?

Leaning new components (advance electronics) in OFFLINE CLASS was more fun than doing it alone at home:)
These experiments which i did practically in open recitation will never forget, or at least the fun of it :) (as it was advance if i wont practice enough i wont be able to remember each details )

Weekly Digest [OPTIONAL]

Tell us about any other cool things that you've made this week: Pre-activity, examples, exercises, or any mini-projects.

Activity for this week was very cool as it was challenging as it was involved designing and building/ writing code without using Tinkercad.
I gave my best and the result was as follow: New smart home solution


Assignment Design Files