Q5 Figure Q5-1 shows a line-follower robot where it senses the line using four infrared sensors...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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) 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)
Expert Answer:
Related Book For
International Marketing And Export Management
ISBN: 9781292016924
8th Edition
Authors: Gerald Albaum , Alexander Josiassen , Edwin Duerr
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Draw a total setup outline and decide the expense for the most economical design, i.e., the one where the complete expense of the correspondences circuits and equpment is the least. (b) The...
-
Consider the market for milk. Draw a supply curve and a demand curve (is the demand curve elastic on inelastic). Label the equilibrium price and quantity. Suppose that the production of milk causes...
-
Why might a government impose a quota on a product?
-
A, B, and C are three aldohexoses. Compounds A and B yield the same optically active alditol when they are reduced with hydrogen and a catalyst; A and B yield different phenylosazones when treated...
-
During the normal operating period, the deterioration of a machine usually a. decreases b. increases c. remains constant
-
The steps in the accounting cycle are listed in random order below. List the steps in proper sequence, assuming no worksheet is prepared, by placing numbers 19 in the blank spaces. (a) _____ Prepare...
-
Can we expect to see some long-term beneficial consequences from COVID-19 and its associated hysteria (mandatory business closure, social distancing, etc.)? Think about the Broken Window Fallacy and...
-
Lucky Mikes, Inc. has a target debt-to-equity ratio of 0.8, after-tax earnings forecast of $1,200,000, and needs $1,350,000 for new investments. There are 800,000 shares outstanding. Compute its...
-
The charges q = 3.0 x 10-7 C, 9 = -7.0 x 10-7 C, and q3 = -1.4 x 10-7 C are placed at the corners of the triangle shown below. What is the force on q, (in N)? (Assume that the +x-axis is to the right...
-
4. If a firm can sell 3,000 units of product A at $10 per unit and 5,000 at $8, then A. the price elasticity of demand is 0.44. B. A is a complementary good. C. the price elasticity of demand is...
-
A charged sphere in static equilibrium is resting on a horizontal surface. Directly above it is another charged sphere (also in static equilibrium) that is hanging from a string. The 50 kg red sphere...
-
We consider a small open economy producing two goods i = 1 , 2 . These goods are produced using only one factor of production, labor. We will denote by ai the quantity of labor required for the...
-
1) The James Webb Space Telescope (JWST), launched in 2021, is a giant infrared space telescope. If you have not taken a look, the images it captures are stunning! Like the Hubble Space Telescope,...
-
How did various visions of a reconstructed South differ? How did these visions reflect the old political and social divisions that had led to the Civil War?
-
Calculate the number of neutrons of 239Pu.
-
Fill in the Blank. In the finite element method, the solution domain is replaced by several ___________.
-
The simplest form of mass matrix is known as a. lumped-mass matrix b. consistent-mass matrix c. global mass matrix
-
What is a shape function?
Study smarter with the SolutionInn App