Microcontrollers, Sensors and Embedded Basics
What this domain tests
Microcontrollers, Sensors and Embedded Basics tests microcontroller architecture, GPIO, ADC, PWM, serial communication and common sensor interfaces. Expect questions on pin functions, sensor behaviour and simple embedded calculations.
Core rules
- A microcontroller integrates CPU, RAM, flash program memory, timers, I/O ports, ADC and communication peripherals. The 8051 is 8-bit; Arduino Uno uses the ATmega328P.
- GPIO pins source or sink limited current; an LED needs a series resistor. Unused inputs should not float - use a pull-up or pull-down.
- ADC conversion: digital value ≈ (Vin / Vref) × (2ⁿ − 1) for an n-bit ADC. A 10-bit ADC with 5 V reference has steps of about 4.9 mV.
- PWM controls average power by duty cycle; UART is asynchronous serial; interrupts let an event pre-empt the main loop.
- Sensors: LDR resistance falls with light; NTC thermistor resistance falls with temperature; IR reflective sensor detects proximity; ultrasonic sensor uses time of flight.
Worked example
A 10-bit ADC has Vref = 5 V and reads 512. Convert: Vin = (512 / 1023) × 5 = 2.502 V, approximately 2.5 V. If the sensor output is 2.5 V at 25 °C, that reading represents 25 °C only if the sensor is linear and calibrated. The resolution is 5/1023 ≈ 4.9 mV per count, so a small temperature change may be only a few counts.
Traps
Using 1024 instead of 1023 for full-scale; leaving a switch input floating; driving an LED directly from a pin without a resistor; confusing sensor resistance change with output voltage change; and forgetting common ground between sensor and microcontroller.