Microcontrollers, Sensors, and Basic Embedded Systems
What this domain tests
This domain tests architecture basics such as Harvard versus von Neumann, GPIO and ADC, sensor interfacing, and the small program structures that read a sensor and drive an output.
Core rules
- A microcontroller puts CPU, memory (Flash for program, RAM for data) and peripherals (GPIO, timers, ADC, UART) on one chip. The 8051 and AVR are Harvard architecture with separate program and data buses; the 8051 has four 8-bit ports.
- GPIO pins are configured as input or output. Unconnected inputs float and need a pull-up or pull-down resistor.
- ADC resolution = Vref/2ⁿ. A 10-bit ADC with a 5 V reference has a step of 5/1024 ≈ 4.88 mV.
- PWM controls average power for LED brightness and motor speed through its duty cycle.
- Sensors: LDR resistance falls with light; NTC thermistor resistance falls with temperature; LM35 gives 10 mV/°C as an analog voltage; DHT11 gives digital temperature and humidity; IR and ultrasonic modules measure distance.
- Mechanical switches need debouncing, in hardware with an RC network or in software by re-reading after a delay.
Worked example
An LM35 output reads 250 mV. Since 10 mV corresponds to 1 °C, temperature = 250/10 = 25 °C. Feeding that into a 10-bit ADC with Vref = 5 V gives a count of 0.25/5 × 1023 ≈ 51, and decoding back, 51 × 4.88 mV ≈ 249 mV.
Traps that cost marks
Driving an LED without a series resistor; leaving inputs floating; treating the ADC count as a voltage; expecting a digital output from LM35 or an analog one from DHT11; using 2⁸ instead of 2¹⁰ when sizing a 10-bit ADC step.