Professional Documents
Culture Documents
Final Report
Final Report
Final Report
0 METHODOLOGY
6.1 Introduction
In this chapter, we describe about the steps and process to implement the project
activities which is from the beginning of the step until the end of the step. Other than
that, we also include the schematic diagram, block diagram and so on to make this
project more detail and clearly
6.2 Project Design and Overview
Project Design is the project details how the project will be managed. The explanation
of the writer's project design by using a suitable diagram should be placed here. This
explanation should include;
6.2.1 Plans and the procedures for research that span the decisions from
broad assumption to detailed methods of data collection and analysis.
6.2.2 The plan involves several decisions.
6.2.3 The overall decision involves which design should be used to study a
topic.
f
Figure 6. 2 Example of flow chart for the overall project
6.2.3 Project Description
In this subtopic, the project we created Smart Awareness Watch is using an Arduino
UNO where the function of this Arduino is to perform analog ang digital on this
machine. When using an Arduino, the coding needs to be filled in before we can make
the machine turn on and of the light automatically. We also created this project using
apps Proteus Professional 8 which can make it easier for users when operating it.
I. Arduino UNO
HC-05 is a Bluetooth module which can communicate in two ways. Which means, it is
full-duplex. We can use it with most micro controllers. Because it operates Serial Port
Protocol (SSP). The module communicates with the help of USART (Universal
Synchronous/Asynchronous Receiver/Transmitter) at the baud rate of 9600. and it also
support other baud rate. So, we can interface this module with any microcontroller which
supports USART. The HC-05 can operate in two modes. One is Data mode and other is
AT command mode. When the enable pin is "LOW" the HC-05 is in Data Mode. If that
pin set as "HIGH" the module is in AT command mode. Here we operate this module in
Data Mode.
A motion sensor, or motion detector, is an electronic device that uses a sensor to detect
nearby people or objects. Motion sensors are an important component of any security
system. When a sensor detects motion, it will send an alert to your security system, and
with newer systems, right to your mobile phone.
IV. Relay
Figure 4. Relay
6.3.1 Circuit Operation
The operating circuit for this project is that we create a model of a machine that can
be used to automatically turn off and on the lighting system. We use the Arduino
UNO which will be connected to switch, Bluetooth module apps, and motion sensor
that is how we turn it on, this machine model will do their job by itself without
controlling it much.
6.4 Project Software and Coding that were used in this project.
For this project, we used an ATmega328P to run the machine model we created as an
example. This ATmega328P, we need to enter the coding before we are on the model
robot. This coding we can insert into Arduino software and Proteus software which
we can also insert into circuits.
Figure 3.4 Example of coding that insert into Arduino software
Coding for Second Arduino UNO
#include <SoftwareSerial.h>
#include <Servo.h>
char pinsMode[54];
int pinsValue[54];
String feedBack;
String lcd[lcdSize];
unsigned long last = millis();
Servo servoArray[54];
String boardType;
String protectionPassword = "";
String appBuildVersion = "4.1";
void setup(void)
{
Serial.begin(9600);// set the data rate for the Hardware Serial port
mySerial.begin(9600);//you have to change this if you change bluetooth baudrate.
boardInit();
}
void loop(void)
{
lcd[0] = "Test 1 LCD";// you can send any data to your mobile phone.
lcd[1] = String(analogRead(1));// you can send any data to your mobile phone.
lcd[2] = String(random(1, 100)); // you can send any data to your mobile phone.
if ( mySerial.available() )
{
process();
}
update_input();
update_app();//will update all values in the mobile app.
}
void process() {
if (command == "digital") {
digitalCommand();
}
if (command == "pwm") {
pwmCommand();
}
if (command == "servo") {
servoCommand();
}
if (command == "terminal") {
terminalCommand();
}
if (command == "mode") {
modeCommand();
}
if (command == "allonoff") {
allonoff();
}
if (command == "refresh") {
refresh();
}
if (command == "password") {
changePassword();
}
if (command == "allstatus") {
feedBack = "refresh/";
allstatus();
}
}
void changePassword() {
String data = mySerial.readStringUntil('/');
protectionPassword = data;
}
String replyToApp = "Ok from Arduino"; //It can be change to any thing
void digitalCommand() {
int pin, value;
pin = mySerial.parseInt();
if (mySerial.read() == '/') {
value = mySerial.parseInt();
digitalWrite(pin, value);
pinsValue[pin] = value;
}
}
void pwmCommand() {
int pin, value;
pin = mySerial.parseInt();
if (mySerial.read() == '/') {
value = mySerial.parseInt();
analogWrite(pin, value);
pinsValue[pin] = value;
}
void servoCommand() {
int pin, value;
pin = mySerial.parseInt();
if (mySerial.read() == '/') {
value = mySerial.parseInt();
servoArray[pin].write(value);
pinsValue[pin] = value;
}
}
void modeCommand() {
int pin;
pin = mySerial.parseInt();
// mode_feedback = "";
if (mySerial.read() == '/') {
String mode = mySerial.readStringUntil('/');
if (mode == "output") {
pinMode(pin, OUTPUT);
digitalWrite(pin, 0);
pinsMode[pin] = 'o';
pinsValue[pin] = 0;
}
if (mode == "push") {
pinsMode[pin] = 'm';
pinsValue[pin] = 0;
pinMode(pin, OUTPUT);
digitalWrite(pin, 0);
}
if (mode == "schedule") {
pinsMode[pin] = 'c';
pinsValue[pin] = 0;
pinMode(pin, OUTPUT);
digitalWrite(pin, 0);
}
if (mode == "input") {
pinsMode[pin] = 'i';
pinsValue[pin] = 0;
pinMode(pin, INPUT);
}
if (mode == "pwm") {
pinsMode[pin] = 'p';
pinsValue[pin] = 0;
pinMode(pin, OUTPUT);
analogWrite(pin, 0);
}
if (mode == "servo") {
pinsMode[pin] = 's';
pinsValue[pin] = 0;
servoArray[pin].attach(pin);
servoArray[pin].write(0);
}
feedBack = "mode/" + mode + "/" + pin + "/" + pinsValue[pin];
allstatus();
}
}
void allonoff() {
int pin, value;
value = mySerial.parseInt();
for (byte i = 0; i < sizeof(pinsMode); i++) {
if (pinsMode[i] == 'o') {
digitalWrite(i, value);
pinsValue[i] = value;
}
}
}
void refresh() {
int value;
value = mySerial.parseInt();
refreshTime = value;
allstatus();
}
void update_input() {
for (int i = 0; i < sizeof(pinsMode); i++) {
if (pinsMode[i] == 'i') {
pinsValue[i] = digitalRead(i);
}
}
}
void update_app() {
if (refreshTime != 0) {
int refreshVal = refreshTime * 1000;
if (millis() - last > refreshVal) {
allstatus();
last = millis();
}
}
}
void allstatus() {
int digitalArraySize, analogArraySize;
if (boardType == "mega") {
digitalArraySize = 53;
analogArraySize = 15;
} else {
digitalArraySize = 13;
analogArraySize = 5;
}
String dataResponse;
dataResponse += "{";
void boardInit() {
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
for (byte i = 0; i <= 53; i++) {
if (i == 0 || i == 1 || i == arduino_rx_pin || i == arduino_tx_pin ) {
pinsMode[i] = 'x';
pinsValue[i] = 'x';
}
else {
pinsMode[i] = 'o';
pinsValue[i] = 0;
pinMode(i, OUTPUT);
}
}
#endif
}
7.0 Result
7.1 Introduction
This subtopic will go through the projected outcomes of this project. Before
beginning this project, whether software or hardware work, a proposal work had to
be created. It had to investigate some information about this project so that we could
picture the expected results and determine whether or not the effort was effective.
To finish this project, we followed all of the processes to ensure that it did not fail
after it was finished.
7.2 Expected Result