Week 8 - 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 develop a GUI for a smart device created in week 6 or 7, for that i choose my week 6's assignment as it was related to my final project. (a feature of 3D FAB PEN). I had built in such a way that 3 types of modes can run together.
1) GUI processing IDE.
2)Manually.
3)Mobile Application.
To make it smart device i added thermistor sensor so that temperature sensor will be read also can control the DC Motor. (
video)

My inspiration for this idea was same as was for week 6, 3D pen.

I cared a lot about this idea as i was discovering new things i wanted all my effort to be as a start for my final project, as they say practice makes a man perfect, so this was kind of practice for my final project idea.

Tool Chain

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

This week i learned how to develop GUI Graphical User Interface, I explored "Processing IDE" software and also "HC-05" blue tooth module, which helped me to connect my smartphone with the Arduino board.

1) Processing IDE: It is JAVA based environment for graphical programming that Arduino does not use. runs on pcs only. It works for a computer like Arduino IDE works for a micro-controller. It is similar to Arduino in terms of structure. Also it has setup functions and draw functions like an Arduino has a setup and loop function. It can communicate with the Arduino IDE through "Serial communication". This way i could send data from the Arduino to the Processing IDE and also from Processing IDE to the Arduino.
2) Controlp5 library: This library helped me by getting ready codes which from it i was able to develop in Processing IDE easily.
3)HC-05 module: It is a module that can connect the board to any smartphone via blue tooth.
4)MIT app inventor: Similar to Tinkercad online platform where anybody can easy build and design mobile app. I was able to learn it and design an app which can able to connect the board via blue tooth. But for some reason it did not work on my smartphone properly, so i had to change it.
Last but not the least, videos and tutorials were very helpful.

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 3 types of designing/writing code methods.

1) Arduino code.
A- Opened week 6 assignment code.
B- Did some checking by compiling and uploading as it is.
C- After that added new Serial communication codes for processing to read and receive. i wrote this with the help of the tutorials and placed it on top of void loop so that i control 2 modes together manual and GUI . The addition was as follow:
if (Serial.available()) {

char x = Serial.read();

if (x == '0') {

Serial.println("forward");

lcd.print("Moving forward");

digitalWrite(fpin, HIGH);

delay(500);

}

if (x == '1') {

Serial.println("backwards");

lcd.println("Moving backwards");

digitalWrite(bpin, HIGH);

delay(500);

}

}
D- 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.

As for making it smart device i added temperature sensor.
E- i added this code for my sensor
int temp = analogRead(sensor);

int mv = (temp / 1024.0) * 5000;

cel = mv / 10;

Serial.println(cel);
And then to make it control the motor to only start when it reaches certain temperature.
if (cel >= 25) {
code here
} else if (digitalRead(forward) == LOW || digitalRead(backward) == LOW) {

Serial.println("Cold Extruder");

lcd.setCursor(0, 1);

lcd.print("Cold Extruder");

delay(500);

digitalWrite(bpin, LOW);

digitalWrite(fpin, LOW);

} else {

digitalWrite(bpin, LOW);

digitalWrite(fpin, LOW);

}

3) Mobile application:
1- After downloading many applications i finally found suitable application for my smartphone,"Arduino bluetooth controller". I discovered that while practicing with video tutorials.
2- This Application is ready to use, can access terminal and also customize some button options as needed. As i changed the button command to send 1 and 0 for the terminal to read it.

2) Processing IDE code:
1- Downloaded and Installed according to the video tutorial.
2- By the help of other videos and "Controlp5" library (which i had to install also) i was able to write it easily.
3- Copy pasted codes related to the text label from library, also 2 button codes.
4- Edited in every code position and size according to my need like :
Under void setup()
Text label : positioned (80, 40) , yellow color text, font Georgia, font size 20 and wrote in it "The motor is moving: "
2 buttons: Forward and Backward were written on the button to indicate that the DC Motor direction is either Forward or Backward. I had set the position (100,100) (230, 100) so that they are equally aligned on a row, also size of the button for both according to the text size (120,45) and (130, 45) respectively. had to add .setBroadcast command so that it doesn't activate only once i needed it like every time so that's why it used.
5- As for the Serial communication i inserted Serial myport above void setup and also set the board rate and port for communication , i found out that i had to use (0) as port communication for my laptop which enabled me to serial communicate between both IDEs.
6- As for void draw function i used to write the code with the help of video tutorials which had explained each code , so that why i will not repeat it here. The code is as shown in pictures.
7-Clicked on RUN which is located left top corner to open the communication between them.
8- As i click on any buttons , its send 1 or 0 which navigates the Arduino to direct the motor accordingly.
9-As in the assignment of week 6 LCD was used to display the direction of the DC Motor , i presented that results in the Text box after the label above.

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?

For this week's assignment i used week 6's fabrication process and built upon it.

1) Fetched my components from the kit.(as shown in the pictures above)
2) Connected as i connected in week 6's assignment.
3) Checked by connecting it power.
As DC motor did not get enough current, i added upon last time diagram wire from vcc 5v to the "Motor Driver".
4)Also added HC-05 module: and connected as follow: it has 6 pins.
1st pin from the right and from the left are not used left empty.
2nd pin from the right which wrote VCC to 5V on bread board on 5th column.
3rd pin GND : to the ground row of the Bread board beside the positive pin.
4th pin TX: to the RX on the board which is located 0 pin.
5th pin RX: to the TX on the board which is beside 0 pin 1.
normally to connect 5th pin voltage divider is used so that the module runs safely but as this module which i have is high quality and can withstand 5v of TX, so i did not use any voltage divider.
5) Added thermistor sensor LM35 it has 3 pins
1st pin vcc 5v
2nd middle pin out : A0
3rd pin Gnd

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 doubts about my activity. I learned that ultrasonic sensors has minimum and maximum range to detect an object which i did not take into consideration.
Also in the assignment i had problems in connecting my HC-05 module with my smartphone also tried MIT inventor application also did not work. but my instructors and peers gave many suggestions, i tried to follow them until i finally succeeded.
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.
My peers also are kind enough to help me out throughout my week by giving me support and feedback like when i asked about the motor driver not working properly , (as shown in the picture)
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) Connecting my smartphone with HC-05 module was very challenging , i had to stop and research more about it as i used voltage divider even downloaded the Application suggested by the Diploma, still did not work. I then turned to my peers as 1 of them had the same issue and instructed me to change the Application, observation: not every Application works on every smart phones, so my advice to all is to download and install as many applications and by trial and error in the end the right application will be discovered. For me it was Arduino Bluetooth controller as shown in the picture.

2) As for writing code in processing for the first time it was very challenging also getting new kind of error every time. Still by troubleshooting it and doing more research i finally got my answers.

Silly mistakes by me were many i would recommend the readers do not lose hope even if you feel down by not having all the answers.

Final Project

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

This week i acquired user interface knowledge with GUI "Processing" and mobile app with HC-05 module. This will definitely empower me to accomplish my nice to have features 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?

The coolest thing will be able to connect Arduino UNO board with any smart phone by just small blue tooth module called HC-05. i will never forget the excitement felt while connecting it for the first time in my life, and specially the feeling of happiness when actually worked after too many trouble shooting.

Weekly Digest [OPTIONAL]

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

GUI user interface was new to my knowledge, still challenge and explore new field of knowledge which in the end the result was as follow: Sonar Device.


Assignment Design Files