Week 7 - Journal

Ideation

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)

Have you EVER been to a production line or a workshop where several rotating machines and tools are there? If yes, you, surely, saw many of caution signs here and there for safety instruction! One of the most common safety signs is the one tells you or the operator to keep a safe distance away from a rotating machine, but... what if one violates this safety instructions?

Here is the automation role!

In the first part of this assignment I'll show you a smart protection system that halts dangerous rotating machine operation when individuals approach the machine in a non safe way ( beyond the safe distance).

Not only personal safety precautions are essential, but also those of machines are crucial as well. The second part of the assignment will demonstrate a smart cooling system that is enabled when system temperature reaches a certain preset level.

I used the ultrasonic sensor to detect if an object or a body is approaching the rotating machine unsafely, and if yes, the buzzer will be activated and the machine (DC motor) will be turned off. The machine will not operate as well as buzzer won't be turned off until there is no object/body within the safe distance from the machine (where ultrasonic sensor is mounted). For demonstrating this concept, I determined 20 cm. as a safe distance.

Besides, and for the sake of machine protection, I used the DC fan to represent the cooling system which will be activated upon a signal sent by the LM35 (Temp. sensor). I set 25 C as the temperature level to activate the machine cooling system.


Keep away - Rotating parts!

Image credit

Cooling system

Image credit

Tool Chain

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

Software:

Hardware:

Design/Preparation Process

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?

I started to 'drag and drop' the components of the circuit in design workspace in Tinker CAD.

The '5V' and 'GND' pins in Arduino were connected with the common rail +Ve and -Ve in the breadboard.

I used one channel relay (twice as I have only one in the kit 😅 ) to control the DC fan and DC motor while the buzzer were connected to digital pin (13) and the US sensor was connected with 5V, GND, 9 and 10 pins.

The two relay modules signals terminals were connected to 6 & 7 Arduino pins.

I used the SPDT relay available in Tinker CAD as it's more similar to the one provided in the kit.

A typical temperature sensor was connected with common 5V, GND and analog read pin (A0).

And there is the question....how ultrasonic sensor works?


For more information about the ultrasonic sensor, please visit this link.

After comprehending the ultrasonic sensor working concept and completing the connections between Arduino, ultrasonic sensor, temperature sensor, DC fan, DC motor, and buzzer, I started to code in Arduino IDE.

Screen shots for the coding lines in Arduino IDE are shown below 😄

Circuit simulation on Tinker CAD can be viewed from the video below 😄

You might notice that temperature range for DC fan activation is not accurate as in the code; this is due to that Temperature sensor in TinkerCAD is (TMP 36) which has different settings compared to the one used in the real circuit simulation (LM35).

Tinkercad circuit simulation with relay included.mp4

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?

I started to connect all components on breadboard as per Tinker CAD wiring as shown below. As I have only a single 'one channel relay', I divided the demonstration into two parts:

One: to show how ultrasonic sensor detects objects near the rotating machine, and triggers action upon object's distance from the machine/sensor.

The other: to show how temperature sensor detects the current system temperature, and how it activates/deactivates cooling system fan given the current temperature.

The last two photos above show the flowcharts for the two circuits programming. After writing the code, I performed the compiling check in Arduino IDE and here is the code lines:

// Industrial and Occupational Safety

int trig = 9;

int echo = 10;

int buzzer = 13;

long elapsed_time;

long distance; // distance form a machine with dangerous rotating parts.

// Machine safety - Cooling System Automatic Response.

int val;

int Relay1=7; // for cooling system activation

int Relay2=6; // for machine operation ON/OFF control


void setup() {

pinMode (trig, OUTPUT);

pinMode (echo, INPUT);

pinMode (buzzer, OUTPUT);

pinMode (A0,INPUT);

pinMode (Relay1,OUTPUT);

pinMode (Relay2,OUTPUT);


Serial.begin(9600);


}


// Personnel safety - Always keep a safe distance from rotating machines


void loop() {

digitalWrite(trig, LOW);

delayMicroseconds(2);

digitalWrite(trig, HIGH);

delayMicroseconds(10);

digitalWrite(trig, LOW);

elapsed_time =pulseIn(echo,HIGH);

distance = elapsed_time/29/2; // cm

Serial.print("Distance: ");

Serial.print('\t');

Serial.print(distance);

Serial.print('\t');

Serial.print(" cm");

Serial.print('\t');

if(distance <20) {

digitalWrite(buzzer,HIGH);

digitalWrite(Relay2,LOW);

}

else

{digitalWrite(buzzer,LOW);

digitalWrite(Relay2,HIGH);

}

// Machine safety - Cooling System Automatic Activation


val= analogRead (A0);

float mv= (val/1024.0)*5000;

float cel= mv/10;

Serial.print("Temp= ");

Serial.print('\t');

Serial.print(cel);

Serial.print('\t');

Serial.print("*C");

Serial.println();

if (cel>25){

digitalWrite (Relay1,HIGH);}

else

{digitalWrite (Relay1,LOW);}


}

A real circuit simulation is shown in the videos below after uploading the code to the Arduino. Instead of using a hot object or flame source, alternatively, I used the temperature sensor to detect the current room temp: 19~20 C (i.e. current system temperature) and I changed the temperature level in the code upon which fan will be activated/deactivated. I used 25 C and 18 C values to demonstrate action based on temperature sensor reading and temperature level preset in the code.

SFV1.mp4
SFV2.mp4

Afterwards, I started to place all circuit components in a breadboard enclosure and tested the circuit and ensured that it worked!

Distance-CB.mp4
Cooling fan-CB.mp4

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?

I participated with Ghazaly and Doaa in the MOW and EOW sessions practice respectively. All three of us, especially me, benefited a lot from the group work and shared the ideas how to correctly approach the tasks from planning, components wiring, coding, and troubleshooting! I can specify that during the EOW session, I had the chance to learn how to use a slide switch to choose between two modes of operation (Manual / Automatic) using Arduino IDE coding with the right wiring of components😄

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 assignment?

I was quite confused with the 'Relay' module; how it works and how it's connected with Arduino and other components in the circuit. With the kind help of Esraa and Sherif during the EOW (Saturday) session, I managed to understand and use the relay module correctly to power a smart home circuit components (Fan and light bulb)😄

Final Project

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

Switching between 'Manual' and 'Automatic' mode(s).

One of the essential features of my final project is to switch between two modes of operation; setup and running modes. During the hands on and EOW activities, I learnt how to implement a 'slide' or 'ON/OFF' switch to choose between two modes of operation which is essential to m project.

WOW!

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

I learnt the concept of 'Pseudo' code and how to use 'flow charts'' to plan my code and the functions that it's supposed to execute before writing the code itself.

Stand light lamp (Manual/ Automatic ) modes code flowchart

Weekly Digest [OPTIONAL]

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.


Title of Media


Assignment Design Files