PSZ 19:16 (Pind. 1/07) UNIVERSITI TEKNOLOGI MALAYSIA DECLARATION OF THESIS / UNDERGRADUATE PROJECT REPORT AND COPYRIGHT Author’s full name : MOHD RIDHUAN BIN SELAMAT Date of Birth Title A BLIND : 17 MARCH 1991 : A BLIND SPOTSYSTEM DETECTION SYSTEMON BASED ON ULTRASONIC SPOT DETECTION BASED ULTRASONIC SENSING SENSING. Academic Session : 2013/2014 I declare that this thesis is classified as: CONFIDENTIAL (Contains confidential information under the Official Secret Act 1972)* RESTRICTED (Contains restricted information as specified by the organization where research was done)* MOHD RIDHUAN BIN SELAMAT OPEN ACCESS I agree that my thesis to be published as online open access (full text) I acknowledged that Universiti Teknologi Malaysia reserves the right as follows: 1. The thesis is the property of Universiti Teknologi Malaysia 2. The Library of Universiti Teknologi Malaysia has the right to make copies for the purpose of research only. 3. The Library has the right to make copies of the thesis for academic exchange. Certified by: UNIVERSITI TEKNOLOGI MALAYSIA NOTES: SIGNATURE SIGNATURE OF SUPERVISOR 910317-01-5271 DR. HERMAN BIN WAHID (NEW IC NO/PASSPORT) NAME OF SUPERVISOR Date: 19 JUNE 2014 Date: 19 JUNE 2014 * If the thesis is CONFIDENTAL or RESTRICTED, please attach with the letter from the organization with period and reasons for confidentiality or restriction. “I hereby declare that I have read this thesis and in my opinion this thesis is sufficient in terms of scope and quality for the award of the degree of Bachelor of Engineering (Electrical – Instrumentation and Control)” Signature : …………………………….. Supervisor : Dr. Herman Bin Wahid Date : 16th June 2014. A BLIND SPOT DETECTION SYSTEM BASED ON ULTRASONIC SENSING MOHD RIDHUAN BIN SELAMAT A thesis submitted in fulfilment of the requirements for the award of degree Bachelor of Engineering (Electrical – Instrumentation and Control) Faculty of Electrical Engineering Universiti Teknologi Malaysia JUNE 2014 iii I declare that this thesis entitled “A Blind Spot Detection System based on Ultrasonic Sensing” is the result of my own research except as cited in the references. The thesis has not been accepted for any degree and is not concurrently submitted in candidature of any other degree. Signature : ……………………………… Name : Mohd Ridhuan Bin Selamat Date : 16 June 2014 iv Dedicated, in thankful appreciation for support, encouragement and understanding to my beloved mother, father, sister, brothers and friends v ACKNOWLEDGEMENT Alhamdulillah, Prise to Allah for His guidance and blessings that this project has finally completed. Firstly, I would like to express my greatest gratitude to my respected supervisor Dr Herman Bin Wahid for his humble guidance, encouragement, patient enthusiasm, invaluable support and motivation through the whole completion of this project. This project would not be succeeded without her continuous support. Secondly, I would like to drop my sincere appreciation to thank to my family who have been tolerant, motivated me and support me all these year in accomplishing this project. Thanks for their encouragement, love and emotional supports that they had given to me. Last but not least, I would like to express my heartiest appreciation to my friends and SEI member’s batch 2010 and those whom involve directly or indirectly with this project. There is no such meaningful word than. Thank You So Much. vi ABSTRACT Driving a vehicle in modern traffic conditions is highly risky. In fact, if the driver is not aware of the presence of a vehicle or obstacle in his blind spot, a crash can easily occur. The goal of this work is to suggest a solution to improve a driver’s safety when changing lanes on the highway, which focuses on the low-end vehicle. The Blind Spot Detection (BSD) system based on wireless detecting technique is proposed to monitor the blind spot region for the presence of obstacles, automobiles or other objects, in vehicle application. Two parts of BSD system are mounted nearly on the left side area at the flat surface body of car. Meanwhile, another two parts are mounted on the right side at the flat surface body of the vehicle. The detection of cars in the blind spot region is displayed by warning light indicators. The BSD system algorithm proposed here is based on a distance calculation between the object. The ultrasonic sensor is programmed at certain parameter or distance to detect upcoming vehicle, object or obstacle to activate the warning light indicator circuitry. Upon the detection, the device triggers the activation of light indicator circuitry for a certain period of time, at the different alert zones. If the blind spot region of the vehicle can be minimized, it is expected the accident cases could be reduced significantly. vii ABSTRAK Memandu kenderaan di dalam keadaan trafik moden adalah sangat berisiko. Malah, kemalangan boleh berlaku jika pemandu tidak sedar akan kehadiran kenderaan atau halangan di tempat titk buta kenderaan. Matlamat kerja ini ialah untuk mencadangkan jalan penyelesaian untuk meningkatkan keselamatan pemandu kenderaan berteknologi rendah apabila menukar lorong di lebuh raya. Sistem Pengesanan titik buta atau BSD system ini berdasarkan teknik pengesanan tanpa wayar yang dicadangkan untuk memantau kawasan titik buta kenderaan seperti kehadiran halangan , kereta atau objek lain. Dua bahagian BSD system dipasang di cermin hampir sisi pada permukaan rata kenderaan. Sementara itu, dua bahagian lain dipasang di belakang pada permukaan rata kenderaan. Pengesanan kereta di kawasan titik buta kenderaan dipaparkan dengan memberi amaran penunjuk cahaya. Algoritma sistem BSD dicadangkan di sini adalah berdasarkan pengiraan jarak antara objek. Penderian ultrasonik diprogramkan pada jarak tertentu untuk mengesan kenderaan, objek atau halangan yang akan datang bagi mengaktifkan litar penunjuk lampu amaran, pada zon-zon yang berbeza. Sekiranya kawasan titik buta kenderaan dapat dikurangkan, ia dijangka kes kemalangan boleh dikurangkan dengan ketara . viii TABLE OF CONTENTS CHAPTER 1 2 TITLE PAGE DECLARATION OF THESIS ii DEDICATION iv ACKNOWLEDGEMENT v ABSTRACT vi ABSTRAK vii TABLE OF CONTENT viii LIST OF TABLES xi LIST OF FIGURES xii LIST OF ABBREVIATIONS xv LIST OF APPENDICES xvi INTRODUCTION 1.1 General Introduction 1 1.2 Problem Statement 2 1.3 Project Objectives 4 1.4 Project Scopes 4 1.4 Thesis Outline 5 LITERATURE REVIEW 2.1 Introduction 6 2.2 Blind spot detection system 6 2.3 The invention ideas of BSD system 9 2.3.1 9 A Wireless Sensor-Based Driving ix Assistant for Automobiles based on ultrasonic sensing [8]. 2.3.2 Ultrasonic sensor based blind spot 13 accident prevention system [10]. 2.4 The concept of ultrasonic sensor 14 2.5 Advantages of ultrasonic sensing compare to 15 another system sensing in BSD system 3 METHODOLOGY 3.1 Project workflow 18 3.2 BSD system development 19 3.3 Hardware Development 19 3.3.1 20 Block diagram and Flowchart of BSD system 3.3.2 Circuit design of BSD system 21 3.3.3 Main components in circuitry 23 3.3.4 Main components in the circuitry of 27 warning light indicator 3.3.5 Structure design and installation of BSD 31 system 3.4 Software implementation 33 3.4.1 34 Arduino UNO and Arduino Promini Programming 3.5 System integration: interfacing hardware and 34 software BSD system 4 RESULTS AND DISCUSSION 4.1 Introduction 35 4.2 BSD position experiment 36 4.3 Activation of BSD system one the left side sensor 37 of small car. 4.4 Activation of BSD system on the right side sensor of small car 39 x 4.5 5 6 Discussion 42 CONCLUSION AND RECOMMENDATION 5.1 Conclusion 43 5.2 Recommendation for Future Work 44 PROJECT MANAGEMENT 6.1 Introduction 46 6.2 Project Schedule 46 6.3 Cost Estimation 47 REFERENCES 51 APPENDIX A 53 APPENDIX B 55 xi LIST OF TABLES TABLE NO. TITLE PAGE NO. 3.1 The specifications of HC-SRO4 ultrasonic sensor. 24 3.2 The Arduino Uno Specifications. 29 6.1 The Project Gantt chart for semester one 46 6.2 The Project Gantt chart for semester two. 47 6.3 The cost estimation for assembling the circuitry of 48 wireless ultrasonic sensor 6.4 The cost estimation for assembling the circuitry of 49 warning light indicator 6.5 The total cost estimation for BSD system. 50 xii LIST OF FIGURES FIGURE TITLE PAGE NO. NO. 1.1 The blind spot definition 2 1.2 The ford car with Blind Spot Information System 3 (BLIS) 2.1 The model of BMW (5series) having BLIS system 8 2.2 The volvo model having BLIS system 8 2.3 The layout of the driving assistant 10 2.4 The responses of indicators in various scenarios 11 2.5 The placement of sensor. 12 2.6 The LED meter of this driving assistant 13 2.7 The basic concepts of „ping‟ and „pong‟ 14 3.1 The flowchart of the project workflow. 18 3.2 The system setup block diagram of BSD system of 20 circuitry for warning light indicator 3.3 The system setup block diagram of BSD system of circuitry for wireless ultrasonic sensor. 20 xiii 3.4 The flow chart of BSD system 21 3.5 The schematic diagram of the circuitry of warning 22 light indicator. 3.6 The Arduino Promini 23 3.7 The HC-SRO4 ultrasonic sensor 24 3.8 The block diagram of NRF24L01 transceiver. 25 3.9 The NRF24L01 transceiver module (Transmitter). 25 3.10 The battery supply 9v 26 3.11 The hardware development of BSD system of the 27 circuitry of wireless ultrasonic sensor 3.12 The Arduino UNO 28 3.13 The NRF24L01 transceiver module (Receiver). 29 3.14 The LED 30 3.15 The buzzer 30 3.16 The hardware development of BSD system of the 30 circuitry of warning light indicator 3.17 The drawing of installation BSD system on the car. 31 3.18 The prototype model of installation BSD system on 32 small car. 3.19 The prototype model of installation BSD system on 32 small car. 4.1 The installation of BSD system on prototype car. 36 4.2 The GREEN LED on the left side of the warning light 37 xiv indicator was activated . 4.3 The rear left side sensor of BSD system was activated 38 4.4 The front left side sensor of BSD system was 38 activated. 4.5 The GREEN LED on the right side of the warning 39 light indicator was activated. 4.6 The rear right side sensor of BSD system was 40 activated. 4.7 The front right side sensor of BSD system was 40 activated. 4.8 The completed result of BSD system experiment. 41 5.1 XL-MaxSonar-EZL1Sensor. 44 xv LIST OF ABBREVIATIONS LED Light Emitter Diode BLIS Blind information system BSD Blind spot detection BSR Blind spot region CPU central processing unit PCB printed circuit board PWM Pulse Width Modulation AVR Advanced Virtual RISC USB Universal Serial Bus AC Alternating Current DC Direct Current I/O Input/Output CSN Chip Select Not xvi LIST OF APPENDICES APPENDIX TITLE PAGE A DATASHEET OF COMPONENTS 53 B BSD SYSTEM CODING 55 CHAPTER 1 INTRODUCTION 1.1 General introduction Driving a vehicle in modern traffic conditions is highly risky. The high risk could occur if the driver watching the oncoming road hazards and at the same time look backward in highways driving. It is essential to look both sideway and backward before safely change the lanes. A problem that often concerned by the driver is the areas cannot be seen by side view and rear view mirrors, which is called as blind spot region of vehicle. In several accident cases it is happened because of a driver’s inability to monitor the blind spots region well. In Figure 1.1, the area almost commonly called to blind spot is the rear quarter blind spots, area towards the back of the vehicle on both sides. Vehicles in the adjacent lanes of the road may fall into these blind spots, and a driver may be unable to see adjacent vehicle using only the car's mirrors. Other areas that are sometimes called blind spots are those that are too low to see behind and in front of a vehicle. Also, in cases where side vision is hindered, areas to the left or right can become blind spots as well [1]. 2 Figure 1.1: Blind spot definition 1.2 Problem Statement Nowadays, technology in vehicles has been rapidly increasing to reduce the risk of accident while driving vehicle. There are many research proposed based on the driving assistance system focusing on the blind spot region [16]-[20]. The modern technology based on sensors like camera, laser, ultrasonic and radar are most likely applies in high-end and high-tech vehicle to monitor blind spot region. Volvo vehicle was first introduced BLIS system that produced alert system if there any vehicle enter blind spot region. Volvo vehicle implement two door mounted lenses to check the blind spot area and functionally for driver to change lanes. After a decade, Volvo vehicle improve their BLIS system by using radar-based detector to monitor in blind spot region. Which the LED light on A-pillar will glow to detect the presence entity vehicle [2][3]. 3 Ford vehicle also implement the same BLIS system that Volvo developed. As shown in Figure 1.2, Ford vehicle places radar-based detectors near the rear of the car, but the light that flashes to warn driver of hidden vehicle is on the outside rear view mirror. Audi vehicle also introduced Audi Side Assist that will detect cars coming up from as far as 150 feet (45.7 meters) behind in adjoining lanes and flash a light in external rear view mirror [3]. Figure 1.2: The ford car with Blind Spot Information System (BLIS) All of the high-end and high-tech cars are most likely to have embedded system of blind-spot detection and these active blind spot detection systems are not available for low-end vehicle. This blind spot detection system in high-end vehicle is also remade act as driving assistance system for driver and implement into low-end vehicles. However, the high product price and installation cost and the capability of the product functional are the some of the factor which do not attract the low end users to use BLIS system. The driving assistance of blind spot detection or monitoring system for vehicles is highly desirable to low-end vehicles to monitor 4 blind spot region. So the research of blind spot detection system with high ratio of capability and more affordable price for low-end vehicle is an important task to reduce collision among vehicle. 1.3 Project Objectives The objectives of this project are: 1. To design a portable and wirelessly controlled BSD system for low-end vehicle 2. To design suitable algorithm to calculate distance for detecting object when vehicle enter the blind spot region. 3. To design a hardware system for producing visible alert when a vehicle enter the blind spot region. 1.4 Project Scopes They a several scopes of work have been determined are as follows: • BSD system that focusing quarter blind spot region vehicle. • BSD system is suitable apply for car, van and small lorry. The proposed system will use ultrasonic technology, hence some limitations are expected such as: 5 • The detection angle is only 15deg, thus the sensor need to be located properly to cover the region of interest (BSR). Therefore a special tool needs to be designed to fix the position of the sensors at certain angle. • The sensitivity of the sensors needs to be analyzed, as it may cause some delay in the detection process. Hence, an algorithm will be used to compensate this delay. 1.5 Thesis Outline This project involves six chapters. Chapter 1 consists of the introduction of the project that explains the project in general. The problem statement will be discussed based on some issues and problems that related to this project. The objectives of the project will be discussed and scope of the project is explained. Chapter 2 contains literature review that related with this project. The explanation is based on gathered information from the journal, thesis, internet, reference books and relevant article. Chapter 3 contains research methodology that explains in detail the overall project flow of BSD system. Chapter 4 contains hardware and software implementation and in Chapter 5 the results and analysis are discussed. Finally, Chapter 6 contains the conclusion and recommendation of the project. CHAPTER 2 LITERATURE REVIEW 2.1 Introduction Literature review was carried out throughout the whole project to gain knowledge and improve skills needed to complete this project. The main sources for this project are previous related projects, research thesis, books, journals and articles which are mostly obtained from online databases provided by UTM and UTM library. This chapter focuses on the basic concepts and all fundamental theories which related to this project. 2.2 Blind spot detection system Blind spot detection system is device that really essential to monitor blind spot region while driving vehicle in modern traffic condition. Collision among vehicle can often occur if the driver did not properly well check the blind spot region during changing the lane. The surrounding area of the driver and the condition 7 current of situation for potential hazard need to be considered as driver want to change the lanes. Situation awareness (SA) in the perception and recognition phases is important when a person has time on hand such as when changing lanes. SA can be classified into three levels [4][5]: Level 1: Perception of elements in the environment Level 2: Comprehension of current situation Level 3: Projection of future status Hence, approximately 75% of the accident during lane changes is due to driver Situation Awareness failure [4][6]. Blind spot monitoring system is essential to improve visibility and reduce the blind zone in order to implement safety driving. Nowadays, blind spot monitoring system is implemented in several vehicles. Normally, high-end and high-tech vehicle using embedded system of blind spot monitoring. Meanwhile, low-end vehicle need driving assistance of blind spot monitoring system. Either embedded system or driving assistance the aim is only one to improve safety while driving a vehicle. For example, BMW (5series) model have the active blind spot detection to alert driver if there any upcoming potential hazard in blind spot zone. From Figure 2.1, active blind spot detection system of BMW (5series) model help to eliminate blind spots and actually allows drivers to avoid collisions when changing lanes, literally keeping your gaze straight ahead. Using radar sensing to detect entity vehicle and placed at the rear of the vehicle. This system alerts drivers if a vehicle is in their blind spot region vehicle. The light display on their side-view mirror housings begins to flash and also steering wheel vibrate [7]. 8 Figure 2.1: Model of BMW (5series) having BLIS system From Figure 2.2, another example of implementation of blind spot monitoring system. The Volvo vehicle use based on radar sensing that informs the driver about vehicles in the blind spots on both sides of the car. It is also detect and alerts the driver to rapidly approaching vehicles up to 70 meter behind the car [2]. Figure 2.2: The Volvo model having BLIS system 9 2.3 The invention ideas of BSD system The main purpose of invention ideas of BSD system is to understand method used in previous research of blind spot monitoring system before applying to this project. There are several ideas of invention that related to blind spot information system: 2.3.1 A Wireless Sensor-Based Driving Assistant for Automobiles based on ultrasonic sensing [8]. In this research paper, the system acts as a driving assistant for vehicles that detects the obstacle or object within the monitored area and alert the driver via tactile, audio and visual signal. This driving assistant is based on ultrasonic sensing approach. The system contains five separate components: four of them are the sensor modules and the fifth one is the controller. The nodes are connected in the sequel that attached to body of the car. Meanwhile, controller responsible for coordinating the operation of the nodes and then process the data for presenting alerts to the driver. The two front corners on both sides of the vehicle are covered by sensor modules. While the blind spot areas are the most likely ones to be neglected by drivers, the two front corners are found to produce the highest accident rates [8][9]. As shown in Figure 2.3, it shows the correlation among the system components. All five modules are makes around the same processing unit consisting of a microcontroller and radio transceiver. The sensor modules consist of ultrasonic sensors in the same time the controller connected to three types of indicators such as LEDs panel, buzzer, and the vibrators mounted on the steering wheel [10]. 10 Figure 2.3: Layout of the driving assistant (adapted from: http://www.suurland.com/blueprints_archive.php) Related to this research, there are four crucial parts need to be considered. There are sensor, indicator, wireless communication and modules. The driving assistant detect the object or obstacle via ultrasonic proximity sensor (PING))) TM Ultrasonic Sensor, Parallax Inc). Another alternative for detection the object is via infrared sensor but infrared sensors lack the accuracy of their ultrasonic counterparts due to the ambient noise and infrared radiation [8]. According to Table 2.4, the indicator will be functional and alerts the driver if object enter the blind spot region zone. Vehicle is classified safe and the all the indicators deactivated if there are no obstacles or object are present in zone 1 and 11 zone 2. Meanwhile, LED indicators are turned on to provided alert to driver if the objects enter in zone 1 and will be considered as “mildly threatened”. Hence, when object enter zone 2, the vehicle is classified “threatened”. LED indicators, either the vibrators or the buzzer are turned on [8]. Table 2.4: The responses of indicators in various conditions [10]. Sensor Number 0 1 2 3 Zone Activated Indicator 0 None 1 LED 0 2 LED ),Left Vibrator 0 None 1 LED 1 2 LED1, Right Vibrator 0 None 1 LED 2 2 LED 2, Buzzer 0 None 1 LED 3 2 LED 3, Buzzer The wireless communication is connected between the sensor and the ultrasonic sensor. Advantage of using wireless connection is the easy installation. It also did not need more space for wiring the blind spot detection system. 12 2.3.2 Ultrasonic sensor based blind spot accident prevention system [10]. In this research paper, the system based on proximity detection device is using radio frequency waves for detecting object. It includes three parts: I. Front sensor, left sensor and right sensor. The front sensor is functional to detect seasonal black spots. This sensor will monitor presence of any entity and warn the driver about the upcoming risk in cases of temporary blind spot. In Figure 2.5, it shows the placement of sensor attach on body of the car. The left and right sensor will cover the blind spot at rear of car. Figure 2.5: The placement of sensor. 13 II LED meter As shown in Figure 2.6, the LED meter functional based on the sensor to alert the driver about entity object or possible risk. The LED meter was divided into three part activation. If the left sensor detect the object the left hand side LED meter will be activated. While, if right sensor detect the object the right hand side LED meter will be triggered. Hence, the front hand side LED meter indicate risk of front sensor. Figure 2.6: The LED meter of this driving assistant 2.4 The concept of ultrasonic sensor Ultrasonic signals are like audible sound waves, except the frequencies are much higher. The ultrasonic transducers have piezoelectric crystals which resonate to a preferred frequency and convert electric energy into acoustic energy and vice versa [11][12]. 14 The illustration in Figure 2.7 shows how sound waves, transmitted in the shape of a cone, are reflected from a target back to the transducer. An output signal is produced to perform some kind of indicating or control function. A minimum distance from the sensor is required to provide a time delay so that the "echoes" can be interpreted. Variables which can affect the operation of ultrasonic sensing include: target surface angle, reflective surface roughness or changes in temperature or humidity. The target can have any kind of reflective form - even round objects. Figure 2.7: Basic concepts of „ping‟ and „pong‟ 15 2.5 Advantages of ultrasonic sensing compare to another system sensing in BSD system. Several system sensing can be applied for monitoring blind spot region. For example, there are three types of sensor systems onboard vehicle for lateral object detection [13]: I. Ultrasonic sensor system II. Doppler radar system III. Vision system The ultrasonic technique has unique advantages over conventional sensors such as infrared or reverse sensor when used for sensing functions (Larson, 1960) [12]: Discrete distances to moving objects can be detected and measured. Less affected by target materials and surfaces, and not affected by color. Solid state units have virtually unlimited, maintenance free life. Have ability to detect small objects over long operating distances. Have resistance to external disturbances such as vibration, infrared radiation, ambient noise, and EMI radiation As reported by [13] ultrasonic sensor system offers the following advantages: It is less expensive and will be suitable for general vehicle applications. It can easily obtain distance information immediate objects without complex computation detection. It has wide surface measurement, not just single point 16 For the Doppler radar systems, the system involved high manufacturing cost and limited for high-end cars only [8]. Radar system is normally has blind spots and a smaller view. The range of blind spots depends on the number of the installed radars. Besides, due to the limited detection distance for radar system, it is difficult for radars to detect an object moving in a large area [14]. Furthermore, radar sensor is complicated to use, because of the need of CPUintensive image processing techniques. In addition, the high of project cost need a more complex processing platform, which would also increase the cost of their encasing sensor modules [8]. In the vision system, there are several problems need to be considered. The cost involved much computation time to extract useful information. Real-time performance is a challenge issue for vision-based systems. At night, it would be difficult to use because of lighting condition will also influence the image acquisition [15]. ` Based on these three systems sensor, the ultrasonic sensor is better rather than using Doppler radar system or vision system to apply in BSD system. It is because of the cost to build this system sensing is much less expensive and it can easily obtain the distance of the object without complex computation of detection process. CHAPTER 3 METHODOLOGY This chapter explains the methodology applied in this project to ensure the successfulness of the project objectives. Starting from the overall workflow of the project and followed by Hardware and Software development of BSD system. The hardware and software system integration and testing will be described at the end of this chapter 18 3.1 Project workflow The overall workflow of the project is illustrated in Figure 3.1. Each stage of the workflow is described below. Figure 3.1: Flowchart of the project workflow. 19 3.2 BSD system development BSD system is developed based on imitation and some improvements of previous works done. Hardware and software development are two crucial parts needs to be considered in this BSD system. The hardware development is more on the components used, the designation of circuit and the real shape of BSD system. Meanwhile, the software development is based on how to program the brain (i.e. central processor) of the circuitry of wireless ultrasonic sensor and the circuitry of warning light indicator 3.3 Hardware development The project continues with the hardware development of BSD system. There are two major parts in this hardware development of BSD system which are the circuitry of wireless ultrasonic sensor and the circuitry of warning light indicator. 20 3.3.1 Block diagram and flowchart of BSD system Figure 3.2: System setup block diagram of BSD system of circuitry of warning light indicator. Figure 3.3: System setup block diagram of BSD system for wireless ultrasonic sensor circuit. 21 Figure 3.4: Flow chart of BSD detection system 3.3.2 Circuit design of BSD system Designing the circuit is the crucial part for this project. This is important due to the functional performance of the sensor depends on the quality of the designed. The Frizing and Eagle software have been used to design the circuit of circuitry for wireless ultrasonic sensor and circuitry for warning light indicator. As shown in Figure 3.5, it is the schematic diagram of the circuitry of warning light indicator, designed using Eagle software. After the design had been completed, the circuit is then tested on proto-board. Proto-board is used to implement the components that had been designed in circuit design step before implementing it on the PCB or donut 22 board for soldering the components. This is important to know whether the sensor will be functioning as well as follow to the desired output of BSD system or not. In this project, I had implemented the circuitry of wireless ultrasonic sensor and the circuitry of warning light indicator first on the proto-board to test the functionality of both circuits. The circuitry of wireless ultrasonic sensor will detect the object or obstacles. After that, warning light indicator will respond the signal from the circuitry of wireless ultrasonic sensor and activated the LED or buzzer inside the warning light indicator. The programming will be discussed more on the software implementation and in APPENDIX B. Figure 3.5: The schematic diagram for the circuitry of warning light indicator. 23 3.3.3 Main components in the circuitry of wireless ultrasonic sensor Figure 3.6 shows the hardware development of BSD system for the circuitry of wireless ultrasonic sensor. It contains of four main components which are: 1. Arduino Promini 2. Ultrasonic sensor 3. NRF24L01 Transceiver module 4. Power supply 9v In this project, Arduino Promini was chosen to act as a brain for the circuitry of wireless ultrasonic sensor. It is because of its compact size dimension and also more economic as compared to another microcontroller. Besides, the functionality of input and output pins are the same with Arduino UNO. The Arduino Promini is shown in Figure 3.6. Figure 3.6: The Arduino Promini Figure 3.7 shows the HC-SR04 ultrasonic sensor which is the main sensor used in this project. The HC-SR04 ultrasonic sensor uses sonar to determine distance to an object like bats or dolphins do. It offers excellent non-contact range detection 24 with high accuracy and stable readings. The sensor operation is also not effected by sunlight. The detail of this sensor had been attached in the APPENDIX A. Figure 3.7: HC-SRO4 ultrasonic sensor The specifications of this HC-SR04 ultrasonic sensor are shown in Table 3.1. It is described the principle of this sensor, the working current needed to operate this sensor, the validation angle detected and the ranging distance to detect object. Table 3.1: The specifications of HC-SRO4 ultrasonic sensor. Power Supply 5 V DC Quiescent Current <2mA Working Currnt <15° Effectual Angle: 15deg Ranging Distance 2cm – 400 cm/1" - 13ft Resolution 0.3 cm Measuring Angle: 30 degree Trigger Input Pulse width 10uS Dimension: 45mm x 20mm x 15mm 25 The third element is NRF24L01 transceiver transmitter module. This element functions by transferring the signal from the circuitry of wireless ultrasonic sensor to the circuitry of warning light indicator. This element is important in this project due to the BSD system circuit connection is based on wireless connection. Figure 3.8 and Figure 3.9 illustrate NRF24L01 transceiver module and the block diagram of NRF24L01 transceiver respectively. The details of this component had been attached at the APPENDIX A. Figure 3.8: The block diagram of NRF24L01 transceiver. Figure 3.9: The NRF24L01 transceiver module (Transmitter). 26 Figure 3.10 shows the battery supply 9v that had been chosen for supply the current and voltage in order to operate components in the circuitry of wireless ultrasonic sensor. Figure 3.10: The battery supply 9v Figure 3.11 shows the complete hardware development of BSD system for circuitry of wireless ultrasonic sensor. It consists of four circuitry of wireless ultrasonic sensor and needs to be installed at certain of area vehicle’s body. 27 Figure 3.11: The hardware development of BSD system for the circuitry of wireless ultrasonic sensor. 3.3.4 Main components in the circuitry of warning light indicator The hardware development of BSD system for the circuitry of warning light indicator contains of four main components which are: a. Arduino UNO b. NRF module for receiver c. LED d. Buzzer Microcontroller acts as the main brain of this project. Without it, the system cannot function as we expected. Arduino Uno was chosen for this project to act as a brain of circuitry for warning light indicator as it is a single-board microcontroller for 28 multipurpose project discipline. As shown in Figure 3.12, Arduino UNO board consists of an ATmega328 which is 28-bit AVR microcontroller with complementary components to facilitate programming and incorporated into other circuit. It has 14 digital input and output pins of which 6 can be used as PWM outputs, and 6 analogue inputs. For this project, I used digital and analogue pin as an output which are three digital pins to make LED red activated, three analogue pins to make LED orange activated, two digital pins to make LED green activated and five digital pins to activate NRF24l01 module receiver. Figure 3.12: The Arduino UNO. The Arduino UNO can be powered by the universal serial bus (USB) connection or with an external power supply such as battery, power band and AC-toDC adapter. In this project, I chose to use USB because as it is easily to make my system portable and easily to power up it in the vehicle and during system test. Table 3.2 shows the Arduino UNO basic specifications 29 Table 3.2: Arduino Uno Specifications. Microcontroller Atmel ATmega328 Operating Voltage (logic level) 5V Input Voltage (recommended) 7-12 V Input Voltage (limits) 6-20 V Digital I/O Pins 14 (of which 6 provide PWM output) Analog Input Pins 6 DC Current per I/O Pin 40 mA Flash Memory 33 KB SRAM 2 KB EEPROM 1 KB Clock Speed 16 MHz Figure 3.13 shows the element called as NRF24L01 transceiver receiver module. It is functioned by receiving the signal from the circuitry of wireless ultrasonic sensor. This element is important in this project to make the LED and buzzer in the circuitry of warning light indicator activated. Figure 3.13: The NRF24L01 transceiver module (Receiver). 30 Figure 3.14 and Figure 3.15 are shows the output of the circuitry of warning light indicator. It will be functioned depending on the instruction which is programmed in the circuitry of warning light indicator. The programming instruction had been described more detail in APPENDIX B. Figure 3.14: LEDs Figure 3.15: Buzzer Figure 3.16 shows the completed hardware development of BSD system for the circuitry of warning light indicator. Figure 3.16: Hardware development of BSD system for circuitry of warning light indicator 31 3.3.5 Structure design and installation of BSD system This part will mention about the installation of BSD system on the car. The Figure 3.17 shows the drawing of installation of BSD system on the car. Two parts of the circuitry of wireless ultrasonic sensor are mounted on the left side at the flat surface of the car. Meanwhile, another two parts are mounted on the right side at the flat surface of the car. The detection of cars in the blind spot region is displayed by warning light indicators that had been put on the dashboard of car. Figure 3.17: The drawing of installation BSD system on the car. 32 Figure 3.18: BSD system. As illustrates in Figure 3.19, it is the prototype model of installation BSD system on a miniature (small) car. Figure 3.19: Prototype model of installation BSD system on miniature (small) car. 33 3.4 Software implementation The next step is software implementation which is designing the suitable algorithm to calculate distance for detecting object when vehicle enter blind spot region. To program the code of this BSD system, it must uses the Arduino software version 1.5.4. It is the latest version that released by the Arduino company. The code which is used in Aduino programming is based on C++ programming in Java. 3.4.1 Arduino UNO and Arduino Promini Programming Arduino is an open-source physical computing platform based on a simple input/output (I/O) board and development environment that implements the processing/wiring language. Both of Arduino UNO and Arduino Promini programming are the same. This is one of the advantages when using the Arduino as microcontroller. To program and upload the code into the Arduino UNO and Arduino Promini microcontroller, it must be connected to the computer with a USB A/B cable. USB cable acts as a program connector between Arduino and computer. In Arduino Promini microcontroller used in the circuitry of wireless ultrasonic sensor, the digital pin D6 and D7 have been set as the input of Ultrasonic sensor. Then, the digital pin D9 to D13 for activate NRF24L01 transmitter. The set of program code for the circuitry of wireless ultrasonic sensor was repeated for the preparation of another three sets. For the Arduino UNO microcontroller used in the circuitry of warning light indicator, the digital pin D8 to D13 had been set to activate NRF24L01 receiver and the digital pin D3to D7 and analogue pin A0 to A3 as the output to activate LED and BUZZER. Based on the programmed codes, the digital pin D6 and D7 will be activated to detect the object from detection range. The NRF24L01 34 transmitter will transmit the signal or data from the distance read by the ultrasonic sensor. The NRF24L01 receiver will react to receive the signal or data from the NRF24L01 transmitter. The LED and BUZZER will be activated to show the warning alert. The overall programming codes are attached in APPENDIX B. 3.5 System integration: interfacing hardware and software BSD system Next, the project continues by interfacing hardware and software BSD system. The testing of hardware and software BSD system is carried on until the desired BSD system is obtained. CHAPTER 4 RESULTS AND DISCUSSION 4.1 Introduction This chapter discuss regarding the experiments carried out to monitor blind spot region. The experiments carried out is BSD system positioning. In this BSD system positioning experiment, there are three zone needs to be considered which are the objects behind, left and right of the sensor, the objects next to the rear left and right of the sensor, and the object next to the front left and right of the sensor. The rear left and right of the sensor were activated by triggering ON the GREEN LED in the warning light indicator to indicate NO objects entered the blind spot area. Then, the rear left and right of the sensor were activated by triggering the blinked GREEN LED in the warning light indicator to indicate objects entered the first zone of blind spot area. This situation is called as first alert zone. The front left and right of the sensor will be activated by triggering ON the RED LED and ORANGE LED in the warning light indicator to show objects entered the second zone of blind spot area. 36 4.2 BSD position experiment Figure 4.1 demonstrates the installation of BSD system on the prototype car. Two circuitry of wireless ultrasonic sensor were installed on the rear and front left side of small car. Meanwhile, another circuitry of wireless ultrasonic sensor was installed on rear and front the right side of small car. The circuitry of warning light indicator was put at the dashboard of small car. Figure 4.1: The installation of BSD system on prototype car. 37 4.3 Activation of BSD system on the left side sensor of small car. As shown in Figure 4.2, the GREEN LED on left side of warning light indicator was activated to show there is NO object entered at the rear left blind spot region. This situation is called safe zone on the left side area. Figure 4.2: The GREEN LED on the left side of the warning light indicator was activated. The Figure 4.3 shows the rear left side sensor of BSD system was activated. It is activated when the object enter the rear blind spot region of small car. The GREEN LEDs in the warning light indicator was blinked for a second to show the first upcoming potential hazard on the left blind spot area. At the same time, BUZZER was triggered on follow the blink of GREEN LED. This situation is called first alert zone on the left blind spot area. 38 Figure 4.3: The rear left side sensor of BSD system was activated. When the object keep moving as shown in the Figure 4.4, the front left side sensor of BSD system was activated due to the object enter the front blind spot region of small car. Three of RED LEDs in the warning light indicator was triggered ON and triggered OFF until the object moving out of left blind spot area. Figure 4.4: The front left side sensor of BSD system was activated. 39 4.4 Activation of BSD system on the right side sensor of small car. As illustrated in Figure 4.5, the GREEN LED on right side of warning light indicator was activated to show there is NO object entered in the right blind spot region. This situation is called safe zone on the right side area. Figure 4.5: The GREEN LED on the right side of the warning light indicator was activated. Figure 4.6 shows the rear right side sensor of BSD system was activated. It is activated when the object enter the rear blind spot region of small car. The GREEN LED in the warning light indicator was blinked for a second to show the first upcoming potential hazard on the right blind spot area. At the same time, BUZZER was triggered on follow the blink of GREEN LED. This situation is called first alert zone on the right blind spot area. 40 Figure 4.6: The rear right side sensor of BSD system was activated. Figure 4.7, the front right side sensor of BSD system was activated because of the object entered the front right blind spot region of small car. Three of ORANGE LEDs in the warning light indicator was triggered ON and triggered OFF until the object moving out of right blind spot area. Figure 4.7: The front right side sensor of BSD system was activated. 41 Figure 4.8: The complete results of BSD system experiment. 42 4.5 Discussion This section will discuss on the problems encountered during the process of completing this project. There are a lot of errors during development of hardware and programming of BSD system. The first problem, it is hard to interface between the circuitry of wireless ultrasonic sensor and the circuitry of warning light indicator. The ultrasonic sensor detected object but the warning light indicator did not receive the signal from the ultrasonic sensor. To overcome this problem, I had troubleshot the circuit connection of BSD system using multi meter. The problem was determined due to the misconnection between trigger pin of ultrasonic sensor and CSN pin of the NRF240L01. The problem was solved and the BSD system functions as expected which follows the desired output of BSD system. Another problem is the performance of BSD system installed at the small car is not stable. Sometimes, the BSD system was activated while at certain time, the BSD sensor was not activated properly. This problem occurred due to the no enough current supplied to operate Arduino Promini in the circuitry of wireless ultrasonic sensor. To overcome this problem, I had changed the battery supply that consists of high current to operate the Arduino Promini . As result, the performance of BSD system was become stable. CHAPTER 5 CONCLUSION AND RECOMMENDATION 5.1 Conclusion The prototype of the BSD system has been successfully developed to achieve the three objectives: 1 To design a portable and wirelessly controlled BSD system for lowend vehicle. 2. To design suitable algorithm to calculate distance for detecting object when vehicle enter blind spot region. 3 To design a hardware system for producing visible alert when a vehicle enter the blind spot region. Literature review on BSD system was successfully done by referring to previous projects conducted by others. The hardware of BSD system and software of BSD system were created at the end of this project. The system integration between the hardware and software of BSD system were successfully done. Through this project, a reliable and effective system is achieved to detect and monitor blind spot region of vehicle. It has been successfully tested, and the BSD system work well for the small scale of car. 44 5.2 Recommendation for future works For long range monitoring distance object, it is suggested to use the XL-MaxSonar-EZL1 Sensor instead of HC-SR04 Ultrasonic sensor. The XL-MaxSonar-EZL1 Sensor has many advantages which are: Can detect small object. Sensor small in size Maximum range of detecting object is1068cm (420 inches). Operating voltage from 3.3v to5.5v. Resolution 1cm Real time noise rejection algorithm Read from three sensor outputs: Analoq voltage, Serial and Pulse Width Figure 5.1: XL-MaxSonar-EZL1Sensor. CHAPTER 6 PROJECT MANAGEMENT 6.1 Introduction The objective of project management is to achieve all project goals with effective project, planning, organizing and controlling resource within a specified time period [15]. The primary constraints in this project are research scope, research time and research budget to perform required activity to achieve the required specifications. In this process, based on stated constraints, project schedule had been tabulated on Gantt chart. Next, cost estimation on the components is performed to ensure minimal project cost while keeping project to achieve the desired requirement. 6.2 Project schedule Table 6.1 shows project Gantt chart for semester one. The majority of the work done in the first part of the project was focused on proposing and 46 understanding of the project through literature review. In addition, much effort was spent to understand the blind spot detection system (BSD system) by referring to the previous work. Besides that, some effort also has been spent to understand the concept of the interconnected BSD system. Then, the work proceeds with the list of components design and model the BSD system. The important task of the first part of the project was the preparation for presentation as well as writing the first part of the project report. Table 6.1: Project Gantt chart for semester one Week Activities 2 3 4 5 6 7 8 9 1 11 12 13 14 15 16 0 1.Brief Idea FYP 2.Literature and 3.Study blind spot detector of vehicle 4. Study the journal, thesis and article related Semester Break theoretical study system. 5. Submit Proposal 6. List the components and model hardware configuration of blind spot detection system 7. Draw flowchart and block diagram of blind spot detection system. 8.Report preparation 9.Presentation Study Week to blind spot detection 47 Table 6.2 shows project Gantt chart for semester two which describes the possible task for the second part of the project with the estimated time that will be spent for each task. Firstly, the hardware implementation will be conducted. After completion of that part, the works continue by applying that software implementation and verify the performance of BSD system. Table 6.2: Project Gantt chart for semester two. Week 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Activities Study Week 1.Hardware implementation 3. Testing the product 4. Verify specification/ analysis Semester Break 2. Software implementation 5.Presentation 6.Thesis preparation 6.3 Cost estimation Table 6.3 demonstrates the cost estimation for assembling the circuitry of wireless ultrasonic sensor. The most expensive components in this board is Arduino Promini. As the circuitry of wireless ultrasonic sensor is designed in rather small dimension, so the small microcontroller is really needed. As far as stock availability 48 on closest warehouse and price concern, hence the Arduino Promini was selected in this project to act as a brain for the circuitry of wireless for ultrasonic sensor. Table 6.3: The cost estimation for assembling the circuitry of wireless ultrasonic sensor No Materials Quantity . Price Price per unit (RM) (RM) 1 Ultrasonic sensor 4 22.00 88.88 2 NRF240L01 module transmitter 4 15.00 60.00 3 Arduino Pro mini 4 30.00 120.00 4 Battery supply 9v 4 05.00 20.00 5 PCB connector 10 ways 2 01.00 02.00 6 Donut board 2 03.00 06.00 7 Resistor 0.25W 5% (330R) 9 00.05 00.60 8 Acrylic 2mm 1 10.00 20.00 9 PCB connector 4 ways 4 00.40 01.60 10 PCB connector 3 ways 8 00.30 02.40 11 Wire rainbow 1.5mm 0.5m 02.00 02.00 12 PCB connector 2 ways 4 00.20 00.80 13 Wire 1.5mm single core 1m 01.00 01.00 14 Battery holder 4 03.00 12.00 15 Voltage regulator LM 3.3V 4 05.00 20.00 Subtotal 336.48 16 17 Next, table 6.4 demonstrates the cost estimation for assembling the circuitry of warning light indicator. The most expensive components in this board is Arduino UNO. Although, the price quick expensive, the Arduino UNO was selected in this project to act as a brain for the circuitry of warning light indicator. 49 Table 6.4: The cost estimation for assembling the circuitry of warning light indicator No Materials Quantity . Price Price (RM) per unit (RM) 1 Arduino Uno 1 50.00 50.00 2 NRF240L01 module receiver 1 15.00 15.00 3 Donut board 1 03.00 03.00 4 LED 234 green 2 00.10 00.20 5 LED 234 orange 3 00.10 00.30 6 LED 234 red 3 00.10 00.30 7 Resistor 0.25W 5% (330R) 9 00.05 00.45 8 Buzzer 1 03.00 03.00 9 Wire rainbow 1.5mm 0.5m 02.00 02.00 10 PCB connector 10 ways 2 01.00 02.00 11 PCB connector 4 ways 2 0.40 00.80 12 PCB connector 2 ways 4 00.20 00.80 13 Wire 1.5mm single core 1m 01.00 01.00 Subtotal 76.85 14 15 50 Table 6.5 shows the total cost estimation for BSD system. The complete BSD system consists of the circuitry of wireless ultrasonic sensor board and the circuitry of warning light indicator board. The cost to build up this BSD system is about RM413.33. Table 6.5: The total cost estimation for BSD system. Components Subtotal The circuitry of wireless ultrasonic sensor RM336.48 The circuitry of warning light indicator RM76.85 Total RM413.33 51 REFERENCES 1. Ollis, M., H. Herman, et al. (1999). Analysis and design of panoramic stereo vision using equi-angular pixel cameras, Citeseer. 2. Volvo cars.com. (2013).Blind spot Information system. [Online].Available:http://www.volvocars.com/us/top/about/conceptcarsfuture vehicles/pages/default.aspx92013 3. Auto.howstuffworks.com (2013). Safety regulatory devices. [Online]. Available: http://auto.howstuffworks.com/car-driving-safety/safety regulatory-devices/cars-making-blind-spot-less-dangerous1.htm 4. Kuwana, J., M. Itoh, et al. (2013). Dynamic side-view mirror: Assisting situation awareness in blind spots. Intelligent Vehicles Symposium (IV), 2013 IEEE, IEEE. 5. M. R. Endsley, (1995). Toward a theory of situation awareness in dynamic systems .Human Factors, vol. 37, no. 1, pp. 32–64. 6. R. R. Kinpling, (1993). IVHS technologies applied to collision avoidance. Perspectives on six target crash types and countermeasures, in Proc. 1993 Annual Meeting of IVHS America, Surface Transportation: Mobility, Technology, and Society, pp. 249–259. 7. bmwusa.com (2013). Model highlights 528i sedan. [online]. Available: http://www.bmwusa.com/Standard/Content/Vehicles/2014/5/528iSedan/ ModelHighlights/528iSedanSafety.aspx?Id=377 8. Yu, F., B. Kaminska, et al. (2008). "A Wireless Sensor-Based Driving Assistant for Automobiles." ICGST-ACSE Journal, ISSN: 1687-4811. 9. Institute of Communications and Computer Systems (2005). Integrated Drivers’ Lateral Support System: The Lateral Safe Project [Online]. Available: 52 http://www.preventip.org/download/Events/20050601%20ITS%20Hannover %20papers/2683.pdf 10. Mahapatra, R., K. V. Kumar, et al. (2008). Ultra sonic sensor based blind spot accident prevention system. Advanced Computer Theory and Engineering, 2008. ICACTE'08. International Conference on, IEEE. 11. Watson, B., J. Friend, et al. (2009). "Piezoelectric ultrasonic micro/milli-scale actuators." Sensors and Actuators A: Physical 152(2): 219-233. 12. Tabib, M. and M. Tajudin (2008). Smart system of ultrasonic car parking, Universiti Malaysia Pahang. 13. Song, K.-T., C.-H. Chen, et al. (2004). Design and experimental study of an ultrasonic sensor system for lateral collision avoidance at low speeds. Intelligent Vehicles Symposium, 2004 IEEE, IEEE. 14. Lin, Y. R. and Y. H. Li (2010). "FPGA Implementation of a Vision-Based Blind Spot Warning System." World Academy of Science, Engineering and Technology: 896-900. 15. Kerzner, Harold R. Project management: a systems approach to planning, scheduling, and controlling. John Wiley & Sons, 2013. 16. R.P. Mahapatra, K.V. Kumar, G. Khurana, and R. Mahajan, "Ultra Sonic Sensor Based Blind Spot Accident Prevention System," in International Conference on Advanced Computer Theory and Engineering, pp. 992-995, 2008. 17. Diaz, E. Ros, S. Mota, G. Botella, A. Canas, S. Sabatini, "Optical Flow For Cars Overtaking Monitor: The Rear Mirror Blind Spot Problem," in IEEE Intelligent Vehicles Symposium, pp.50-57, Las Vegas, 2005. 18. A. Techmer, "Real-time motion analysis for monitoring the rear and lateral road," in Proc. IEEE Intel. Vehicles Symp., Parma, Italy, pp.704-709, 2004. 19. M. Krips, 1. Velten, A. Kummert, and A. Teuner, "AdTM tracking for blind spot collision avoidance," in Proc. IEEE Intel. Vehicles Symp Parma, Italy, pp. 544-548, 2004. 20. R. Okada, Y. Taniguchi, K. Furukawa, and K. Onoguchi, "Obstacle Detection Using Projective Invariant and Vanishing Lines. 53 APPENDIX A DATASHEET OF COMPONENTS 54 55 APPENDIX B BSD SYSTEM CODING 1. Programming of circuitry for wireless ultrasonic sensor REAR LEFT SIDE. #include <NewPing.h> #define TRIGGER_PIN 5 #define ECHO_PIN 4 #define MAX_DISTANCE 300. #include <SPI.h> #include <nRF24L01.h> char mypacket[3]; //int sendingByte; NewPing sonar_LB (TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); void setup() { Serial.begin(115200); Serial.begin(9600); Mirf.spi = &MirfHardwareSpi; Mirf.csnPin = 8; // define CSN pin Mirf.cePin = 9; // define CE pin Mirf.init(); Mirf.setRADDR((byte *)"00010"); // receiving address Mirf.setTADDR((byte *)"00010"); // transmitting address Mirf.payload = sizeof(mypacket); // up to 32 byte only Mirf.channel = 50; // pipeline channel Mirf.config(); } void loop() { delay(50) unsigned int uS_LB = sonar_LB.ping(); Serial.print("\n Ping: "); Serial.print(uS_LB / US_ROUNDTRIP_CM); Serial.println("cm"); if((uS_LB / US_ROUNDTRIP_CM) > 10) { mypacket[0]='L'; mypacket[1]='B'; mypacket[2]='O'; Mirf.send((byte *) &mypacket); while(Mirf.isSending()){} Serial.print("\n sending LB detected"); //delay (100); } 56 else if((uS_LB / US_ROUNDTRIP_CM) >0 && (uS_LB / US_ROUNDTRIP_CM) < 10) { mypacket[0]='L'; mypacket[1]='B'; mypacket[2]='F'; Mirf.send((byte *) &mypacket); while(Mirf.isSending()){} Serial.print("\n sending LB not detected"); delay (100); } 2. Programming of circuitry for wireless ultrasonic sensor FRONT LEFT SIDE. ---------------------------------------------------------#include <NewPing.h> #define TRIGGER_PIN 6 #define ECHO_PIN 5 #define MAX_DISTANCE 300 #include <SPI.h> #include <nRF24L01.h> ---------------------------------------------------------char mypacket[3]; //int sendingByte; NewPing sonar_LB(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); void setup() { Serial.begin(115200); Serial.begin(9600); Mirf.spi = &MirfHardwareSpi; Mirf.csnPin = 8; // define CSN pin Mirf.cePin = 9; // define CE pin Mirf.init(); Mirf.setRADDR((byte *)"00010"); // receiving address Mirf.setTADDR((byte *)"00010"); // transmitting address Mirf.payload = sizeof(mypacket); // up to 32 byte only Mirf.channel = 50; // pipeline channel Mirf.config(); } void loop() { delay(50); unsigned int uS_LB = sonar_LB.ping(); Serial.print("\n Ping: "); Serial.print(uS_LB / US_ROUNDTRIP_CM); Serial.println("cm"); 57 -------------------------------------------------------------------------if((uS_LB / US_ROUNDTRIP_CM) > 10) { mypacket[0]='R'; mypacket[1]='B'; mypacket[2]='O'; Mirf.send((byte *) &mypacket); while(Mirf.isSending()){} Serial.print("\n sending RB detected"); //delay (100); } else if((uS_LB / US_ROUNDTRIP_CM) > 0 && (uS_LB / US_ROUNDTRIP_CM) < 10) { mypacket[0]='R'; mypacket[1]='B'; mypacket[2]='F'; Mirf.send((byte *) &mypacket); while(Mirf.isSending()){} Serial.print("\n sending RB not detected"); delay (100); } } 3. Programming of circuitry for wireless ultrasonic sensor REAR RIGHT SIDE. // -------------------------------------------------------------------#include <NewPing.h> #define TRIGGER_PIN 6 #define ECHO_PIN 5 #define MAX_DISTANCE 400 #include <SPI.h> #include <nRF24L01.h> ----------------------------------------------------------------------char mypacket[3]; //int sendingByte; NewPing sonar_LB(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); void setup() { Serial.begin(115200); Serial.begin(9600); Mirf.spi = &MirfHardwareSpi; Mirf.csnPin = 8; // define CSN pin 58 Mirf.cePin = 9; // define CE pin Mirf.init(); Mirf.setRADDR((byte *)"00010"); // receiving address Mirf.setTADDR((byte *)"00010"); // transmitting address Mirf.payload = sizeof(mypacket); // up to 32 byte only Mirf.channel = 50; // pipeline channel Mirf.config(); } void loop() { delay(50); unsigned int uS_LB = sonar_LB.ping(); Serial.print("\n Ping: "); Serial.print(uS_LB / US_ROUNDTRIP_CM); Serial.println("cm"); ---------------------------------------------------------------------if((uS_LB / US_ROUNDTRIP_CM) > 0 && (uS_LB / US_ROUNDTRIP_CM) < 10 ) { mypacket[0]='F'; mypacket[1]='1'; mypacket[2]='O'; Mirf.send((byte *) &mypacket); while(Mirf.isSending()){} Serial.print("\n sending F1 detected"); } else if((uS_LB / US_ROUNDTRIP_CM) > 10) { mypacket[0]='F'; mypacket[1]='1'; mypacket[2]='F'; Mirf.send((byte *) &mypacket); while(Mirf.isSending()){} Serial.print("\n sending F1 not detected"); //delay (100); } else if((uS_LB / US_ROUNDTRIP_CM) == 0) { mypacket[0]='F'; mypacket[1]='1'; mypacket[2]='F'; Mirf.send((byte *) &mypacket); while(Mirf.isSending()){} Serial.print("\n sending F1 not detected"); } } 59 4. Programming of circuitry for wireless ultrasonic sensor FRONT RIGHT SIDE. // -------------------------------------------------------------------#include <NewPing.h> #define TRIGGER_PIN 6 #define ECHO_PIN 5 #define MAX_DISTANCE 400 #include <SPI.h> #include <nRF24L01.h> ----------------------------------------------------------------------char mypacket[3]; //int sendingByte; NewPing sonar_LB(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); void setup() { Serial.begin(115200); Serial.begin(9600); Mirf.spi = &MirfHardwareSpi; Mirf.csnPin = 8; // define CSN pin Mirf.cePin = 9; // define CE pin Mirf.init(); Mirf.setRADDR((byte *)"00010"); // receiving address Mirf.setTADDR((byte *)"00010"); // transmitting address Mirf.payload = sizeof(mypacket); // up to 32 byte only Mirf.channel = 50; // pipeline channel Mirf.config(); } void loop() { delay(50); unsigned int uS_LB = sonar_LB.ping(); Serial.print("\n Ping: "); Serial.print(uS_LB / US_ROUNDTRIP_CM); Serial.println("cm"); ---------------------------------------------------------------------if((uS_LB / US_ROUNDTRIP_CM) > 0 && (uS_LB / US_ROUNDTRIP_CM) < 10 ) { mypacket[0]='F'; mypacket[1]='2'; mypacket[2]='O'; Mirf.send((byte *) &mypacket); while(Mirf.isSending()){} Serial.print("\n sending F1 detected"); 60 } else if((uS_LB / US_ROUNDTRIP_CM) > 10) { mypacket[0]='F'; mypacket[1]='2'; mypacket[2]='F'; Mirf.send((byte *) &mypacket); while(Mirf.isSending()){} Serial.print("\n sending F1 not detected"); //delay (100); } else if((uS_LB / US_ROUNDTRIP_CM) == 0) { mypacket[0]='F'; mypacket[1]='2'; mypacket[2]='F'; Mirf.send((byte *) &mypacket); while(Mirf.isSending()){} Serial.print("\n sending F1 not detected"); } 5. } Programming of circuitry for warning light indicator ----------------------------------------------------------------#include <SPI.h> #include <nRF24L01.h> char mypacket[3]; int led = 4; int led_1 =7; int led_2 = 6; int led_3 = 5; int led_4 = A1; int led_5 = A2; int led_6 = A0; int led_7 = 2; int BUZZ = A5; ------------------------------------------------------------------void setup() { // initialize the digital pin as an output. pinMode(led, OUTPUT); pinMode(led_1, OUTPUT); pinMode(led_2, OUTPUT); pinMode(led_3, OUTPUT); pinMode(led_4, OUTPUT); pinMode(led_5, OUTPUT); pinMode(led_6, OUTPUT); pinMode(led_7, OUTPUT); pinMode (BUZZ, OUTPUT); Serial.begin(9600); 61 Mirf.spi = &MirfHardwareSpi; Mirf.csnPin = 9; // define CSN pin Mirf.cePin = 8; // define CE pin Mirf.init(); Mirf.setRADDR((byte *)"00010"); // receiving address Mirf.setTADDR((byte *)"00010"); // transmitting address Mirf.payload = sizeof(mypacket); // up to 32 byte only Mirf.channel = 50; // pipeline channel Mirf.config(); } ----------------------------------------------------------------void loop() { Mirf.getData((byte *) &mypacket); -----------------------------------------------------------------if(mypacket[0]=='L') { if(mypacket[1]=='B') { if(mypacket[2]=='O') { digitalWrite(led, HIGH); Serial.print("\n receive LB detected"); } else if(mypacket[2]=='F') { digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) digitalWrite(BUZZ, HIGH); delay(250); digitalWrite(led, LOW); digitalWrite(BUZZ, LOW); delay(250); Serial.print("\n receive LB not detected"); } } } ----------------------------------------------------------------------if(mypacket[0]=='F') { if(mypacket[1]=='1') { if(mypacket[2]=='O') { digitalWrite(led_1, HIGH); digitalWrite(led_2, HIGH); digitalWrite(led_3, HIGH); Serial.print("\n receive F1 detected"); 62 } else if(mypacket[2]=='F') { digitalWrite(led_1, LOW digitalWrite(led_2, LOW); digitalWrite(led_3, LOW); Serial.print("\n receive F1 not detected"); //delay (100); } } } -------------------------------------------------------------------if(mypacket[0]=='R') { if(mypacket[1]=='B') { if(mypacket[2]=='O') { digitalWrite(led_7, HIGH); Serial.print("\n receive RB detected"); } else if(mypacket[2]=='F') { digitalWrite(led_7, HIGH digitalWrite(BUZZ, HIGH); delay(250); digitalWrite(led_7, LOW); digitalWrite(BUZZ, LOW); delay(250); // turn the LED on (HIGH is the voltage level) Serial.print("\n receive RB not detected"); } } } ----------------------------------------------------------------------------if(mypacket[0]=='F') { if(mypacket[1]=='2') { if(mypacket[2]=='O') { digitalWrite(led_4, HIGH); digitalWrite(led_5, HIGH); digitalWrite(led_6, HIGH); Serial.print("\n receive F2 detected"); } else if(mypacket[2]=='F') { digitalWrite(led_4, LOW); digitalWrite(led_5, LOW); digitalWrite(led_6, LOW); 63 Serial.print("\n receive F2 not detected"); //delay (100); } } } } .-----------------------------------------------------------------------------------------------