Activity Guide
Activity Guide
1
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
Table of Contents
TABLE OF CONTENT
Introduction
Components on the Shield
Jumper Configuration
Required Libraries
Important Instructions
7-Segment Display — Standard Coding Rules
7- Segment Display Test Code
Activity 01 — Reaction Time Tester
Pin & Wiring Reference
Wiring Notes
How to Play / Use
Arduino Code
Activity 02 — Digital Thermometer & Humidity Monitor
Pin & Wiring Reference
Wiring Notes
How to Play / Use
Arduino Code
Activity 03 — Simon Says Memory Game
Pin & Wiring Reference
Wiring Notes
How to Play / Use
Arduino Code
Activity 04 — Joystick LED Controller
Pin & Wiring Reference
Wiring Notes
How to Play / Use
Arduino Code
Activity 05 — Intruder Alarm with PIR-Style IR Detection
Pin & Wiring Reference
Wiring Notes
How to Play / Use
Arduino Code
Activity 06 — Rotary Encoder Volume Knob & LED VU Meter
Pin & Wiring Reference
Wiring Notes
How to Play / Use
Arduino Code
Activity 07 — Sound-Reactive Light Show
Pin & Wiring Reference
Wiring Notes
How to Play / Use
Arduino Code
Activity 08 — Countdown Timer with Buzzer Alert
Pin & Wiring Reference
Wiring Notes
How to Play / Use
Arduino Code
Activity 09 — Fire Detection & Smart Fan Controller
Pin & Wiring Reference
Wiring Notes
How to Play / Use
Arduino Code
Activity 10 — Digital Piano with Recorder
Pin & Wiring Reference
2
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
Wiring Notes
How to Play / Use
Arduino Code
Activity 11 — Stopwatch with Start/Pause/Reset
Pin & Wiring Reference
Wiring Notes
How to Play / Use
Arduino Code
Primary Code — Automated Test Suite
Quick Reference — All Commands
Test Suite Commands
Round 1 Test Numbers (suffix A)
Round 2 Test Numbers (suffix B)
Troubleshooting
3
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
Introduction
Welcome to the SmartElex Bharat Explorer Arduino Shield! This shield packs 17 components onto a
single board that plugs directly onto any Arduino Uno. Whether you are a beginner exploring electronics
for the first time or an experienced maker looking for a quick prototyping platform, this shield has
everything you need in one compact package.
Sensors: Joystick (X/Y), IR Sensor, Flame Sensor, Touch Sensor, Microphone, LDR (Light),
AHT20 (Temp+Humidity), Rotary Encoder
Outputs: 9x RGB NeoPixel LEDs, 4-digit 7-Segment Display (I2C), Buzzer, DC Motor,
Status LED
Controls: 4x Push Buttons (S1–S4), Potentiometer, Rotary Encoder with push button
Interface: I2C bus (AHT20 + 7-Segment), Analog pins A0–A3, Digital pins D2–D13
Jumper Configuration
The shield has a jumper that switches shared pins between two modes:
Jumper Positions
Required Libraries
Install these libraries in Arduino IDE (Sketch → Include Library → Manage Libraries):
• Adafruit NeoPixel
• Adafruit GFX Library
• Adafruit LED Backpack Library
• Adafruit AHTX0
4
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
Important Instructions
7-Segment Display — Standard Coding Rules
Whenever you use the 7-segment display in any activity, always follow this standard method to write
digits to the display. This ensures consistent, correct output across all projects.
[Link](0, thousands);
[Link](1, hundreds);
[Link](2, tens);
[Link](3, ones);
#include <Wire.h>
#include "Adafruit_LEDBackpack.h"
int counter = 0;
void setup() {
[Link](0x70);
[Link](10);
[Link]();
[Link]();
}
void loop() {
int thousands = counter / 1000;
int hundreds = (counter / 100) % 10;
int tens = (counter / 10) % 10;
int ones = counter % 10;
[Link](0, thousands);
[Link](1, hundreds);
[Link](2, tens);
[Link](3, ones);
[Link]();
counter++;
if (counter > 9999) counter = 0; // loop back to 0 after 9999
}
5
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
Test your reflexes! The buzzer plays a random start tone, all 9 RGB LEDs light up in a random color,
and you must press BTN1 as fast as possible. Printed to Serial Monitor. Challenge your friends to beat
your score!
Wiring Notes
• No external wiring needed — all components are on the shield.
• Plug the shield onto your Arduino Uno.
• Connect USB to your PC and open the Serial Monitor at 9600 baud.
• Jumper settings: No special jumper position needed for this activity.
Arduino Code
##include <Wire.h>
#include <Adafruit_NeoPixel.h>
#include "Adafruit_LEDBackpack.h"
#define LED_PIN 3
#define BUZZER 13
#define BTN1 8
#define MAX_MS 9999
6
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
void clearDisplay() {
[Link](0, 0x00);
[Link](1, 0x00);
[Link](2, 0x00);
[Link](3, 0x00);
[Link]();
}
[Link](0, thousands);
[Link](1, hundreds);
[Link](2, tens);
[Link](3, ones);
[Link]();
}
void setup() {
[Link](9600);
pinMode(BUZZER, OUTPUT);
pinMode(BTN1, INPUT);
[Link](); [Link]();
[Link]();
[Link](0x70);
[Link](10);
randomSeed(analogRead(A5));
[Link]("Reaction Time Tester Ready!");
}
void loop() {
clearDisplay(); // All 4 positions OFF before GO
[Link]("Get ready...");
delay(random(2000, 5000));
// Signal GO
uint32_t color = [Link](
random(50,255), random(50,255), random(50,255));
for(int i = 0; i < 9; i++) [Link](i, color);
[Link]();
tone(BUZZER, 1000, 200);
unsigned long startTime = millis();
// Show result
[Link](); [Link]();
showTime((unsigned int)reaction);
7
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
delay(3000);
}
8
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
Turn your board into a live weather station! The AHT20 sensor reads temperature and humidity every 2
seconds. The Serial Monitor display cycles between showing temperature and humidity, while the RGB
LEDs change color based on how hot or cold it is — cool blue for cold, green for comfortable, and red
for hot. A warning tone sounds if it gets too hot.
Wiring Notes
• All components are built into the shield — no external wiring required.
• The AHT20 use I2C (pins A4 and A5 on Uno).
• Make sure the shield is firmly seated on the Arduino.
• Open Serial Monitor at 9600 baud to see full readings.
Arduino Code
#include <Wire.h>
#include <Adafruit_NeoPixel.h>
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_AHTX0.h"
#define LED_PIN 3
#define BUZZER 13
9
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
// ─────────────────────────────────────────
// Show humidity on 7-segment
// Format: XX.X H
// Position 0 = tens digit
// Position 1 = ones digit + decimal dot ON
// Position 2 = tenths digit
// Position 3 = 'H' raw segment 0x76
// ─────────────────────────────────────────
void showHumidity(float hum) {
[Link]();
// Position 2 — tenths
[Link](2, tenths, false);
[Link]();
}
void setup() {
[Link](9600);
pinMode(BUZZER, OUTPUT);
[Link]();
[Link](50);
[Link]();
[Link]();
[Link](0x70);
[Link](8);
delay(100);
if (![Link]()) {
[Link]("AHT sensor not found! Check wiring.");
while (1) delay(100);
}
void loop() {
sensors_event_t hum, tmp;
[Link](&hum, &tmp);
10
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
float t = [Link];
float h = hum.relative_humidity;
// ── Serial Monitor ──
[Link]("Temp: ");
[Link](t, 1);
[Link](" C Humidity: ");
[Link](h, 1);
[Link](" %");
delay(500);
}
11
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
The classic memory game! The Arduino lights up LEDs in a random sequence and plays a
corresponding tone for each. You must repeat the sequence by pressing BTN1–BTN3 (mapped to 3
LED groups). Each round adds one more step to the sequence. How many rounds can you remember?
High score is stored and shown at game over.
Wiring Notes
• No external wiring — all components are on the shield.
• BTN1=S1 (pin D8), BTN2=S2 (pin D7), BTN3=S3 (pin D12).
• The 9 LEDs are split into 3 groups: LEDs 0-2 = Red, LEDs 3-5 = Green, LEDs 6-8 = Blue.
• Open Serial Monitor at 9600 baud for game instructions.
Arduino Code
#include <Wire.h>
#include <Adafruit_NeoPixel.h>
#include "Adafruit_LEDBackpack.h"
12
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
#define LED_PIN 3
#define BUZZER 13
#define BTN1 8
#define BTN2 7
#define BTN3 12
#define MAX_SEQ 20
int seq[MAX_SEQ];
int round_num = 0, highScore = 0;
int tones[] = {440, 550, 660};
uint32_t colors[3];
// ─────────────────────────────────────────
// Flash one LED group + play tone
// ─────────────────────────────────────────
void lightUp(int c, int ms) {
int start = c * 3;
for (int i = start; i < start + 3; i++)
[Link](i, colors[c]);
[Link]();
tone(BUZZER, tones[c], ms);
delay(ms + 50);
for (int i = start; i < start + 3; i++)
[Link](i, 0);
[Link]();
delay(150);
}
// ─────────────────────────────────────────
// Blank display safely
// ─────────────────────────────────────────
void blankDisplay() {
[Link]();
[Link]();
}
// ─────────────────────────────────────────
// Show score using positions 0,1,2,3
// drawDot=false on all to kill colon dot
// Leading zeros blanked cleanly
// ─────────────────────────────────────────
void showScore(int score) {
[Link]();
13
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
[Link]();
}
// ─────────────────────────────────────────
// Game over
// ─────────────────────────────────────────
void gameOver() {
if (round_num > highScore) highScore = round_num;
// Buzz
tone(BUZZER, 200, 1000);
delay(1000);
// Serial Monitor
[Link]("Game Over! Score: ");
[Link](round_num);
[Link]("High Score: ");
[Link](highScore);
// Reset
round_num = 0;
}
// ─────────────────────────────────────────
// Setup
// ─────────────────────────────────────────
void setup() {
[Link](9600);
pinMode(BUZZER, OUTPUT);
pinMode(BTN1, INPUT);
pinMode(BTN2, INPUT);
pinMode(BTN3, INPUT);
[Link]();
[Link]();
[Link]();
[Link](0x70);
[Link](8);
delay(100);
14
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
randomSeed(analogRead(A5));
// ─────────────────────────────────────────
// Main loop
// ─────────────────────────────────────────
void loop() {
// Wait for any button press to start
while (digitalRead(BTN1) == LOW &&
digitalRead(BTN2) == LOW &&
digitalRead(BTN3) == LOW) {}
delay(500);
if (pressed != seq[i]) {
gameOver();
return;
}
lightUp(pressed, 200);
delay(100);
}
delay(600);
}
15
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
Use the joystick to paint with light! Moving the joystick left/right selects which of the 9 NeoPixel LEDs is
active. Moving it up/down changes the brightness of the selected LED. Pressing the joystick button
cycles through hue colors (red, orange, yellow, green, cyan, blue, violet). The potentiometer controls
overall strip brightness. Great for learning analog input mapping.
Wiring Notes
• Set jumper to Round 1 / Joystick side so A0=JoystickX, A1=JoystickY.
• If using POT for brightness instead, set jumper to Round 2 side.
• No external wiring — all on the shield.
• Joystick X: A0, Joystick Y: A1, LED strip: D3.
Arduino Code
#include <Adafruit_NeoPixel.h>
#define LED_PIN 3
#define JOY_X A0
#define JOY_Y A1
#define JOY_BTN 5
int cursorLED = 0;
int brightness[9] = {50, 50, 50, 50, 50, 50, 50, 50, 50};
int hueIndex = 0;
16
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
uint32_t hues[] = {
0xFF0000, 0xFF6600, 0xFFFF00, 0x00FF00,
0x00FFFF, 0x0000FF, 0x8800FF, 0xFF00FF
};
// 🔥
Calibration values
int centerX = 512;
int centerY = 512;
int deadZone = 80;
void setup() {
[Link](9600);
pinMode(JOY_BTN, INPUT_PULLUP);
[Link]();
[Link](80);
[Link]();
void loop() {
int jx = analogRead(JOY_X);
int jy = analogRead(JOY_Y);
//
bool
🎯left
Apply calibrated dead zone
= (jx < centerX - deadZone);
bool right = (jx > centerX + deadZone);
bool up = (jy < centerY - deadZone);
bool down = (jy > centerY + deadZone);
// ⏱ Smooth movement
if (millis() - lastMove > 150) {
if (left && cursorLED > 0) {
cursorLED--;
lastMove = millis();
}
if (right && cursorLED < 8) {
cursorLED++;
lastMove = millis();
}
if (up) {
brightness[cursorLED] = min(255, brightness[cursorLED] + 10);
lastMove = millis();
}
if (down) {
brightness[cursorLED] = max(0, brightness[cursorLED] - 10);
lastMove = millis();
}
}
17
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
// 🔘 Button debounce
if (digitalRead(JOY_BTN) == LOW && millis() - lastButton > 300) {
hueIndex = (hueIndex + 1) % 8;
lastButton = millis();
}
// 🌈 Render LEDs
for (int i = 0; i < 9; i++) {
if (i == cursorLED) {
[Link](i, [Link](120, 120, 120));
} else {
uint32_t h = hues[hueIndex];
uint8_t R = ((h >> 16) & 0xFF) * brightness[i] / 255;
uint8_t G = ((h >> 8) & 0xFF) * brightness[i] / 255;
uint8_t B = (h & 0xFF) * brightness[i] / 255;
[Link](i, [Link](R, G, B));
}
}
[Link]();
// Debug
[Link]("X:"); [Link](jx);
[Link](" Y:"); [Link](jy);
[Link](" Cursor:"); [Link](cursorLED);
}
18
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
LDR Detection
Difficulty: Beginner Est. Time: 15 minutes Category: Interactive
Build a security alarm using the LDR Sensor ! When an light occurs at the LDR sensor the buzzer
sounds an alarm pattern, all LEDs flash red, and an alert is printed to Serial Monitor with a timestamp
(seconds since boot). Press BTN1 to silence the alarm. The LDR adds a light-level check — alarm only
triggers in High Light Mode
Wiring Notes
• All sensors and outputs are on the shield — no external wiring.
• IR sensor is on pin A2, LDR on pin A3.
• Point the IR sensor toward the area you want to monitor.
• Adjust the LDR threshold in code if needed (default: < 300 = dark).
Arduino Code
#include <Adafruit_NeoPixel.h>
#define IR_PIN A2
#define LDR A3
#define BUZZER 13
#define LED_PIN 3
#define BTN1 8
19
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
void setup() {
[Link](9600);
pinMode(IR_PIN, INPUT);
pinMode(BUZZER, OUTPUT);
pinMode(BTN1, INPUT);
[Link](); [Link]();
[Link]("=== INTRUDER ALARM ARMED ===");
}
void triggerAlarm() {
alarming = true;
[Link]("!! INTRUDER DETECTED at T+");
[Link](millis()/1000); [Link]("s !!");
}
void loop() {
int light = analogRead(LDR);
bool nightMode = (light < 300);
bool intruder = (digitalRead(IR_PIN) == LOW);
if(alarming) {
// Flash red LEDs
for(int i=0;i<9;i++) [Link](i, [Link](255,0,0));
[Link](); tone(BUZZER,800); delay(200);
[Link](); [Link](); noTone(BUZZER); delay(200);
// Silence button
if(digitalRead(BTN1)==HIGH) {
alarming = false;
noTone(BUZZER);
[Link](); [Link]();
[Link]("Alarm silenced. Re-arming...");
delay(2000);
}
} else {
// Heartbeat — single green LED pulse
[Link](0, [Link](0,20,0));
[Link](); delay(100);
[Link](); [Link]();
[Link]("Armed | Light: "); [Link](light);
[Link](" | Night mode: "); [Link](nightMode?"ON":"OFF");
delay(900);
}
}
20
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
Spin the rotary encoder to control a virtual volume level from 0 to 9. The NeoPixel strip acts as a
colorful VU meter bar — green at low levels, transitioning through yellow to red at maximum. Press the
encoder button to mute/unmute. The buzzer plays a click sound on each encoder tick.
Wiring Notes
• Set jumper to Round 1 (Joystick/Encoder) side for correct CLK and DT routing.
• Encoder CLK = D6, Encoder DT = D10, Encoder button = D5.
• All other components use shield connections — no extra wiring.
Arduino Code
#include <Wire.h>
#include <Adafruit_NeoPixel.h>
#include "Adafruit_LEDBackpack.h"
#define ENC_CLK 6
#define ENC_DT 10
#define ENC_SW 5
#define LED_PIN 3
#define BUZZER 13
21
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
void updateDisplay() {
int v = muted ? 0 : volume;
[Link](); [Link](v); [Link]();
for(int i=0;i<9;i++) [Link](i, muted ? 0 : vuColor(i,v));
[Link]();
}
void setup() {
[Link](9600);
pinMode(ENC_CLK, INPUT);
pinMode(ENC_DT, INPUT);
pinMode(ENC_SW, INPUT_PULLUP);
pinMode(BUZZER, OUTPUT);
[Link](); [Link]();
[Link](); [Link](0x70); [Link](8);
updateDisplay();
[Link]("Volume Knob Active. Turn encoder.");
}
void loop() {
int clk = digitalRead(ENC_CLK);
if(clk != lastClk && clk == LOW) {
if(digitalRead(ENC_DT) != clk) {
if(volume < 9) volume++;
} else {
if(volume > 0) volume--;
}
tone(BUZZER, 1200, 30);
updateDisplay();
[Link]("Volume: "); [Link](muted?"MUTED":String(volume));
}
lastClk = clk;
if(digitalRead(ENC_SW)==LOW) {
muted = !muted;
tone(BUZZER, muted?400:800, 150);
updateDisplay();
[Link](muted ? "MUTED" : "UNMUTED");
delay(400);
}
}
22
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
The microphone listens to your music, claps, or voice, and the RGB LEDs dance in real time! Louder
sounds produce more energetic, brighter LED patterns. The display shows the current sound level
(0–100). The potentiometer controls the sensitivity. A quiet hum produces slow gentle waves; loud
music triggers rapid rainbow bursts.
Wiring Notes
• Set jumper to Round 2 (POT/Motor/Mic) side — A0 = Mic, A1 = POT.
• Place the Arduino near your speaker or in a room with music.
• No extra wiring needed.
• Open Serial Monitor at 9600 baud to see live dB levels.
Arduino Code
#include <Wire.h>
#include <Adafruit_NeoPixel.h>
#include "Adafruit_LEDBackpack.h"
#define MIC_PIN A0
#define POT_PIN A1
#define LED_PIN 3
23
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
uint8_t hue = 0;
int smoothedLevel = 0;
void setup() {
[Link](9600);
[Link]("Baseline: ");
[Link](baseline);
}
void loop() {
🎚
// Adjust sensitivity with potentiometer
int sens = map(analogRead(POT_PIN), 0, 1023, 1, 10);
24
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
[Link]();
delay(10);
}
25
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
A fully functional countdown timer! Use BTN1 to add minutes, BTN2 to add seconds, and BTN3 to
start/pause the timer. The 7-segment display shows the remaining time in MM:SS format (using the
colon). As time runs low (under 10 seconds) the LEDs flash red and the buzzer beeps faster. At zero a
continuous alarm sounds. The encoder knob can also adjust the time.
Wiring Notes
• All components are on the shield — no extra wiring required.
• Buttons: BTN1=D8, BTN2=D7, BTN3=D12.
• Jumper position does not matter for this activity.
• Connect USB for power and Serial Monitor (9600 baud).
Arduino Code
26
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
#include <Wire.h>
#include <Adafruit_NeoPixel.h>
#include "Adafruit_LEDBackpack.h"
#define BTN1 8
#define BTN2 7
#define BTN3 12
#define BUZZER 13
#define LED_PIN 3
int totalSecs = 0;
bool running = false;
unsigned long lastTick = 0;
void showTime(int s) {
int m = s / 60; s = s % 60;
[Link]();
[Link](0, m/10);
[Link](1, m%10);
[Link](true);
[Link](3, s/10);
[Link](4, s%10);
[Link]();
}
void setup() {
[Link](9600);
pinMode(BTN1,INPUT); pinMode(BTN2,INPUT); pinMode(BTN3,INPUT);
pinMode(BUZZER,OUTPUT);
[Link](); [Link]();
[Link](); [Link](0x70); [Link](10);
showTime(0);
[Link]("Countdown Timer Ready");
}
void loop() {
// BTN1 = +1 min
if(!running && digitalRead(BTN1)==HIGH) { totalSecs+=60; showTime(totalSecs);
delay(300); }
// BTN2 = +10 sec
if(!running && digitalRead(BTN2)==HIGH) { totalSecs+=10; showTime(totalSecs);
delay(300); }
// BTN3 = Start/Pause/Reset
if(digitalRead(BTN3)==HIGH) {
unsigned long held = millis();
while(digitalRead(BTN3)==HIGH) {}
if(millis()-held > 2000) { totalSecs=0; running=false; showTime(0); }
else { running=!running; }
delay(200);
}
27
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
[Link]();
[Link](totalSecs);
} else {
running = false;
[Link]("TIME UP!");
for(int r=0;r<5;r++){
tone(BUZZER,800,400);
for(int i=0;i<9;i++) [Link](i, [Link](255,0,0));
[Link](); delay(400);
[Link](); [Link](); delay(200);
}
}
}
}
28
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
A real-world safety application combining multiple sensors. The flame sensor watches for fire. The
AHT20 monitors temperature. If either detects danger (flame detected OR temperature > 35C), the DC
motor spins as a fan to cool the area, LEDs flash orange as a warning, and the buzzer sounds an alert..
Normal conditions show a steady green status.
Wiring Notes
• Set jumper to Round 2 (Motor/POT side) so D4 = Motor IN2.
• Connect a small DC fan or motor to the Motor terminals on the shield.
• Flame sensor is built in on D2 — no extra wiring.
• AHT20 use I2C (built-in on shield).
Arduino Code
#include <Wire.h>
#include <Adafruit_NeoPixel.h>
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_AHTX0.h"
#define FLAME 2
29
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
#define MOTOR_IN1 11
#define MOTOR_IN2 4
#define BUZZER 13
#define LED_PIN 3
void setup() {
[Link](9600);
pinMode(FLAME, INPUT);
pinMode(MOTOR_IN1, OUTPUT); pinMode(MOTOR_IN2, OUTPUT);
pinMode(BUZZER, OUTPUT);
[Link](); [Link]();
[Link](); [Link](0x70); [Link](8);
[Link]();
[Link]("Fire Detection System Active");
}
void loop() {
sensors_event_t hum, tmp;
[Link](&hum, &tmp);
float temp = [Link];
bool flame = (digitalRead(FLAME) == LOW);
bool hotTemp = (temp > 35);
if(flame || hotTemp) {
alertActive = true; alertClear = millis() + 5000;
[Link]("ALERT! Flame="); [Link](flame);
[Link](" Temp="); [Link](temp);
}
if(alertActive && millis() > alertClear) alertActive = false;
if(alertActive) {
runFan(true);
tone(BUZZER, 800);
for(int i=0;i<9;i++) [Link](i,
(millis()/200)%2 ? [Link](255,80,0) : 0);
[Link]();
} else {
runFan(false); noTone(BUZZER);
for(int i=0;i<9;i++) [Link](i, [Link](0,60,0));
[Link]();
}
delay(200);
}
30
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
Play a 4-octave digital piano using the 4 buttons and the rotary encoder! BTN1–BTN4 play 4 notes in
the current octave. The encoder selects the octave (1–4). The buzzer plays each note. LEDs light up to
show which note is pressed in a colorful pattern. Press and hold BTN3+BTN4 together to START
recording — up to 32 notes. Play a sequence, then release both buttons to play it back automatically.
The 7-segment shows octave and playback status.
Wiring Notes
• Set jumper to Round 2 side so BTN4 is accessible on D6.
• Or leave jumper on R1 side and use the Encoder CLK pin (D6) as BTN4.
• All other connections are standard shield pins — no external wiring.
• Connect headphones or small speaker in series with the buzzer for better sound.
Arduino Code
31
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
#include <Wire.h>
#include <Adafruit_NeoPixel.h>
#include "Adafruit_LEDBackpack.h"
#define BTN1 8
#define BTN2 7
#define BTN3 12
#define BTN4 6
#define ENC_DT 10
#define ENC_SW 5
#define BUZZER 13
#define LED_PIN 3
// Notes: C E G B in 4 octaves
int notes[4][4] = {
{262,330,392,494}, // Octave 1
{523,659,784,988}, // Octave 2
{1047,1319,1568,1976}, // Octave 3
{2093,2637,3136,3951} // Octave 4
};
uint32_t noteColors[] = {
0xFF0000, 0x00FF00, 0x0000FF, 0xFFFF00
};
int octave = 0;
int lastClk = HIGH;
int recBuf[32];
int recLen = 0;
void showOctave() {
[Link]();
[Link](0, 0x3F); // O shape
[Link](1, octave+1);
[Link]();
}
void setup() {
[Link](9600);
pinMode(BTN1,INPUT); pinMode(BTN2,INPUT);
pinMode(BTN3,INPUT); pinMode(BTN4,INPUT);
pinMode(ENC_DT,INPUT); pinMode(ENC_SW,INPUT_PULLUP);
pinMode(BUZZER,OUTPUT);
[Link](); [Link]();
[Link](); [Link](0x70); [Link](8);
showOctave();
[Link]("Digital Piano Ready! BTN1-4 = C E G B");
}
void loop() {
// Encoder = change octave
int clk = digitalRead(BTN4); // BTN4 pin = ENC_CLK on R1
32
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
// Normal play
if(digitalRead(BTN1)==HIGH) playNote(0);
if(digitalRead(BTN2)==HIGH) playNote(1);
if(digitalRead(BTN3)==HIGH) playNote(2);
33
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
A precision stopwatch built with two buttons! BTN1 (S1) starts and pauses the timer, while BTN2 (S2)
resets it to zero. The 7-segment display shows elapsed time in centiseconds (0.01 s units), updating
every 100 ms. Time is tracked using millis() for accuracy up to 99.99 seconds. Great for timing
experiments, reaction tests, or learning how millis()-based timers work in Arduino.
Wiring Notes
• No external wiring needed — all components are on the shield.
• Plug the shield onto your Arduino Uno and connect USB to your PC.
• Jumper settings: No special jumper position required for this activity.
• Display shows centiseconds (0.01 s units) up to a maximum of 99.99 seconds.
Arduino Code
#include <Wire.h>
#include "Adafruit_LEDBackpack.h"
#define BTN1 8 // Start / Pause
#define BTN2 7 // Reset
Adafruit_7segment display = Adafruit_7segment();
bool running = false;
unsigned long startTime = 0;
unsigned long elapsed = 0;
unsigned long lastDisplayUpdate = 0;
void setup() {
pinMode(BTN1, INPUT);
34
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
pinMode(BTN2, INPUT);
[Link]();
[Link](0x70);
[Link](5);
}
void loop() {
// START / PAUSE
if (digitalRead(BTN1) == HIGH) {
delay(200);
running = !running;
if (running) {
startTime = millis() - elapsed;
} else {
elapsed = millis() - startTime;
}
}
// RESET
if (digitalRead(BTN2) == HIGH) {
delay(200);
running = false;
elapsed = 0;
[Link]();
[Link]();
}
// TIME UPDATE
if (running) {
elapsed = millis() - startTime;
}
// DISPLAY UPDATE (every 100 ms)
if (millis() - lastDisplayUpdate > 100) {
lastDisplayUpdate = millis();
int value = elapsed / 10;
if (value > 9999) value = 9999;
int thousands = (value / 1000) % 10;
int hundreds = (value / 100) % 10;
int tens = (value / 10) % 10;
int ones = value % 10;
[Link](0, thousands);
[Link](1, hundreds);
[Link](2, tens);
[Link](3, ones);
[Link]();
}
// Other sensors safe here
}
35
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
Full Sketch
/*
* ============================================================
* SmartElex Multi-Function Shield — AUTOMATED TEST SUITE
* ============================================================
*
* COMMANDS (type in Serial Monitor at 115200 baud, press Enter):
*
* R1 → Start Round 1 (Joystick / Encoder / Buzzer side)
* R2 → Start Round 2 (POT / Motor / Mic side)
* STOP → Stop current test
* STATUS → Show PASS/FAIL status of every test so far
* LIST → Show all test numbers for quick reference
* HELP → Reprint this command list
*
* RETRY any single test by typing its number + letter:
* 1A … 13A → Retry Round-1 test by number
* 1B … 5B → Retry Round-2 test by number
*
* Round 1 numbers:
* 1A Joystick X/Y 2A IR Sensor 3A Buzzer
* 4A Rotary Encoder 5A BTN1 (S1) 6A BTN2 (S2)
* 7A BTN3 (S3) 8A Flame Sensor 9A Touch Sensor
* 10A AHT20 11A LDR 12A 7-Segment
* 13A RGB LED
*
* Round 2 numbers:
* 1B Potentiometer 2B BTN4 (S4) 3B Microphone
* 4B DC Motor 5B Status LED
* ============================================================
*/
#include <Wire.h>
#include <Adafruit_NeoPixel.h>
#include <Adafruit_GFX.h>
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_AHTX0.h"
36
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
int testIndex = 0;
bool testRunning = false;
unsigned long slotStart = 0;
// encoder state
int lastClkState = HIGH;
int encCount = 0;
// motor state
bool motorFwd = true;
unsigned long motorToggleAt = 0;
// ── Round 1 slots ──
TestSlot r1[] = {
{ "Joystick X/Y", 6000, false, false }, // index 0 → cmd 1A
{ "IR Sensor", 5000, false, false }, // index 1 → cmd 2A
{ "Buzzer", 4000, false, false }, // index 2 → cmd 3A
{ "Rotary Encoder", 8000, false, false }, // index 3 → cmd 4A
{ "BTN1 (S1)", 5000, false, false }, // index 4 → cmd 5A
{ "BTN2 (S2)", 5000, false, false }, // index 5 → cmd 6A
{ "BTN3 (S3)", 5000, false, false }, // index 6 → cmd 7A
{ "Flame Sensor", 15000, false, false }, // index 7 → cmd 8A
{ "Touch Sensor", 6000, false, false }, // index 8 → cmd 9A
{ "AHT20 Temp/Hum", 9000, false, false }, // index 9 → cmd 10A
{ "LDR", 5000, false, false }, // index 10 → cmd 11A
{ "7-Segment", 5000, false, false }, // index 11 → cmd 12A
{ "RGB LED", 8000, false, false }, // index 12 → cmd 13A
};
const int R1_COUNT = sizeof(r1) / sizeof(r1[0]); // 13
// ── Round 2 slots ──
TestSlot r2[] = {
{ "Potentiometer", 6000, false, false }, // index 0 → cmd 1B
{ "BTN4 (S4)", 5000, false, false }, // index 1 → cmd 2B
{ "Microphone", 5000, false, false }, // index 2 → cmd 3B
{ "DC Motor", 12000, false, false }, // index 3 → cmd 4B
37
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
void stopAllOutputs() {
digitalWrite(BUZZER, LOW);
digitalWrite(MOTOR_IN1, LOW);
pinMode(MOTOR_IN2, OUTPUT);
digitalWrite(MOTOR_IN2, LOW);
[Link]();
[Link]();
[Link]();
[Link]();
}
pinMode(IR_PIN, INPUT);
pinMode(BUZZER, OUTPUT);
pinMode(ENC_CLK, INPUT);
pinMode(ENC_DT, INPUT);
pinMode(ENC_SW, INPUT_PULLUP);
pinMode(BTN1, INPUT);
pinMode(BTN2, INPUT);
pinMode(BTN3, INPUT);
pinMode(FLAME, INPUT);
pinMode(MOTOR_IN1, OUTPUT);
pinMode(STATUS_LED, OUTPUT);
38
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
[Link]();
[Link]();
[Link]();
[Link](0x70);
[Link](12);
if (![Link]()) {
[Link](F("WARNING: AHT20 not found — check I2C wiring!"));
}
if ([Link]() == 0) {
// ignore blank lines
}
else if (cmd == "R1") {
startRound(ROUND1);
}
else if (cmd == "R2") {
startRound(ROUND2);
}
else if (cmd == "STOP") {
stopRound();
}
else if (cmd == "STATUS") {
printStatus();
}
else if (cmd == "LIST") {
printList();
}
else if (cmd == "HELP") {
printCommandMenu();
}
else {
// Try to parse as a retry command e.g. "8A" or "3B"
parseRetry(cmd);
}
}
39
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
if (activeRound == SINGLE) {
// Retry finished — return to IDLE
[Link](F(""));
[Link](F("[RETRY DONE] Type another command or test number."));
printSeparator();
activeRound = IDLE;
testRunning = false;
}
else {
// Full round — move to next test
testIndex++;
if (testIndex < count) {
beginSlot(testIndex, runRound);
}
else {
printRoundSummary(runRound);
stopRound();
}
}
}
}
40
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
// Announce retry
[Link](F(""));
printSeparator();
[Link](F(">>> RETRY ["));
[Link](num);
[Link](letter);
[Link](F("] "));
[Link](slots[slotIdx].name);
printSeparator();
41
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
activeRound = r;
testIndex = 0;
testRunning = true;
if (r == ROUND1) {
printHeader("ROUND 1 STARTED — Jumper: Joystick/Encoder side");
} else {
printHeader("ROUND 2 STARTED — Jumper: POT/Motor/Mic side");
}
[Link](F("Interact with each component when prompted!"));
[Link](F("Tip: type STOP anytime, then NxA/NxB to retry."));
beginSlot(0, r);
}
void stopRound() {
stopAllOutputs();
activeRound = IDLE;
testRunning = false;
testIndex = 0;
[Link](F(""));
[Link](F("[STOPPED] Type R1, R2, or a test number to retry."));
printSeparator();
}
[Link](F(""));
[Link](F("=== Testing: "));
[Link](slots[idx].name);
[Link](F(" ("));
[Link](slots[idx].durationMs / 1000);
[Link](F("s) ==="));
if (r == ROUND1) {
switch (idx) {
case 0: [Link](F(" >> Move joystick in all directions...")); break;
case 1: [Link](F(" >> Wave hand in front of IR sensor...")); break;
case 2: [Link](F(" >> Listen for buzzer beeps...")); break;
case 3: [Link](F(" >> Rotate encoder CW/CCW and press its
button...")); break;
case 4: [Link](F(" >> Press BTN1 (S1)...")); break;
case 5: [Link](F(" >> Press BTN2 (S2)...")); break;
case 6: [Link](F(" >> Press BTN3 (S3)...")); break;
case 7: [Link](F(" >> Hold flame/lighter near sensor
(carefully!)...")); break;
case 8: [Link](F(" >> Touch the touch pad...")); break;
case 9: [Link](F(" >> AHT20 reading automatically...")); break;
case 10: [Link](F(" >> Cover then uncover the LDR...")); break;
42
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
case 0: { // Joystick
int x = analogRead(JOY_X);
int y = analogRead(JOY_Y);
[Link](F(" X=")); [Link](x);
[Link](F(" Y=")); [Link](y);
if (x < 400 || x > 600 || y < 400 || y > 600) r1[idx].passed = true;
r1[idx].checked = true;
delay(300);
break;
}
case 1: { // IR
bool det = (digitalRead(IR_PIN) == LOW);
[Link](det ? F(" IR: Object detected!") : F(" IR: No object"));
if (det) r1[idx].passed = true;
r1[idx].checked = true;
delay(300);
break;
}
case 2: { // Buzzer
digitalWrite(BUZZER, HIGH); delay(200);
digitalWrite(BUZZER, LOW); delay(200);
r1[idx].passed = true;
r1[idx].checked = true;
break;
}
case 3: { // Encoder
int clk = digitalRead(ENC_CLK);
if (clk != lastClkState) {
if (clk == LOW) {
if (digitalRead(ENC_DT) != clk) {
encCount++;
[Link](F(" Encoder: CW"));
} else {
43
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
encCount--;
[Link](F(" Encoder: CCW"));
}
r1[idx].passed = true;
}
lastClkState = clk;
}
if (digitalRead(ENC_SW) == LOW) {
[Link](F(" Encoder button pressed"));
r1[idx].passed = true;
}
r1[idx].checked = true;
break;
}
case 4: { // BTN1
if (digitalRead(BTN1) == HIGH) {
[Link](F(" BTN1 pressed!"));
r1[idx].passed = true;
}
r1[idx].checked = true;
delay(100);
break;
}
case 5: { // BTN2
if (digitalRead(BTN2) == HIGH) {
[Link](F(" BTN2 pressed!"));
r1[idx].passed = true;
}
r1[idx].checked = true;
delay(100);
break;
}
case 6: { // BTN3
if (digitalRead(BTN3) == HIGH) {
[Link](F(" BTN3 pressed!"));
r1[idx].passed = true;
}
r1[idx].checked = true;
delay(100);
break;
}
case 7: { // Flame
bool fl = (digitalRead(FLAME) == LOW);
[Link](fl ? F(" FLAME DETECTED!") : F(" No flame"));
if (fl) r1[idx].passed = true;
r1[idx].checked = true;
delay(300);
break;
}
case 8: { // Touch
pinMode(TOUCH, INPUT);
bool t = (digitalRead(TOUCH) == HIGH);
[Link](t ? F(" Touch detected!") : F(" No touch"));
if (t) r1[idx].passed = true;
r1[idx].checked = true;
delay(200);
break;
}
case 9: { // AHT20
44
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
case 0: { // POT
int v = analogRead(POT);
[Link](F(" POT=")); [Link](v);
if (v > 20 && v < 1000) r2[idx].passed = true;
r2[idx].checked = true;
delay(300);
break;
}
45
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
case 1: { // BTN4
pinMode(BTN4, INPUT);
if (digitalRead(BTN4) == HIGH) {
[Link](F(" BTN4 pressed!"));
r2[idx].passed = true;
}
r2[idx].checked = true;
delay(100);
break;
}
case 2: { // Microphone
static int micMin = 1024;
static int micMax = 0;
int v = analogRead(MIC);
[Link](F(" MIC=")); [Link](v);
if (v < micMin) micMin = v;
if (v > micMax) micMax = v;
if ((micMax - micMin) > 30) r2[idx].passed = true;
r2[idx].checked = true;
delay(50);
break;
}
case 3: { // DC Motor
pinMode(MOTOR_IN2, OUTPUT);
unsigned long now = millis();
if (now >= motorToggleAt) {
motorFwd = !motorFwd;
motorToggleAt = now + 6000;
[Link](motorFwd ? F(" Motor: FORWARD") : F(" Motor: REVERSE"));
}
if (motorFwd) {
digitalWrite(MOTOR_IN1, HIGH);
digitalWrite(MOTOR_IN2, LOW);
} else {
digitalWrite(MOTOR_IN1, LOW);
digitalWrite(MOTOR_IN2, HIGH);
}
r2[idx].passed = true;
r2[idx].checked = true;
delay(200);
break;
}
46
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
printSeparator();
[Link](F("PASSED: ")); [Link](passed);
[Link](F(" / FAILED: ")); [Link](failed);
if (failed == 0) {
[Link](F("ALL TESTS PASSED — Board is healthy!"));
} else {
[Link](F("To retry a failed test, type its number+letter."));
[Link](F("Example: 8A retries Flame Sensor"));
}
printSeparator();
}
printSeparator();
47
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
48
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
49
SmartElex Bharat Explorer Shield (Compatible With Arduino Uno R3, R4, & Q)— User Manual & Activity Guide
Troubleshooting
Common Issues & Fixes
Display not showing: Check I2C address is 0x70. Ensure [Link]() is called in setup().
NeoPixels not lighting: Confirm LED_PIN=3 and [Link]() called. Check USB power
supply.
AHT20 not found: Check I2C wiring. Both AHT20 and 7-seg share I2C — address conflict
unlikely but verify.
Buzzer silent: BUZZER pin is D13 — shared with onboard LED. Use tone() not
analogWrite().
Motor not running: Set jumper to R2 side. MOTOR_IN2=D4 only works when D4 is not in
Touch mode.
Retry command ignored: Make sure Serial Monitor line ending is set to 'Newline' not 'No
line ending'.
50
50