Elec 1601 Final Report PDF

Title Elec 1601 Final Report
Course Foundations of Computer Systems
Institution University of Sydney
Pages 9
File Size 301.9 KB
File Type PDF
Total Downloads 4
Total Views 142

Summary

Complete lab report of a project done in elec1601...


Description

Elec 1601 Final Report M18_3 Monday Lab 6pm-9pm

Group Members and SID Eden Cai 500002722 Ziwen Gu 500497113 Jack Yang 500218390 Wenjie Shi 470319066 Xinyu Wu 500078406 Yayoi Cao 500443660 HaoYang Deng George Wang 490212118

.

Page | 1

Executive Summary The overarching theme of the project was designated around Arduino’s function to maneuver with the aid of servo motor and IR sensor, detecting and generating a path for the robot to go through, the function is designed to be achieved through coding and Arduino building. Their interaction was thoroughly explored through the consistent experiment with the angles of IR sensor and adjusting direction and velocity of the motor. Throughout the project, the team M18A_3 was able to work through the assignment by dividing the project into three parts: 1:Manual Driving 2:Automatic Driving 3:Bluetooth connecting

Each parts were distributed to a subgroup of 2 from our group, whereas the rest two took duty to assist with any problem encountered while solving the problem. In relation to the implementation of each part, board of slave and master were employed for stablishing Bluetooth connection of the Arduino robot boards, as a two-way communication. The automatic driving part was intended to be achieved via detecting the color of the line beneath the robot while using adjusting the build of the robot to make it receive the sensor value in a distance-sensitive situation.

Material Used 1: IR sensor x 3 2: 220 ohm 3: 2k ohm 4: 10k ohm 5: Bluetooth 6: USB cable 7: push button 8: 390 ohm 9: 4700 ohm

Implementation of Material Relevant Materials: Bluetooth is considered a prime component of manual controlling part, it has been separated into two parts, namely slave board that set on the robot and master board that connected to controller. According to [1], to realise wireless communication, there is one component placed on the device that will be controlled and one set on the controller, such as Bluetooth earphone and smartphone, and they contact each other using radio waves, but the shortage is limited distance. Hence, Bluetooth is chosen to complete the first part of the project. In the automatic driving part for track, IR sensors have been considered a significant tool for detecting the track made by black tapes. The IR sensor consists of IR transmitter and receiver, every time the transmitter shines an infrared light, which expected to be received by infrared receiver as a signal. [2] There are two cases represented by “0” and “1” are that the receiver get Page | 2

the signal sent from transmitter and no signal received, since the difference between inside and outside of the track is the colour, respectively white and black. Additionally, white colour can reflect light back, but black colour cannot. Thus, Infrared sensors are suitable tool for autodriving of track. In the part about track without manual control, the robot should be able to go from the destination to start point following exactly same movement when it arrives to end point from beginning. The general thought is that when robot receives an instruction every time, the instruction will also be stored in memory. Until the robot finishes its journey, it starts to return and get instructions from memory. Moreover, EEPROM Library has been used in this case, the build-in function allows robot to store data in EEPROM memory that is “write()”, and read the EEPROM memory one by one using “read()”

Process Week9_Monday Lab First determine that the project option is Track Following Competition. Then, after discussion, the video conference will be conducted through zoom every Friday 12:00-13:00. In addition, complete the registration and setup of Trello and learn how to use CMapTools. Finally, the membership role of week9 is assigned as the following list:  The Reporter: Xinyu Wu  The Idea Curator: Weijie Shi  The Issue Tracker: George Wang  The Facilitator: Ruitao Yang Week9_Friday Meeting The meeting mainly carried out 4 tasks. First of all, discusses the number of sensors used and the result is that 3 IR Sensors are required to detect the front, left side and right side respectively. Secondly, discussed how does robot movement and the preliminary idea is divided into three parts. The first part is rotation: Use two different sensors to detect the left and right road (is it black); If black is detected on the left, the left wheel stops moving, and the right wheel moves forward to make the robot move to the left; otherwise, the right wheel stops moving, and the left wheel moves forward to make the robot move to the right. The second part is return: A memory needed to store all robot actions, and then reverse all actions. The third part is straight movement and stop: If the front detects black, go straight; If no sensor detects black, stop. Subsequently, divide the task of writing code into two parts and two people are responsible for each part. The first part of the code contains navigation manually and Bluetooth communication. The second part of the code contains navigation automatically and return used memory. The following is the distribution list:  The first part of the code: George Wang, Yifei Cao.  The second part of the code: Wenjie Shi, David Gu Page | 3

At last, decide on membership role of week9:  The Reporter: David Gu  The Idea Curator: Haoyang  The Issue Tracker: Yifei Cao  The Facilitator: Eden Cai Week10_Monday Lab First is the line connection, use IR receivers and IR emitters to build two IR Sensor and determine the connection between the robot and the sensor element. In this section, the IR sensor is improved by using two sensors instead of three to detect the left and right sides of tracks respectively. Next is the most important part of this lab, share code using codeshare and test code. There are some problems encountered in this section. Initially the port is failure and this problem has been resolved. Then, the robot continues to be turning left whether black line is beneath it. In order to solve this problem, some attempts and guesses were made as follow: Modify the line connection; Print value on Serial monitor when put black object on IR sensor ;Modify the code using analogRead instead of digitalRead; Guess it could be a resistance issues, resistance affects the detection distance; Guess the delay and tone duration used are not consistent. This problem was not solved in this laboratory. Week10_Friday Meeting To start with, each sub-divided group reporting their current progress in the part of the work they are assigned. Then, discuss some open issues: The code for manual control of robot movement needs to be tested during Lab11; The code for automatic control of movement is not yet integrated well with the IR sensor provided, needs to be fixed; Code for using Bluetooth needs to be done for testing during lab11. Finally, some comments on the subsequent work: the progress of revising and modifying code needs to be fastened and the efficiency in the lab needs to be improved to be able to experiment more code. Week11_Monday Lab The main purpose of this lab is to test the Bluetooth part of the code, but many components have failed. Therefore, it took a lot of time to troubleshoot. Firstly, IR sensors does not work correctly in week 10 and the main problem is in one of the IR sensors is malfunction so replace a new one and it works correctly. After that, the left wheel of robot does not work so change a new robot. Finally, there is an open issue is that the Bluetooth successfully connects but the code cannot work properly. Week11_Friday Lab Because the malfunction of multiple components affected the project process, apply for an extension Lab. This lab is mainly for the code test of the Bluetooth part. But the problem is the same as that of lab11. The Bluetooth is successfully connected but the code cannot run correctly. Page | 4

Week12_Monday Lab Firstly, improved the Bluetooth part of the code before lab starts: An error occurred during the judgment of if condition statement. It is speculated that the value entered manually may be different from the value recognized by the program, so the condition statement is changed. For example, when manually entering 1, it should be determined whether the input value is equal to 49. Finally, participate in project demonstration.

Analysis The prototype of the project was developed based on the left flowchart:

The flowchart was then trivialized into the flowchart on the right side with only 4 significant representative modules and their interaction was emphasized during our practice of coding and building.

Page | 5

Final prototype – Phase 1 In the first part, we need to control the car to move through Bluetooth transmission. The serial port on the Arduino UNO development board is 0->RX, 1->TX, and the function of the serial port has been configured inside the development board, we only need to call the function excuse. Through the function loop, we can set forward to two servos turning forward. Turning left means that the frequency of the left servo is greater than that of the right, turning right is the opposite, and going backward means the two servos reverse. Then when stopping, the two servos stop.

Pseudocode – part 1 Software Serial Port Setup

1. a.Serial port Baud rate 9600 b.Set Bluetooth module to default baud rate 38400 2.a.Declare left and right servos and assign to the connected pin value and pinMode of RxD and TxD. b.Check whether Master and Slave are already connected by polling the ConnStatus pin (A1 on SeeedStudio v1 shield) // This prevents running the full connection setup routine if not necessary. c.Checking Slave-Master connection status. If already connected to Master - remove USB cable if reboot of Master Bluetooth required. Otherwise remind not connected to Master. d.Set up the local (slave) Bluetooth module

e.Wait one second and flush the serial buffers

3.Set a loop to repeat. Read the data sent by the Bluetooth module to the serial port, check if there's any data sent from the remote Bluetooth shield. Page | 6

4.Check if there's any data sent from the local serial terminal. Then we input "W", “A, "S", "D" and “G” to indicate forward, left, back, right and stop respectively. 5. void forward() The left and right Servos rotate simultaneously at the same frequency void reverse() The left and right Servos rotate in reverse at the same frequency void turnLeft() Left and right Servos rotate at the same time but more frequently on the left void turnRight() Left and right Servos rotate at the same time but more frequently on the right void stopMoving() Left and right Servos stop working

6.a.Setting up the local (slave) Bluetooth module. b.Set the Bluetooth to work in slave mode c.Set the Bluetooth name using slaveNameCmd d.Auto-connection should be forbidden here e.Permit paired device to connect me // print() sets up a transmit/outgoing buffer for the string which is then transmitted via interrupts one character at a time. // This allows the program to keep running, with the transmitting happening in the background. // Serial.flush() does not empty this buffer, instead it pauses the program until all Serial.print()ing is done. // This is useful if there is critical timing mixed in with Serial.print()s. // To clear an "incoming" serial buffer, use while(Serial.available()){Serial.read();}

Final prototype – part 2 The robot has two IR sensors each is made of an IR LED and an IR receiver attached. The IR sensors are fixed on the left and right side of the front end, aiming down and minorly forward. The aiming points for the IR sensor are expected to be the two ends of the black track, such the robot would use the sensor to detect if it is moving along the track. Base on the detection result of IR sensors, the robot then makes an equivalent movement which includes moving forward, turning left, turning right and stop moving. In case of moving forward, the robot would have detected aim points as on the track. In case of turning left and right, the robot would have detected only one of the aim points is the track, so to make a turn for adjustment before moving forward. In case of stop moving, the robot would have detected both aim points to outside of the track, meaning it has reached the end of the track.

Pseudocode – part 2 Setup

1. Setup the robot with IR LED and IR receiver attached 2. Include servo library for the robot, Page | 7

3. Declare left and right servos and assign to the connected pin value 4. Declare variables to store values read from left and right IR receiver pins To determine if the robot is on track 5. Produce IR signal on both IR LED by generating a wave of 38000 kHz 6. Use IR receivers to read the reflected IR signal and store the value in variables declared a. Use digital read such the IR receiver will return: - 1 if no IR reflection detected - 0 if IR reflection detected b. Since black track absorb the IR signal and no reflection would be detected then a received value of 1 means detected black colour 7. Have 4 pre-defined functions, forwarding, left and right turning and stop moving 8. For each movement function set distance moved or degree turned by a. Write the specified value in the microsecond to left and right servos b. provide a delay time 9. Finally, base on the values received, If both IR values are 1, then move forward; only left IR value if 1, turn left; only the right IR value is 1, turn right; both values are 0, stop

Conclusion In conclusion, our coding practice and building of the robot were unable to lead a success in our project, as either one of the two parts were tested unsuccessfully during the practice. Tracing to the origin, the human uncontrollable environment was maintained as a decisive factor. Throughout the first three labs, two labs we had our time lost in our attempts to test and debug a IR sensor and the left side of Arduino motors which were both malfunctioning and later being replaced by one of the tutors who were able to perceive the malfunction after a long time of examining. This led to the fact that the precious lab time was not invested in code and build, as our progress hence became extremely unproductive. While environmental factor was preserved as a crucial issue, human factor was along significant to the failure as the Bluetooth connection needs to be implemented by the keyboard using remote control and sensors’ position needs to be adjusted to detect the track, whereas these function all failed to perform due to our lack of organization and communication within our group members. The future update of our project will be adjusting the location of the IR sensor to make it accept the sensor value within a longer distance. The code for the Arduino moving will be revised in accordance with the change of the build. Meanwhile, the RGB light will be made to indicate different instructions through different colors to aid in the manual driving part in order to make the robot user-friendly. A buzzer will be also be utilized to give warning when the detection range was unable to make the robot determine the direction of turning. Page | 8

Bibliography J. FERRARA. (Apr. 18 2016). “How do Bluetooth devices work?”. SCIENCELINE. https://scienceline.org/2016/04/how-do-bluetooth-devices-work/ (accessed Nov. 17 2020 [2]

ELECTRONICS HUB. “IR SENSOR”. https://www.electronicshub.org/ir-sensor/ (accessed Nov. 17 2020)

[3]

SM. (Dec. 24 2019). “EEPROM Library”. ARDUINO. https://www.arduino.cc/en/Reference/EEPROM (accessed Nov. 17 2020)

Appendices  Trello: https://trello.com/b/02CNx0mD/2020-elec1601m1803  CodeShare: https://codeshare.io/5On3xx

Page | 9...


Similar Free PDFs