Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q5 Figure Q5-1 shows a line-follower robot where it senses the line using four infrared sensors that being fixed at the front side of


student submitted image, transcription available belowstudent submitted image, transcription available belowstudent submitted image, transcription available belowstudent submitted image, transcription available below


 
 
 
 

 

Q5 Figure Q5-1 shows a line-follower robot where it senses the line using four infrared sensors that being fixed at the front side of the robot. When the infrared sensor senses the line, the output of the sensor is high, and low otherwise. The robot uses two DC motors to turn the left and the right wheels. To go forward, both wheels need to turn at the same speed. To turn right, the left wheel needs to turn faster than the right wheel, while to turn left, the right wheel needs to turn faster than the left wheel. The relations of the sensor input and the movement of the robot is illustrated in Figure Q5-2. The complete specification is given in Table Q5. 3D view NAME Side view | ... | Front view Figure Q5-1 Top view Robot direction Line/track Output from the sensor = 0110, The robot in the middle of the line, go forward Output from the sensor = 0011, The robot out of line to the left, turn right Output from the sensor = 1100, The robot out of line to the right, turn left IR sensors Figure Q5-2 Table Q5 Sensors output Robot movement 0000 Stop 0001 Turn right 0011 Turn right 0110 Go forward 1100 Turn left 1000 Turn left (a) The L293D motor driver is used to control the speed of the motors and the speed of the motor is determined by the pulse-width modulation (PWM) signal with different duty cycles that generated by the microcontroller. Write a sequence of codes using the mbed API to create a PWM signal with 20 KHz frequency and 70% duty cycle for both motors. (3 marks) (b) Draw a flowchart to devise a program for the robot. (7 marks) (c) Write a complete program using the mbed API based on your flowchart in Q5(b). (10 marks) (d) If the robot is connected to an analog light sensor on the top of the robot, it is now able to detect the light intensity of the navigation environment. Suppose that, the robot will immediately stop moving when the light level is less than 100 lux. By using the mbed API, write a sequence of codes to setup the ADC and stop the robot as stated by the specification given above. Assume that 100 lux is approximately 2.3 volt analog. (2 marks) (e) Now suppose that the light sensor in Q5(d) is replaced by the digital sensor that uses the SPI bus to interface with the microcontroller, (i) With the same specifications as in Q5(d), write a sequence of codes to setup the SPI and stop the robot when the light level is less than 100 lux. Assume that the digital value for 100 lux light intensity is 0x20. (2 marks) (ii) In SPI, one microcontroller is designated as the master. What is the function of the master? Indicate the minimum SPI link usage. (2 marks) (f) If a push button is used to stop the robot manually using interrupt signal, (i) Write a sequence of codes to setup the interrupt and stop the robot when the button is pressed. (2 marks) (ii) Modify your codes in Q5(f)(i) such that the robot will stop moving 5 seconds after the button is pressed using the mbed "Timeout" function. (2 marks)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

International Marketing And Export Management

Authors: Gerald Albaum , Alexander Josiassen , Edwin Duerr

8th Edition

1292016922, 978-1292016924

More Books

Students also viewed these Programming questions

Question

Why might a government impose a quota on a product?

Answered: 1 week ago

Question

3. If possible, break the presentation into clear steps or stages.

Answered: 1 week ago