practicals
Learning Objectives
- Integrate concepts from Units 1–8 into a single working embedded device.
- Independently plan, wire, code, test and debug a small project.
- Present and demonstrate the finished project to trainers and peers.
9.1 Project Development Cycle
- Define the problem and requirements.
- Select the project option and components.
- Draw a block diagram.
- Prepare a component and pin list.
- Build and inspect the circuit before applying power.
- Write firmware in small, testable stages.
- Test each part and use the Serial Monitor for debugging.
- Add an interrupt or non-blocking timing element; where feasible, use a FreeRTOS task.
- Document the final design, fault encountered and solution.
- Prepare a 3-minute demonstration.
9.2 Capstone Option A: Reaction-Time Reflex Tester
The module proposes a reaction-time tester using an LED, a button and millis()-based timing. A simple sequence is: start a test, turn on the LED, detect the response, calculate elapsed time and report the result.
Figure 9.1: Original example circuit for the reflex-timer project.
Suggested Pin/Component Table
|
Component |
Example connection |
Purpose |
|
LED + 220 Ω resistor |
D8 → resistor → LED → GND |
Visual start signal |
|
Push button |
D2 → button → GND; INPUT_PULLUP |
User response |
|
USB/board |
USB to computer |
Power, programming and Serial Monitor |
Example Reflex-Timer Program
const byte LED_PIN = 8;
const byte BUTTON_PIN = 2;
bool testRunning = false;
unsigned long startTime = 0;
void setup() {
pinMode(LED_PIN, OUTPUT);
pinMode(BUTTON_PIN, INPUT_PULLUP);
Serial.begin(9600);
Serial.println(“Reflex Timer”);
}
void loop() {
if (!testRunning && digitalRead(BUTTON_PIN) == LOW) {
delay(200);
while (digitalRead(BUTTON_PIN) == LOW) {}
Serial.println(“Get ready…”);
delay(1000);
digitalWrite(LED_PIN, HIGH);
startTime = millis();
testRunning = true;
}
if (testRunning && digitalRead(BUTTON_PIN) == LOW) {
unsigned long reactionTime = millis() – startTime;
digitalWrite(LED_PIN, LOW);
Serial.print(“Reaction time: “);
Serial.print(reactionTime);
Serial.println(” ms”);
testRunning = false;
delay(300);
}
}
Improvement task: the module emphasizes millis()-based timing. After making the basic version work, trainees can improve the debounce logic so the program uses less blocking code.
9.3 Capstone Option B: Environment Alarm
The module proposes an environment alarm using an LDR or DHT sensor. When the measured condition crosses a selected threshold, the system activates a buzzer/LED and displays information on an I2C LCD.
Figure 9.2: Original example block/circuit diagram for the environment-alarm project.
Example LDR Alarm Logic
- Read the LDR voltage-divider value using analogRead().
- Choose and document a threshold from observed laboratory readings.
- Compare the sensor value with the threshold.
- Activate the buzzer and/or LED when the selected condition is reached.
- Display the sensor value and alarm state on the I2C LCD.
- Use non-blocking timing so other program activities can continue.
Example Environment Alarm Program
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
const int LDR_PIN = A0;
const int LED_PIN = 8;
const int BUZZER_PIN = 9;
const int THRESHOLD = 600; // example only; calibrate during testing
LiquidCrystal_I2C lcd(0x27, 16, 2);
unsigned long lastRead = 0;
const unsigned long readInterval = 1000;
void setup() {
pinMode(LED_PIN, OUTPUT);
pinMode(BUZZER_PIN, OUTPUT);
Serial.begin(9600);
lcd.init();
lcd.backlight();
}
void loop() {
unsigned long now = millis();
if (now – lastRead >= readInterval) {
lastRead = now;
int sensorValue = analogRead(LDR_PIN);
Serial.print(“LDR: “);
Serial.println(sensorValue);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(“LDR: “);
lcd.print(sensorValue);
if (sensorValue > THRESHOLD) {
digitalWrite(LED_PIN, HIGH);
digitalWrite(BUZZER_PIN, HIGH);
lcd.setCursor(0, 1);
lcd.print(“ALARM”);
} else {
digitalWrite(LED_PIN, LOW);
digitalWrite(BUZZER_PIN, LOW);
lcd.setCursor(0, 1);
lcd.print(“NORMAL”);
}
}
}
Teaching note: the threshold and I2C address are examples. Calibrate the threshold using the actual sensor and confirm the LCD address used in the laboratory.
9.4 Project Documentation Template
|
Item |
Trainee entry |
|
Project title |
|
|
Problem being solved |
|
|
Main requirements |
|
|
Block diagram |
|
|
Component list |
|
|
Pin allocation |
|
|
Program functions |
|
|
Testing procedure |
|
|
Fault encountered |
|
|
Fault diagnosis |
|
|
Solution implemented |
|
|
Final result |
|
|
Safety checks |
|
|
Future improvement |
|
9.5 Capstone Presentation Guide
- State the project title and purpose.
- Show and explain the block diagram.
- Identify the important components and connections.
- Demonstrate the working circuit.
- Explain the timing, interrupt or RTOS element used.
- Describe one problem encountered and how it was resolved.
- Conclude by stating whether the requirements were achieved.
Assessment & Grading Rubric
The training module states that the capstone is graded summatively and that a trainee is competent upon achieving Competent or higher on all five criteria.
|
Criterion |
Developing (1–2) |
Competent (3–4) |
Proficient (5) |
|
Circuit Construction |
Wiring incorrect or unsafe; major rework |
Circuit functional with minor fixes |
Correct, clean and safe on first test |
|
Code Functionality |
Does not compile/run as intended |
Runs with minor logic errors |
Runs correctly and handles edge cases |
|
Understanding of Concepts |
Cannot explain circuit/code |
Explains most concepts with prompting |
Clearly explains architecture, timing and logic |
|
Debugging & Problem-Solving |
Needs trainer to resolve most issues |
Resolves issues with minor guidance |
Independently diagnoses and fixes issues |
|
Documentation & Safety |
Lab sheet incomplete; unsafe practices |
Lab sheet mostly complete; safe practices |
Lab sheet complete, clear and all safety steps followed |
Final Safety and Good Practice Checklist
- Power off before rewiring the breadboard.
- Check LED polarity and resistor placement.
- Keep the workstation orderly.
- Use the correct supply voltage for each board/module.
- Avoid short circuits between power and ground.
- Do not place long or blocking operations inside an ISR.
- Record faults, tests and corrections in the lab sheet.
- Test one section at a time before integrating the complete project.
- Ask the trainer for guidance when a wiring or hardware condition is uncertain.


