Unit 4: Programming NodeMCU for PWM - Practice Quiz

ECE237 — Architecting Smart Iot Devices 60 Questions
0 Correct 0 Wrong 60 Left
0/60

1 Which technique is commonly used to control the brightness of an LED with a NodeMCU?

controlling the brightness of led Easy
A. Digital sound recording
B. Pulse Width Modulation
C. Serial data transfer
D. Analog temperature sensing

2 What happens when the PWM duty cycle of an LED is increased?

controlling the brightness of led Easy
A. The LED changes color
B. The LED becomes brighter
C. The LED stops receiving power
D. The LED becomes dimmer

3 What does a PWM duty cycle represent?

controlling the brightness of led Easy
A. The supply voltage value
B. The sensor response time
C. The wire length
D. The on-time percentage

4 Which duty cycle generally produces the dimmest LED in a PWM circuit?

controlling the brightness of led Easy
A. 0%
B. 25%
C. 100%
D. 50%

5 Which duty cycle generally produces the brightest LED in a PWM circuit?

controlling the brightness of led Easy
A. 60%
B. 0%
C. 20%
D. 100%

6 Why can an LED appear to glow steadily when controlled by PWM?

controlling the brightness of led Easy
A. Human vision averages rapid changes
B. The LED stores digital data
C. The NodeMCU removes all switching
D. The resistor creates light

7 What component is commonly used to limit current through an LED?

controlling the brightness of led Easy
A. Push button
B. Relay
C. Buzzer
D. Resistor

8 What type of motor is commonly positioned using PWM control?

servo motor control using pwm Easy
A. Stepper transformer
B. Induction motor
C. Universal motor
D. Servo motor

9 What does the pulse width usually determine in a hobby servo motor?

servo motor control using pwm Easy
A. Wire resistance
B. Battery capacity
C. Shaft position
D. Motor color

10 Which signal feature is most important for selecting a servo angle?

servo motor control using pwm Easy
A. Connector shape
B. Board temperature
C. Wire insulation
D. Pulse width

11 A typical hobby servo can commonly rotate through which range?

servo motor control using pwm Easy
A. About 3600 degrees
B. About 20 degrees
C. About 5 degrees
D. About 180 degrees

12 Which part of a servo motor provides feedback about its shaft position?

servo motor control using pwm Easy
A. Power switch
B. Heat sink
C. Position sensor
D. Fuse wire

13 What is the main purpose of the PWM signal sent to a servo?

servo motor control using pwm Easy
A. To detect light
B. To select an angle
C. To measure humidity
D. To store a program

14 Which connection is usually required for a servo motor to operate?

servo motor control using pwm Easy
A. Only a signal wire
B. Power and an antenna
C. Power, ground, and signal
D. Only two ground wires

15 What may happen if a servo motor does not receive enough power?

servo motor control using pwm Easy
A. It always rotates faster
B. It increases Wi-Fi range
C. It may move irregularly
D. It changes the PWM frequency automatically

16 What does PWM control in a DC motor?

dc motor control using pwm Easy
A. Motor paint color
B. Cable length
C. Wi-Fi password
D. Motor speed

17 What is the effect of increasing the PWM duty cycle on a DC motor?

dc motor control using pwm Easy
A. The motor becomes a sensor
B. The motor loses its shaft
C. The motor usually speeds up
D. The motor always reverses

18 Which component is commonly used to drive a DC motor from a NodeMCU?

dc motor control using pwm Easy
A. Light sensor
B. Microphone
C. Motor driver
D. Voltage meter

19 Why should a DC motor usually not be connected directly to a NodeMCU pin?

dc motor control using pwm Easy
A. It cannot use any electricity
B. It may draw too much current
C. It only works with light
D. It has no moving parts

20 Which device can be used to reverse the direction of a DC motor?

dc motor control using pwm Easy
A. Temperature probe
B. H-bridge driver
C. USB cable
D. LED resistor

21 On an ESP8266-based NodeMCU using the default analogWrite() range of 0 to 1023, which value most closely produces 75% LED brightness by duty cycle?

controlling the brightness of led Medium
A. 256
B. 512
C. 767
D. 1023

22 An LED connected to a NodeMCU PWM pin appears dim even when analogWrite(pin, 1023) is used. Which hardware issue is the most likely cause?

controlling the brightness of led Medium
A. The series resistor is too large
B. The GPIO is configured as input
C. The PWM frequency is too low
D. The duty cycle is exactly 50%

23 A NodeMCU drives an active-low LED, so the LED turns on when the GPIO output is low. Which PWM value gives approximately 25% visible on-time with a range of 0 to 1023?

controlling the brightness of led Medium
A. 767
B. 512
C. 256
D. 1023

24 An LED fade loop increases the PWM value by 20 every 10 ms, starting at 0 and stopping near 1000. Approximately how long does one fade-in take?

controlling the brightness of led Medium
A. 0.50 s
B. 0.25 s
C. 2.00 s
D. 1.00 s

25 Two LEDs are driven with the same PWM duty cycle, but one uses a 220 resistor and the other a 1 k resistor. Assuming identical LEDs, what is the expected result?

controlling the brightness of led Medium
A. The 1 k LED is brighter
B. Both LEDs remain fully off
C. The 220 LED is brighter
D. Both LEDs have equal brightness

26 A dimmable LED visibly flickers when PWM is generated by a slow software loop. Which change most directly reduces the flicker while preserving the intended brightness?

controlling the brightness of led Medium
A. Decrease the GPIO voltage
B. Reverse the LED polarity
C. Increase the PWM frequency
D. Increase the series resistance

27 A program maps an 8-bit brightness command from 0 to 255 into the NodeMCU PWM range 0 to 1023. Which expression provides the most appropriate linear mapping?

controlling the brightness of led Medium
A. value - 255 / 1023
B. value * 1023 / 255
C. value + 1023 / 255
D. value * 255 / 1023

28 A standard servo expects a 20 ms PWM period. What frequency should the NodeMCU generate?

servo motor control using pwm Medium
A. 50 Hz
B. 100 Hz
C. 25 Hz
D. 200 Hz

29 A servo uses pulse widths from 1.0 ms at 0 degrees to 2.0 ms at 180 degrees. Which pulse width should approximately command 90 degrees?

servo motor control using pwm Medium
A. 2.0 ms
B. 1.5 ms
C. 1.0 ms
D. 1.25 ms

30 At 50 Hz, what duty cycle corresponds to a 2 ms servo control pulse?

servo motor control using pwm Medium
A. 2.5%
B. 20%
C. 10%
D. 5%

31 A servo jitters and the NodeMCU sometimes resets when the servo starts moving. Which modification is most appropriate?

servo motor control using pwm Medium
A. Use a separate regulated servo supply with common ground
B. Remove the ground connection from the servo
C. Increase the command pulse to 20 ms
D. Power the servo directly from a GPIO pin

32 A linear servo mapping uses 1 ms for 0 degrees and 2 ms for 180 degrees. What pulse width should be used for 45 degrees?

servo motor control using pwm Medium
A. 1.50 ms
B. 1.75 ms
C. 1.25 ms
D. 1.10 ms

33 A servo holds the correct angle but continuously buzzes under load. Which explanation is most likely?

servo motor control using pwm Medium
A. The pulse period has disabled the motor
B. The GPIO has exceeded its flash capacity
C. The servo is correcting position against the load
D. The PWM signal has become a DC voltage

34 A program sends valid servo pulses but then blocks for 500 ms before generating the next pulse in software. What behavior is most likely?

servo motor control using pwm Medium
A. The servo direction reverses once
B. The servo speed doubles steadily
C. The servo supply rises to 12 V
D. The servo position becomes unstable

35 A NodeMCU must control the speed of a 6 V DC motor that draws 500 mA. Why should the motor not be connected directly to a GPIO pin?

dc motor control using pwm Medium
A. The motor requires a digital input pin
B. The motor current exceeds the GPIO capability
C. The GPIO always outputs an AC waveform
D. The GPIO frequency is fixed at zero

36 A DC motor is driven through a MOSFET at a 40% PWM duty cycle from a 9 V supply. Ignoring losses, what average motor voltage does this approximate?

dc motor control using pwm Medium
A. 3.6 V
B. 5.4 V
C. 9.0 V
D. 2.7 V

37 What is the main purpose of a flyback diode connected across a DC motor controlled by a transistor?

dc motor control using pwm Medium
A. Measure the motor current
B. Clamp the inductive voltage spike
C. Increase the PWM duty cycle
D. Reverse the motor direction

38 A motor does not start at 15% PWM duty cycle but runs after briefly applying 60%. What is the best control strategy for reliable low-speed startup?

dc motor control using pwm Medium
A. Disconnect the flyback protection diode
B. Replace PWM with a floating input
C. Apply a short high-duty startup pulse
D. Lower the supply voltage during startup

39 A single low-side MOSFET provides PWM speed control for a DC motor. What additional circuit is required to control both forward and reverse rotation?

dc motor control using pwm Medium
A. A pull-up resistor
B. A voltage divider
C. An H-bridge driver
D. A rectifier filter

40 A NodeMCU and an external motor driver use separate power supplies, but the PWM input behaves unpredictably. Which connection is most likely missing?

dc motor control using pwm Medium
A. A common ground connection
B. A reverse-biased LED
C. A series motor capacitor
D. A second flyback diode

41 An LED is driven from an ESP8266 PWM pin through a resistor. The application uses a 12-bit brightness value from 0 to 4095, while analogWriteRange(1023) is active. Which conversion preserves the intended brightness ratio most accurately?

controlling the brightness of led Hard
A. Use d = b / 1023 and write d * 4095
B. Use d = b / 4096 and write d * 1024
C. Use d = b / 4095 and write \operatorname{round}(d \times 1023)
D. Use d = b / 4095 and write d * 1023

42 A status LED must appear equally bright at PWM codes 100 and 200 when controlled by a slider, but the second code currently looks much brighter. Which change best addresses the perceptual mismatch while retaining 10-bit PWM resolution?

controlling the brightness of led Hard
A. Invert the PWM output before applying the slider value
B. Apply a perceptual gamma correction to the slider value
C. Replace PWM with a lower-frequency square wave
D. Increase the series resistor for every slider position

43 An LED is connected from 3.3 V through a resistor to an NPN transistor collector, with the emitter at ground. The transistor is driven by an active-high PWM signal. Which software behavior produces maximum LED brightness when the circuit is operating correctly?

controlling the brightness of led Hard
A. Write duty 0 because the transistor is a low-side switch
B. Write duty 1023 only when the LED is connected to ground
C. Write duty 1023 because the transistor is active high
D. Write duty 512 because transistor switching is always inverted

44 A 3.3 V GPIO drives an LED whose forward voltage is 2.0 V at 10 mA. Ignoring transistor losses, what resistor value is closest to the required average-current limit when the LED is continuously on?

controlling the brightness of led Hard
A.
B.
C.
D.

45 A camera records visible LED flicker even though the LED appears steady to the eye. Which modification is most appropriate if the ESP8266 and LED switching hardware can support it?

controlling the brightness of led Hard
A. Increase PWM frequency above the camera sampling interaction
B. Replace the current-limiting resistor with a capacitor
C. Use a duty cycle of exactly 50 percent
D. Reduce PWM frequency below 100 Hz

46 A firmware update changes analogWriteRange() from 1023 to 255, but the application still sends values up to 1023. What is the most likely result for values above 255?

controlling the brightness of led Hard
A. They produce a duty cycle above 100 percent
B. They switch the pin from PWM mode to digital mode
C. They are automatically divided by four
D. They are clipped or constrained to the configured maximum

47 Two PWM-controlled LEDs share the same ESP8266 supply. At high duty cycles, both become dimmer and Wi-Fi resets occur. Which hardware change most directly addresses the underlying power problem?

controlling the brightness of led Hard
A. Increase the PWM duty values beyond the configured range
B. Connect both LED cathodes to GPIO pins
C. Replace PWM with faster serial communication
D. Add adequate supply decoupling and a separate current-capable LED supply

48 A standard servo expects a 50 Hz frame and a 1.0 ms to 2.0 ms control pulse. With a 10-bit PWM range of 0 to 1023, which duty-count interval most closely represents the servo's usable command range?

servo motor control using pwm Hard
A. Counts 25 to 51
B. Counts 1 to 2
C. Counts 512 to 1023
D. Counts 51 to 102

49 A servo is commanded to 90 degrees using a 1.5 ms pulse, but it moves to an endpoint. The measured frame period is 20 ms and the pulse is actually 15 ms. Which diagnosis is most likely?

servo motor control using pwm Hard
A. The PWM frequency is too low for a servo
B. The servo requires a 15 ms neutral pulse
C. The servo interprets 50 Hz as a digital high signal
D. The pulse-width calculation confused milliseconds with microseconds

50 A servo is powered from a separate 5 V supply, while its signal is generated by the NodeMCU. The servo responds erratically. Which wiring correction is essential?

servo motor control using pwm Hard
A. Power the servo through the ESP8266 3.3 V regulator
B. Remove the servo supply ground to avoid a ground loop
C. Connect the servo signal to the 5 V rail
D. Connect the separate supply ground to NodeMCU ground

51 A servo accepts pulses from 0.5 ms to 2.5 ms, but the mechanical linkage safely permits only 20 degrees to 160 degrees. Which control strategy best prevents damaging commands?

servo motor control using pwm Hard
A. Clamp the requested angle, then map it to the calibrated pulse limits
B. Use a constant 1.5 ms pulse for all requested angles
C. Increase the frame frequency until the linkage stops
D. Map the full input range directly to 0.5 ms to 2.5 ms

52 A servo's neutral position changes after replacing its power adapter, although the PWM pulse width is unchanged. Which explanation is most technically plausible?

servo motor control using pwm Hard
A. A higher supply voltage reverses the PWM duty cycle
B. The new supply changed the signal frequency automatically
C. Servo position is determined only by supply voltage
D. Voltage noise or ground reference changes affect signal interpretation or servo electronics

53 A servo library and an LED PWM channel are enabled together, and the LED periodically changes brightness whenever the servo moves. What is the best corrective design choice?

servo motor control using pwm Hard
A. Use a timer/resource arrangement supported by the platform or move one function to another controller
B. Assign both outputs to the same timer channel
C. Drive the servo with a constant logic-high output
D. Increase the LED duty cycle to compensate for interference

54 A servo command is updated every 1 ms with a new pulse width, but the motor jitters badly near its target. Which software improvement is most appropriate?

servo motor control using pwm Hard
A. Change the signal from PWM to a one-time pulse
B. Alternate between the two endpoint pulse widths
C. Set every pulse to the maximum width
D. Apply a small deadband and rate-limit or filter command updates

55 A NodeMCU pin is connected directly to a 250 mA DC motor. The firmware sets 50 percent PWM, but the motor does not start and the board resets. What is the primary design error?

dc motor control using pwm Hard
A. The ESP8266 cannot generate a 50 percent duty cycle
B. The PWM duty cycle is mathematically invalid
C. The motor requires a servo pulse instead of PWM
D. The GPIO is being used as a power driver for an inductive load

56 A low-side N-channel MOSFET switches a brushed DC motor from a 12 V supply. Which protection arrangement is correct for suppressing the motor's inductive turn-off transient?

dc motor control using pwm Hard
A. Place a resistor from the motor terminal directly to the GPIO
B. Place a flyback diode in series with the motor, cathode at ground
C. Place a flyback diode across the motor, cathode at 12 V
D. Place an LED across the MOSFET, anode at the drain

57 A DC motor stalls at low duty cycles but runs once manually spun. Which firmware change can improve starting without increasing the steady-state commanded speed excessively?

dc motor control using pwm Hard
A. Decrease the supply voltage during startup
B. Replace the PWM signal with a permanent logic-low signal
C. Apply a brief higher-duty startup boost, then return to the requested duty
D. Use a lower duty cycle for the first several seconds

58 A motor driver uses an H-bridge. The firmware changes direction while the PWM enable remains high, causing a large current spike. Which control sequence is safest?

dc motor control using pwm Hard
A. Increase PWM frequency while changing direction
B. Set PWM to zero, allow a brief dead time, change direction, then ramp duty
C. Change direction and enable both bridge legs simultaneously
D. Reverse direction immediately at maximum duty

59 A motor's speed drops under load even though the PWM duty cycle is unchanged. Which conclusion and improvement are most appropriate for a speed-regulated system?

dc motor control using pwm Hard
A. The motor needs servo pulses; change the frame period to 20 ms
B. The PWM signal is necessarily inverted; swap the supply terminals
C. The motor is load-sensitive; add feedback and a controller that adjusts duty
D. The motor is open circuit; reduce the duty cycle

60 A motor driver datasheet specifies a minimum PWM frequency of 20 kHz for inaudible operation, while the selected driver has a maximum switching frequency of 30 kHz. Which setting is valid?

dc motor control using pwm Hard
A. 40 kHz, because higher frequency always reduces losses
B. 1 kHz, because motor inductance removes all audible effects
C. 10 kHz, because lower frequency always provides more torque
D. 20 kHz, because it satisfies both stated limits