PROJECT SEMM 3253 MECHATRONIC INTENET OF THING (IOT) SMART ZEBRA CROSSING NO NAME MATRIC NO SEC 1 MUHAMMAD AIMAN HAKIM BIN MOHAMAD AZMI A19EM0243 02 Table of Contents 1.0 PROJECT BACKGROUND.......................................................................................................................................................... 3 1.1 INTRODUCTION ........................................................................................................................................................................ 3 1.2 OBJECTIVE ................................................................................................................................................................................. 3 1.3 LITERATURE VIEW .................................................................................................................................................................. 3 1.4 OVERALL SYSTEM DESCRIPTION ....................................................................................................................................... 4 2.0 MECHANICAL DESIGN .............................................................................................................................................................. 6 2.1 DESIGN OF ENCLOSURE ........................................................................................................................................................ 6 2.2 ENGINEERING DRAWING WITH PROPER DIMENSION .................................................................................................. 7 2.3 EXPLODED VIEW ..................................................................................................................................................................... 7 2.4 ACTUAL DESIGN OF PROTOTYPE ....................................................................................................................................... 8 2.5 ANALYSIS OF COMPONENT SELECTION .......................................................................................................................... 9 2.6 TABULATION OF COMPONENT SELECTION ..................................................................................................................11 3.0 ELECTRICAL DESIGN ..............................................................................................................................................................12 3.1 SENSOR SELECTION ..............................................................................................................................................................12 3.2 ACTUATOR SELECTION .......................................................................................................................................................12 3.2 CIRCUIT DRAWING FOR ALL SYSTEM ............................................................................................................................13 4.0 SOFTWARE & CONTROLLER DESIGN ...............................................................................................................................14 4.1 SOFTWARE...............................................................................................................................................................................14 4.2 MICROCONTROLLER SELECTION .....................................................................................................................................15 4.3 FLOWCHART ...........................................................................................................................................................................16 4.4 CODING .....................................................................................................................................................................................17 5.0 PERFORMANCE ANALYSIS AND DISCUSSION ................................................................................................................19 5.1 PERFORMANCE ANALYSIS .................................................................................................................................................19 5.2 DISCUSSION.............................................................................................................................................................................20 6.0 PROJECT CONCLUSION AND VIDEO LINK ......................................................................................................................21 6.1 CONCLUSION ..........................................................................................................................................................................21 6.2 VIDEO LINK .............................................................................................................................................................................21 6.3 REFFERENCES .........................................................................................................................................................................22 1.0 PROJECT BACKGROUND 1.1 INTRODUCTION The Internet of Things (IoT) is a network of physical objects, including tools, machines, cars, buildings, and other things, that are connected to the internet and equipped with sensors, software, electronics, and circuitry. It makes it possible for items to be sensed and managed remotely over the top of the current network infrastructure, opening up possibilities for a closer connection between the physical world and computer-based systems and bringing about an increase in accuracy and efficiency. IoT has advanced quickly, and many supporting technologies have been created. The next Internet trend has been the Internet of Things. Everything in the world will become intelligent because of IoT projects have a wide range of potential. 1.2 OBJECTIVE The objective of this project is to design an IOT based on mechatronic system which is I already decided is to design a smart crossing zebra where it can be controlled automatically and wirelessly. In addition, it also consists of instrumentation system and actuation system. 1.3 LITERATURE VIEW A pedestrian crossing with white stripes is known as a zebra crossing or a marked crosswalk. Normal pedestrian priority over vehicular traffic exists, albeit the meaning of the markers may differ by region. They are called “zebra crossing” because of the way the stripes mimic a zebra's coat. In the United Kingdom, the first zebra crossing was installed on Slough High Street. Since 1930, pedestrian crossings equipped with Belisha beacons have been in operation in the UK. This practice was first established by Section 18 of the Road Traffic Act of 1934. The Belisha beacon, which bears the name of Leslie Hore-Belisha, Minister of Transport in 1934, is an upright crossing marking that is still necessary at zebra and parallel crossings in the United Kingdom. The beacons' usefulness, however, was decreasing as car traffic rose since both drivers and pedestrians were failing to use the crossing. Therefore, until the well-known black and white stripes were implemented, the then-named Ministry of Transport experimented with designs to improve visibility and promote utilization. At this time, zebra crossings were being tested at 1,000 test locations throughout the UK. George Charlesworth, a traffic engineer and physicist who served as the first director of the traffic section at the Road Research Laboratory, is credited with creating the zebra markings. 1.4 OVERALL SYSTEM DESCRIPTION In this Smart Zebra Crossing project, the overall system description can be divided into three subsystems which is the differs on the input and the output of the system where for the first sub-system is manually, second sub-system is automation and third sub-system is by using Blynk app to control the system. a) Manually Figure 1.4.1 Block Diagram for first sub-system Input Push Button Switch A/D Converter (ESP8266) Detailed System Description for Block Diagram i) Input = On/Off ii) A/D converter = NodeMCU ESP8266 iii) Output = iteration of LED and motor Output Motor b) Automation Figure 1.4.2 Block Diagram for second sub-system Output Input Transducer A/D Converter (ESP8266) Motor Detailed System Description for Block Diagram i) Input = presence of people ii) Transducer = IR sensor iii) A/D converter = NodeMCU ESP8266 iv) Output = iteration of LED and motor c) Blynk app Figure 1.4.2 Block Diagram for third sub-system Output Input Blynk app A/D Converter (ESP8266) Detailed System Description for Block Diagram i) Input = push button in Blynk app ii) Blynk app iii) A/D converter = NodeMCU ESP8266 iv) Output = iteration of LED and motor Motor 2.0 MECHANICAL DESIGN 2.1 DESIGN OF ENCLOSURE Figure 2.0 Assembly drawing (1) Figure2.1 Assembly drawing (2) 2.2 ENGINEERING DRAWING WITH PROPER DIMENSION 2.3 EXPLODED VIEW 2.4 ACTUAL DESIGN OF PROTOTYPE 2.5 ANALYSIS OF COMPONENT SELECTION The analysis of component selection is based on part of smart crossing zebra • Servo Motor An easy way to define a torque and speed that a servo motor produces depend on the current and voltage that are applied. A servo motor is a component of a closed-loop system, which delivers torque and velocity in response to commands from a servo controller and is sealed by a feedback mechanism. The term "servos" refers to electronic rotary or linear actuators that precisely spin and push machine parts. Angular or linear position, as well as specific velocity and acceleration, are controlled principally by servos. Due to the project's limited scope, I used a micro servo motor in this project • IR Sensor An electrical device that monitors and detects infrared radiation in its environment is called an infrared (IR) sensor. Since IR's wavelength is longer than that of visible light, it is not visible to the human eye. Infrared radiation is produced by everything that radiates heat. Infrared sensors come in active and passive varieties. However, I utilized active infrared sensors in this experiment, which can both emit and detect infrared light. An LED light emitting diode and a receiver are the two components of an active IR sensor. The receiver detects the infrared light from the LED that reflects off an object as it gets close to the sensor. Active IR sensors are frequently utilized in obstacle detection systems because they function as proximity sensors. • Push Button Switch A switch is an electrical component that may disconnect or connect the conducting channel in an electrical circuit, interrupting or directing the electric current from one conductor to another. However, the Push Button Switch can be described as the two terminals are either linked or separated from one another. The two terminals are normally disconnected (open) and are closed when the switch have been pressed. In this project, the Push Button Switch is used in order to input signal to the system. • LED A semiconductor light source called a light-emitting diode (LED) produces light when current passes through it. In comparison to incandescent light sources, LEDs have various benefits, such as lower power consumption, a longer lifespan, increased physical resilience, smaller size, and quicker switching. In this concept, LED is employed as the traffic signal for both drivers and pedestrians, with red LED designating a stop and green LED designating a pass. • Cardboard Cardboard is a generic term for heavy paper-based products. In this project, cardboard used as a platform for smart crossing zebra as well as barriers for the actuator system which is connected to the servo motor. 2.6 TABULATION OF COMPONENT SELECTION No Component Quantity 1 Node MCU ESP 8266 module 1 2 IR Sensor 2 3 Servo motor (SG90) 2 4 Push button switch 2 5 Red LED 4 6 Green LED 4 7 Yellow LED 2 8 Buzzer 1 9 Jumper wire As much as needed 10 Black cardboard (20x40) cm 1 11 Cardboard (30x50) cm 1 3.0 ELECTRICAL DESIGN 3.1 SENSOR SELECTION • IR Sensor In order to make the autonomous of process for smart crossing zebra, it required IR sensor. This is the economical sensor that can detect the any kind of appearance in form of infrared light. This sensor is crucial for this project to detect the pedestrians. By detecting the pedestrians that want to use the zebra crossing, the system can automatically initiate the process. 3.2 ACTUATOR SELECTION • Servo motor For the actuator, the servo motor is used to lift up the barrier after the system has been initiate. For this project, the servo motor needs to be set up to only rotate about 45 degrees. Therefore, servo motor SG90 is the best choice since it can control the angle of rotation. 3.2 CIRCUIT DRAWING FOR ALL SYSTEM 4.0 SOFTWARE & CONTROLLER DESIGN 4.1 SOFTWARE • Blynk app In this project, I utilized Blynk cloud and its mobile application (IOS) as our human interface. I have decided to control the servo motor and LED wirelessly via this mobile application where it can be said for maintenance purpose. Servo motor will rotate to 45 degrees as well as the barrier, yellow LED and buzzer will be turned ‘ON’ and it can be control through the blink app. Whenever the actuator system need to be service, it will be ease for the technicians to do their works. Figure 4.1.1 Blynk IOT website Figure 4.1.2 Blynk IOT app in smartphone 4.2 MICROCONTROLLER SELECTION A family of inexpensive, low-power microcontrollers called ESP8266 has built-in Wi-Fi and dual-mode Bluetooth. The primary purpose of the ESP8266 is to operate as a fully independent system or as a slave device to a host MCU, thereby lowering the communication stack overhead on the primary application processor. After installing the ESP8266-Arduino Core, the ESP works with the Arduino IDE, and the two are very nicely integrated. You get access to a large selection of ESP8266-based development kits as well as a sizable number of sample sketches when you install the ESP8266-Arduino Core. The ESP8266 can be used as a module or a NodeMCU. These are some of the distinctions between Arduino and ESP8266 that include The Arduino has a number of boards, whereas the ESP8266 only has one. While most Arduino boards, with the exception of a small number, lack wireless connectivity like Wi-Fi and Bluetooth, the ESP8266 does. Aside from that, the ESP8266 may connect to other systems via its SPI/ SDIO or I2C/ UART interfaces, enabling Wi-Fi and Bluetooth capability. One such system is the Blynk application. 4.3 FLOWCHART 4.4 CODING // Fill-in information from your Blynk Template here #define BLYNK_TEMPLATE_ID "TMPLVhu7J2SB" #define BLYNK_DEVICE_NAME "MY SERVO" #define BLYNK_FIRMWARE_VERSION "0.1.0" #define BLYNK_PRINT Serial //#define BLYNK_DEBUG #define APP_DEBUG // Uncomment your board, or configure a custom board in Settings.h //#define USE_SPARKFUN_BLYNK_BOARD //#define USE_NODE_MCU_BOARD //#define USE_WITTY_CLOUD_BOARD //#define USE_WEMOS_D1_MINI #include "BlynkEdgent.h" #include <Servo.h> #include <ESP8266WiFi.h> Servo servo; int irsensor1 = 0; int irsensor2 = 0; int REDLED = 0; int counter; int process; BLYNK_WRITE(V0){ if(param.asInt()==1){ servo.write(90); digitalWrite(14,HIGH); } BLYNK_CONNECTED(){ Blynk.syncVirtual(V0); } void setup(){ Serial.begin(115200); delay(100); servo.attach(12); BlynkEdgent.begin(); pinMode(5, INPUT); // IR SENSOR1 pinMode(16,INPUT); // IR SENSOR2 pinMode(13, INPUT); // Switch push button pinMode(2, OUTPUT); // Green LED pinMode(REDLED,OUTPUT); // Red LED pinMode(14,OUTPUT); // Yellow LED } void loop() { BlynkEdgent.run(); for (process = 0; process < 1; ++process) { int Switch = digitalRead(13); irsensor1 = digitalRead(5); irsensor2 = digitalRead(16); if (Switch == HIGH || irsensor1 == LOW || irsensor2 == LOW ){ for (counter = 0; counter < 3; ++counter) { digitalWrite(2,HIGH); delay(2000); digitalWrite(2,LOW); delay(1000); } digitalWrite(2,LOW); digitalWrite(14,HIGH); delay(2000); digitalWrite(14,LOW); digitalWrite(REDLED, HIGH); delay(2000); servo.write(90); delay(5000); }else{ digitalWrite(14,LOW); digitalWrite(REDLED,LOW); digitalWrite(2, HIGH); servo.write(0); } delay(1000); // Delay a little bit to improve simulation performance } delay(5000); } 5.0 PERFORMANCE ANALYSIS AND DISCUSSION 5.1 PERFORMANCE ANALYSIS For performance analysis in this project, I have done the testing on sensor system whether it is function or not as well the functionality of push button switch. Besides that, I also tested on the actuator system which is the servo motor on whether it can lift the barrier or not. Through this analysis, I have noticed that all components including sensor and actuator are working well. Next, for the further analysis I have tested on my project on how fast the response for the system after it receive the input signal from IR sensor and switch. By doing this analysis, I come to know that my servo motor is not lift up on the same time. The result of this analysis can be shown in the table below No. Testing 1 2 3 Times taken for servo motor start to rotate Servo motor 1 Servo motor 2 13.2 seconds 14.3 seconds 13.4 seconds 14.6 seconds 13.1 seconds 14.4 seconds 5.2 DISCUSSION Smart Zebra Crossing project consist of microcontroller, IR sensor, LCD screen, light indicator, motor and push button switch. This project basically based on logic control, sequences and remotely control. Logic control is referred to the function of IR sensor to detect the presence of pedestrians that want to cross the road by emitting the signal to microcontroller so that the lamp will start to change, then pillar can start to move upward automatically. Meanwhile, this project can be said to be sequence control since the acquire several steps in order to get the output of the system. First, the user must push the manual button or detected by IR sensor to give the data to the microcontroller. Then, the green lamp of the road will start to blink and turn off. After that, the yellow and red lamp will take a place where it will turn on to indicate the drivers should stop. Meanwhile, the two barriers will start to lift upward automatically with a certain timer that have been setup as well as the red lamp for pedestrians to crossing the road. This system helps to increase the safety to the people and also be more conventional compared to old crossing zebra. Based on the result obtained for the analysis of the time response for the system after received an input signal from IR sensor or push-button switch, it can be noticed that the servo motor 2 has longer delay for response compared to servo motor 1. I have figure out why the servo motor 2 has lower time response compared to the servo motor 1. This is because of the extended wire connection for servo motor 2 is longer than the servo motor 1. Therefore, the signal received by servo motor servo 2 is longer. So, it can be said that for two actuators that have own voltage input, need to connect simultaneously in order to have a same time response. Apart from that, this project also able to incorporate the Blynk App, which is a system necessity for this group project. The Blynk App offers the management for the servo motor, LED and buzzer function wirelessly via application on the Android and IOS gadgets. This indirectly makes it more convenient to the technician for maintenance purpose for this zebra crossing, which is easily regulated by a switch button in the Blynk app. For the overall performance of this project which is Smart Zebra Crossing, we can say that the whole components and sensors involved have been successfully operating at their best condition. 6.0 PROJECT CONCLUSION AND VIDEO LINK 6.1 CONCLUSION In conclusion, a lot of theories and information about electronic devices have been introduced in this project, which is very important for this course. The concept that our group chose for this group project is a smart city, and my idea is a Smart Zebra crossing. Based on an IOTbased mechatronic system, I have successfully designed a prototype of this smart zebra crossing. Three subsystems make up this Smart Zebra Crossing: a manual subsystem, an automated subsystem, and a third subsystem that uses the Blynk App to operate the system. This prototype also has been equipped with instrumentation system, actuation system and the human machine interface which working together to ensure the smooth working process of this Smart Zebra Crossing. Not only that, programming also has been done to make sure the prototype can run smoothly and function well while performing its duties. Furthermore, the use of NodeMCU ESP8266 which is a fast microcontroller like Arduino seems to be very useful because it is not only the low-cost open source IOT platform, but it can also provide integrated support with a WiFi and Bluetooth network connection with low energy consumption Last but not least, I also used the Mechatronics concepts I had learned, and I did a lot of online research to come up with ideas for the prototype design and its working mechanics. In addition, since a lot of coding is required to create this Smart Zebra crossing and ensure its functionality, I may also develop my programming skills. 6.2 VIDEO LINK Published on YouTube: https://youtu.be/6Q1KW3u5tpU 6.3 REFFERENCES i) "ZEBRA CROSSING | Meaning & Definition for UK English | Lexico.com". Lexico Dictionaries | English. Retrieved 2022-01-02 ii) Random Nerd Tutorial. (2019, May 6). ESP8266 Pinout Reference: Which GPIO pins should you use? https://randomnerdtutorials.com/esp8266-pinout-reference-gpios/ iii) Circuit Digest. (2017, January 18). What is a Servo Motor? - Understanding the basics of Servo Motor Working. https://circuitdigest.com/article/servo-motorworking-and-basics iv) A. (2019, September 23). Arduino with IR Sensor. Project HUB. https://create.arduino.cc/projecthub/Raushancpr/arduino-with-ir-sensor-1579b6 v) Jimblon. (2020, July 2). ESP8266 Thing Development Board Hookup Guide. Sparkfun Start Something. https://learn.sparkfun.com/tutorials/esp8266-thingdevelopment-board-hookup-guide/example-sketch-blink-withblynk#:~:text=Run%20the%20Project&text=Then%20click%20the%20%22Run%22 %20button,without%20uploading%20any%20new%20firmware.