Week #7 - Journal

kinetic facade proof of concept and preliminary prototype - environment sensor & controle panel 


Tell us about your assignment's idea for this week. Why do you care about this idea? What inspired you? (Please include images or links to sources of inspiration)

THE IDEA for this week the assignment was to code and develop a smart device using arduino uno and tinker cad code blocks and implement the circuit in real life.


The inspiration this week is an integration of different parts from my final project as a proof of concept. i decided to integrate the assignment of week #6 with a  LCD interface that shows the mode of the device, temperature, humidity and angle of rotation on the servp

The research and trouble shooting for this project i had 2 components that were completely new to me. the LCD using I2C communication and the DHT11 sensor module. after research on the internet i found the following resources with libraries and codes for testing the components and the wiring. 

Tool Chain

Which software/machines/materials did you use in the assignment? Why?

below are the materials i used for the cardboard model of the assignment

toung depressor

cardboard

below are the tools and softwares i used to finalize the assignment: 

tinkercad for circuit diagram

arduino IDE for coding and flashing the code onto the arduino board

breadboard

jumper wires

power supply terminal connector

brain, input and output components

LDR sensor module (input component)

Arduino Uno R3 (Brain)

micro servo motor (output component)

DHT11 temperature & humidity  sensor module (input component)

16x2  liquid crystal display with I2C interface (output component)

push button (input component)

on/off switch

5v power adapter

Potentiometer 1Kohm (input component) 

Design Process for environment sensor & controle panel 

Explain the design and/or preparation process of your assignment. How did you use the tool or software to design and/or prepare your assignment before fabrication/implementation?

testing the DHT11 Coding

1 - after researching the DHT11 module i installed the library for controling the sensor it was time to test it 

2- using the code below i printed the outcome on the serial monitor to view the sensor reading.  

testing the the LCD wiring and library

3- after the installation of the library i ran the I2C address finding code from the arduino examples

4- after finding the address of the I2C communication (0x27) i ran the following code to test the wiring and code library of the LCD 


5-now i have experience with each component individually i is time to finalize the circuit on a breadboard and the diagram

6- add all the input and output components

7- after connceting the components it is time to code the smart device. 

8- add the libraries required

9- adds the libraries required to controle the LCD and defines the I2C address of the LCD

10- includes the servo library and defines servo pin as pin 3 

11- includes the DHT11 library and defines that the DHT11 is connected on pin 6 

12- defins the button attached on pin 2 

13- creates a variable (mode) to store the mode of the device (1=auto mode) (-1 = manual mode) 

14 - creates a variable(LDR_servo)  to store the input reading we want to set the servo angle to ( from the LDR) 

15- creates a variable (set_servo) to store the current angle of the servo.

16- the setup function runs once and in this case declares the following: 

17- creats a variable (temp) to store the temperature data from the DHT11

18- creates a variable (hum) to  store the humidity data from the DHT11

19- reads the input from button and changes the stored state of the device on variable (mode) each push of the button changes the variable between 1 & -1

20- clears the LCD screen and prints the current mode of the device on the LCD screen

21- prints the current angle of the servo on the LCD on the same line as the mode 

22- prints the tempreture and humidity from the sensor on the second line of the LCD screen

Automatic Mode

23-if the mode is set to automatic the program executes following code

24- reads the analog input on pin A0 and maps the input from 1023 to 180 degrees of the servo and stores that value on the variable (LDR_servo) [now the value stored in the variable is the angle we want the servo to go to )

25-  reads the current degree of the servo attached on pen 3 and stores it on the variable (set_servo)

26 - increases the value of (set_servo) by 1 degree if the value of (set_servo) is less than the required value for the servo by the LDR stored in (LDR_servo) and then sets the rotation of the servo to the value of (set_servo)

27- the below block decreases the value of (set_servo) by 1 degree if the value of (set_servo) is bigger than the required value for the servo by the LDR stored in (LDR_servo) and then sets the rotation of the servo to the value of (set_servo) 

28- [this will loop until the value of (set_servo) = the value of (LDR_servo) ]

Manual Mode

29-if the mode is set to Manual the program executes following code

30- reads the analog input on pin A1 (from the potentiometer ) and maps the input from 1023 to 180 degrees of the servo and stores that value on the variable (POT_servo) [now the value stored in the variable is the angle we want the servo to go to )

31-  reads the current degree of the servo attached on pen 3 and stores it on the variable (set_servo)

32- sets the servo to the angel stored by the (pot_servo) 

Complete code

1

2

3

Development/Implementation Process

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

33- implement the diagram in real life 

34 - before flashing the code make sure that i have selected the correct board and port in the arduino IDE 

35 - compile the code in IDE ( no errors) 

36- upload the code to the arduino

making sure i selected the correct board and port

making sure my code has no errors (verifying my code)

part preparation and assembly 

Overcoming Challenges

What kinds of challenges or problems did you face while doing the assignment, tutorials, or exercises?  How did you solve them? Did you ask for help from an instructor or peer? Please provide a link to the tutorial or article that you used to solve your problem (if any)

the first challenge was working with the LCD with the DHT11 and display the output on the screen optimumly

first problem ( DHT11 displays -999 on the LCD) 

      after many hours of trial and error i found out that if i add delay 0.5 seconds it allows the DHT module to send the data and give good readings 

second challenge was that the lines on the LCD screen are printing continuously 

after debugging the code and research i found out that i should add a function (LCD. Clear) at the beginning of the loop function . that allows the screen to present the values in the correct way 

Final Project

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

i chose this prototype since it is essentially a part from my final project coded and wired with arduino using a servo motor instead of a stepper motor. when i succeded and i got the output i wanted, now i have proof of concept that it can work and i have a better understanding of how the LDR works and what kind of limitations it has. now i can focus more on the other sections of 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?

extra session to make jewlery using wire frame electronics 

my first test of the LCD 

Weekly Digest

Tell us about any other cool things that you've made this week: in the Hands-on activity, tutorial examples, exercises, or any other cool mini-project that you tried out aside from the assignment.

Week Wrap Up In Pictures