Microcontrollers, Sensors and Automation
Microcontrollers, Sensors and Automation is examined through architecture basics, I/O interfacing, ADC/PWM/timers, serial communication and sensor selection.
What the exam tests
Questions test microcontroller architecture, I/O interfacing, ADC/PWM/timers, serial communication and sensor selection. Automation questions cover relays, drivers, sensors and simple control logic. Expect pin-function and calculation questions rather than deep assembly programming.
Core rules
- A microcontroller integrates CPU, memory, I/O, timers and ADC on one chip; a microprocessor needs external memory and peripherals. 8051 is 8-bit with four 8-bit ports; Arduino Uno uses ATmega328P with 14 digital I/O, 6 analog inputs, 10-bit ADC and 5 V logic.
- ADC: code = Vin/Vref × (2^n − 1). PWM average voltage = duty cycle × supply voltage. PWM pins on Uno include 3, 5, 6, 9, 10, 11.
- Sensors: LM35 gives 10 mV/°C; LDR resistance falls with light; thermistor changes resistance with temperature; HC-SR04 ultrasonic measures distance by echo time; DHT11 gives digital temperature/humidity.
- A relay coil needs a driver transistor and a flyback diode; never connect a relay coil directly to an MCU pin. Use pull-up/pull-down resistors to avoid floating inputs.
Worked example
An LM35 output is 0.35 V and is fed to a 10-bit ADC with Vref = 5 V. Temperature = 0.35/0.010 = 35 °C. Expected ADC code = 0.35/5 × 1023 = 71.6, so about 72. If the code reads 72, the computed voltage is 72/1023 × 5 = 0.352 V, or 35.2 °C - within sensor tolerance. The reasoning is to convert sensor output to physical units first, then apply ADC resolution.
Traps that cost marks
Forgetting LM35's 10 mV/°C scale; using 1024 instead of 1023 for full-scale code; driving a relay or motor directly from an I/O pin; omitting the flyback diode; leaving an input floating; assuming 3.3 V sensors are safe on a 5 V board without level shifting.