Jump to content

MDM331AID/Experiment 14: Difference between revisions

From cognifront
CogWikiEditor (talk | contribs)
Created page with "= Experiment: Smart Threshold Alerts for Data Minimization using Privacy-by-Design = == Aim == To design and implement a Privacy-by-Design IoT system using an LDR sensor and ESP32 that generates an alert only when a predefined threshold is crossed, thereby minimizing unnecessary sensor data transmission. == Objectives == # To understand Privacy-by-Design in an IoT system. # To understand the concept of data minimization. # To interface an LDR sensor with ESP32. # To..."
 
CogWikiEditor (talk | contribs)
No edit summary
Line 3: Line 3:
== Aim ==
== Aim ==


To design and implement a Privacy-by-Design IoT system using an LDR sensor and ESP32 that generates an alert only when a predefined threshold is crossed, thereby minimizing unnecessary sensor data transmission.
To design and implement a Privacy-by-Design IoT system using a vibration sensor and ESP32 that detects excessive vibration using a predefined threshold and generates an alert only when the threshold condition is reached, thereby minimizing unnecessary sensor data transmission.


== Objectives ==
== Objectives ==
Line 9: Line 9:
# To understand Privacy-by-Design in an IoT system.
# To understand Privacy-by-Design in an IoT system.
# To understand the concept of data minimization.
# To understand the concept of data minimization.
# To interface an LDR sensor with ESP32.
# To interface a vibration sensor with ESP32.
# To detect changes in light intensity.
# To detect vibration activity using the sensor.
# To define a threshold for detecting darkness.
# To define a threshold for excessive vibration.
# To generate a POWER CUT alert when darkness is detected.
# To generate an EXCESSIVE VIBRATION alert when the threshold is crossed.
# To process raw sensor data locally on the ESP32.
# To process vibration data locally on the ESP32.
# To avoid continuously transmitting raw LDR readings.
# To avoid continuously transmitting raw vibration readings.
# To transmit or expose only the required alert information.
# To expose only the required alert information.
# To demonstrate data minimization through data inspection.
# To demonstrate data minimization through a simple web-based monitoring system.


== Components Required ==
== Components Required ==
Line 29: Line 29:
| ESP32 Development Board
| ESP32 Development Board
| 1
| 1
| Reads the LDR and hosts the web server
| Reads the vibration sensor and hosts the web server
|-
|-
| 2
| 2
| LDR
| Vibration Sensor Module
| 1
| 1
| Detects light intensity
| Detects vibration activity
|-
|-
| 3
| 3
| 10 kOhm Resistor
| 1
| Forms the LDR voltage divider
|-
| 4
| Breadboard
| Breadboard
| 1
| 1
| Circuit connections
| Circuit connections
|-
|-
| 5
| 4
| Jumper Wires
| Jumper Wires
| As required
| As required
| Electrical connections
| Electrical connections
|-
|-
| 6
| 5
| Smartphone
| Smartphone
| 1
| 1
| Accesses the ESP32 web page
| Accesses the ESP32 web page
|-
|-
| 7
| 6
| USB Cable
| USB Cable
| 1
| 1
| Programming and powering ESP32
| Programming and powering ESP32
|-
|-
| 8
| 7
| Computer with Arduino IDE
| Computer with Arduino IDE
| 1
| 1
Line 75: Line 70:
In a conventional IoT system, sensor readings may be continuously transmitted even when the application does not require all of the readings.
In a conventional IoT system, sensor readings may be continuously transmitted even when the application does not require all of the readings.


For example, an LDR monitoring system may continuously generate values such as:
For example, a vibration monitoring system may continuously generate sensor readings.
 
<pre>
3860
3715
3521
3480
3405
</pre>


If the purpose of the application is only to detect a power cut, the application does not need every individual LDR reading.
If the purpose of the application is only to detect excessive vibration, the application does not necessarily need every individual sensor reading.


The ESP32 can instead process the sensor data locally and generate an alert only when the required condition occurs.
The ESP32 can instead process the vibration activity locally and generate an alert only when the required condition occurs.


=== Privacy-by-Design ===
=== Privacy-by-Design ===


Privacy-by-Design means that privacy is considered while designing the system rather than being added later.
Privacy-by-Design means that privacy considerations are incorporated into the design of a system from the beginning.


One important part of Privacy-by-Design is data minimization.
One important approach related to Privacy-by-Design is data minimization.


Data minimization means collecting, processing, transmitting, and storing only the information that is necessary for the intended purpose.
Data minimization means collecting, processing, transmitting, and storing only the information that is necessary for the intended purpose.


In this experiment, the purpose is to detect a possible power cut.
In this experiment, the purpose is to detect excessive vibration.


Therefore, the system does not need to continuously expose the exact LDR readings.
Therefore, the system does not need to continuously expose every raw vibration reading.


The ESP32 processes the readings locally and only generates the required alert when the threshold is crossed.
The ESP32 processes the vibration activity locally and generates an alert only when the predefined threshold condition is reached.


=== Smart Threshold Alert ===
=== Smart Threshold Alert ===


A threshold is a predefined value used to identify a particular condition.
A threshold is a predefined value used to determine when a particular condition has occurred.


The ESP32 reads the LDR value and compares it with the selected threshold.
The ESP32 monitors the vibration sensor and keeps track of vibration activity.
 
When the number of detected vibration events reaches the selected threshold within the monitoring period, the ESP32 considers the vibration level excessive.


The operation is:
The operation is:


<pre>
<pre>
LDR reading
Vibration Sensor
    |
      |
    v
      v
ESP32
    ESP32
    |
      |
    v
      v
Monitor vibration activity
      |
      v
Check threshold
Check threshold
    |
      |
    +-------------------+
      +----------------------+
    |                   |
      |                     |
    v                   v
      v                     v
Normal condition    Dark condition
Normal vibration      Excessive vibration
    |                   |
      |                     |
    v                   v
      v                     v
No alert           POWER CUT
  No alert         EXCESSIVE VIBRATION
                    alert
</pre>
</pre>


The threshold value depends on the LDR circuit and surrounding lighting conditions.
The threshold can be adjusted according to the sensor and the required application.
 
Therefore, the threshold should be calibrated before performing the experiment.


=== Data Minimization ===
=== Data Minimization ===


In a conventional system, raw LDR readings may be continuously sent to another device or server.
In a conventional system, raw vibration readings may be continuously sent to another device or server.


In the proposed system:
In the proposed system:


<pre>
<pre>
LDR reading
Vibration Sensor
    |
      |
    v
      v
Local processing on ESP32
Local processing on ESP32
    |
      |
    v
      v
Threshold check
Count vibration activity
    |
      |
    +------------------+
      v
    |                 |
Check threshold
    v                 v
      |
Normal            Dark
      +----------------------+
    |                 |
      |                     |
    v                 v
      v                     v
No alert           POWER CUT
Below threshold        Threshold reached
      |                     |
      v                     v
  No alert         EXCESSIVE VIBRATION
</pre>
</pre>


The raw LDR value is used locally for decision making.
The raw vibration activity is processed locally for decision making.


Unnecessary raw readings are therefore not continuously exposed outside the device.
Unnecessary continuous sensor data is therefore not exposed outside the device.


== Pin Connections ==
== Sensor Connection ==
 
The vibration sensor module normally provides VCC, GND, and a digital output pin.


{| class="wikitable"
{| class="wikitable"
! LDR Circuit
! Vibration Sensor Pin
! ESP32
! ESP32
! Description
! Description
|-
|-
| LDR voltage divider output
| VCC
| GPIO 34
| 3.3V
| Analog input
| Sensor power supply
|-
|-
| Supply
| DO or OUT
| 3.3V
| GPIO 27
| Circuit supply
| Digital vibration signal
|-
|-
| Ground
| GND
| GND
| GND
| Common ground
| Common ground
|}
|}


A typical voltage divider is:
'''Note:''' The exact pin names may vary between vibration sensor modules. Verify the labels on the actual sensor before making the connections.
 
<pre>
        3.3V
          |
        LDR
          |
          +-------- GPIO 34
          |
        10 kOhm
          |
        GND
</pre>
 
The voltage at GPIO 34 changes according to the amount of light falling on the LDR.
 
'''Note:''' Depending on the circuit arrangement, the LDR reading may increase or decrease when the sensor is covered. The actual behavior should be checked during calibration.


== Connection Diagram ==
== Connection Diagram ==


<pre>
<pre>
                ESP32
            Vibration Sensor
             +------------+
             +-------------+
             |           |
             |             |
      3.3V --|           |
    3.3V ---| VCC        |
             |           |
             |             |
            | GPIO 34 <--|------ LDR Circuit
GPIO 27 &lt;---| DO / OUT    |
             |           |
             |             |
      GND --|           |
    GND ----| GND        |
            |            |
             +-------------+
             +------------+
                    |
                    |
                  ESP32
                     |
                     |
                     |
                     |
Line 226: Line 206:
== Working Principle ==
== Working Principle ==


The ESP32 works as a Wi-Fi Access Point and hosts a web server.
The ESP32 works as a Wi-Fi Access Point and hosts a simple web server.


The smartphone connects directly to the Wi-Fi network created by the ESP32.
The smartphone connects directly to the Wi-Fi network created by the ESP32.
Line 236: Line 216:
</pre>
</pre>


The ESP32 reads the LDR value.
The ESP32 monitors the vibration sensor.


The value is compared with the threshold.
Each detected vibration event increases the vibration count during the monitoring period.


When sufficient light is present, the system remains in the normal condition.
When the vibration count reaches the predefined threshold, the ESP32 generates an EXCESSIVE VIBRATION alert.


When the LDR is covered and the reading crosses the threshold, the ESP32 considers the condition to represent a power cut.
The web page displays the current status.


The smartphone then displays the POWER CUT alert.
The web page automatically refreshes every 5 seconds so that the latest status can be observed.


The raw LDR value is processed locally.
The raw vibration activity is processed locally on the ESP32.


== Program ==
== Program ==
The following program avoids embedding HTML source directly into the MediaWiki page.
The web page is constructed using character values so that the program does not contain HTML tags as literal text.


<pre>
<pre>
Line 258: Line 234:
#include &lt;WebServer.h&gt;
#include &lt;WebServer.h&gt;


const int LDR_PIN = 34;
const int VIBRATION_PIN = 27;


const char* ap_ssid = "ESP32-Power-Monitor";
const char* ap_ssid = "ESP32-Vibration-Monitor";
const char* ap_password = "12345678";
const char* ap_password = "12345678";


WebServer server(80);
WebServer server(80);


const int LDR_THRESHOLD = 2000;
/*
  Number of vibration events required
  to generate an alert.
*/
const int VIBRATION_THRESHOLD = 5;
 
/*
  Monitoring period in milliseconds.
*/
const unsigned long MONITOR_PERIOD = 10000;
 
int vibrationCount = 0;
bool excessiveVibration = false;


bool powerCut = false;
unsigned long periodStart = 0;


void handleRoot()
int lastSensorState = LOW;
 
void updateVibration()
{
{
   int ldrValue = analogRead(LDR_PIN);
   int sensorState = digitalRead(VIBRATION_PIN);


   if (ldrValue &lt; LDR_THRESHOLD)
  /*
    Count a vibration when the sensor
    changes from LOW to HIGH.
  */
   if (sensorState == HIGH && lastSensorState == LOW)
   {
   {
     powerCut = true;
     vibrationCount++;
   }
   }
   else
 
   lastSensorState = sensorState;
 
  /*
    Check whether the monitoring period
    has ended.
  */
  if (millis() - periodStart >= MONITOR_PERIOD)
   {
   {
     powerCut = false;
     if (vibrationCount >= VIBRATION_THRESHOLD)
    {
      excessiveVibration = true;
    }
    else
    {
      excessiveVibration = false;
    }
 
    /*
      Start a new monitoring period.
    */
    vibrationCount = 0;
    periodStart = millis();
   }
   }
}
void handleRoot()
{
  updateVibration();


   String page = "";
   String page = "";
Line 297: Line 316:
   page += lt;
   page += lt;
   page += "meta name='viewport' content='width=device-width, initial-scale=1'";
   page += "meta name='viewport' content='width=device-width, initial-scale=1'";
  page += gt;
  page += lt;
  page += "meta http-equiv='refresh' content='5'";
   page += gt;
   page += gt;


Line 302: Line 325:
   page += "title";
   page += "title";
   page += gt;
   page += gt;
   page += "Smart Power Monitor";
   page += "Vibration Monitor";
   page += lt;
   page += lt;
   page += "/title";
   page += "/title";
Line 318: Line 341:
   page += "h1";
   page += "h1";
   page += gt;
   page += gt;
   page += "Smart Power Monitor";
   page += "Smart Vibration Monitor";
   page += lt;
   page += lt;
   page += "/h1";
   page += "/h1";
   page += gt;
   page += gt;


   if (powerCut)
   if (excessiveVibration)
   {
   {
     page += lt;
     page += lt;
     page += "h2";
     page += "h2";
     page += gt;
     page += gt;
     page += "POWER CUT";
     page += "EXCESSIVE VIBRATION";
     page += lt;
     page += lt;
     page += "/h2";
     page += "/h2";
Line 336: Line 359:
     page += "p";
     page += "p";
     page += gt;
     page += gt;
     page += "Dark condition detected.";
     page += "Threshold crossed. Alert generated.";
     page += lt;
     page += lt;
     page += "/p";
     page += "/p";
Line 354: Line 377:
     page += "p";
     page += "p";
     page += gt;
     page += gt;
     page += "No power cut detected.";
     page += "Vibration level is within the normal range.";
     page += lt;
     page += lt;
     page += "/p";
     page += "/p";
     page += gt;
     page += gt;
   }
   }
  page += lt;
  page += "p";
  page += gt;
  page += "Page refreshes every 5 seconds.";
  page += lt;
  page += "/p";
  page += gt;


   page += lt;
   page += lt;
Line 375: Line 406:
   Serial.begin(115200);
   Serial.begin(115200);


   pinMode(LDR_PIN, INPUT);
   pinMode(VIBRATION_PIN, INPUT);
 
  periodStart = millis();


   WiFi.softAPConfig(
   WiFi.softAPConfig(
Line 398: Line 431:
void loop()
void loop()
{
{
  updateVibration();
   server.handleClient();
   server.handleClient();
}
}
Line 412: Line 447:
|-
|-
| WebServer.h
| WebServer.h
| Provides the web server functionality.
| Provides web server functionality.
|-
|-
| LDR_PIN
| VIBRATION_PIN
| Defines GPIO 34 as the LDR analog input.
| Defines GPIO 27 as the vibration sensor input.
|-
|-
| WiFi.softAP
| WiFi.softAP
Line 426: Line 461:
| Creates an HTTP web server on port 80.
| Creates an HTTP web server on port 80.
|-
|-
| LDR_THRESHOLD
| VIBRATION_THRESHOLD
| Defines the value used to detect the dark condition.
| Defines the number of vibration events required to generate an alert.
|-
| MONITOR_PERIOD
| Defines the time interval over which vibration events are counted.
|-
| vibrationCount
| Stores the number of detected vibration events.
|-
| excessiveVibration
| Stores whether the excessive-vibration condition has been detected.
|-
|-
| analogRead
| digitalRead
| Reads the analog value from the LDR circuit.
| Reads the digital output of the vibration sensor.
|-
|-
| powerCut
| updateVibration
| Stores whether a dark condition has been detected.
| Detects vibration events and checks the threshold.
|-
|-
| handleRoot
| handleRoot
Line 452: Line 496:


<pre>
<pre>
ESP32-Power-Monitor
ESP32-Vibration-Monitor
</pre>
</pre>


Line 467: Line 511:
</pre>
</pre>


=== Threshold Detection ===
=== Vibration Detection ===


The ESP32 reads the LDR using:
The ESP32 reads the digital output of the vibration sensor:


<pre>
<pre>
int ldrValue = analogRead(LDR_PIN);
int sensorState = digitalRead(VIBRATION_PIN);
</pre>
</pre>


The value is compared with the threshold:
When a vibration event causes the sensor output to change from LOW to HIGH, the vibration count is increased.


<pre>
<pre>
if (ldrValue < LDR_THRESHOLD)
if (sensorState == HIGH && lastSensorState == LOW)
{
{
   powerCut = true;
   vibrationCount++;
}
}
</pre>
</pre>


If the condition is satisfied, the ESP32 generates the POWER CUT alert.
This allows the ESP32 to count vibration events locally.


== Calibration of LDR Threshold ==
=== Threshold Detection ===


The threshold should be calibrated before the experiment.
The program uses a vibration threshold:


# Upload the program to the ESP32.
<pre>
# Open the Arduino IDE Serial Monitor.
const int VIBRATION_THRESHOLD = 5;
# Observe the LDR readings under normal light.
</pre>
# Cover the LDR with a finger.
# Observe the LDR readings again.
# Compare the readings for bright and dark conditions.
# Select a suitable threshold between the two conditions.
# Change the LDR_THRESHOLD value in the program.
# Upload the program again.
# Test the system.


For example, the readings may be:
The monitoring period is:


<pre>
<pre>
Normal light:
const unsigned long MONITOR_PERIOD = 10000;
3000 to 3800
</pre>
 
This means that the ESP32 counts vibration events during a 10 second period.
 
If the number of detected events is 5 or more, the system generates the excessive vibration alert.
 
The threshold can be changed depending on the sensor and demonstration requirements.
 
== Calibration of Vibration Threshold ==


LDR covered:
The threshold should be tested before performing the main experiment.
500 to 1200
</pre>


In such a case, a threshold somewhere between these ranges can be selected.
# Upload the program to the ESP32.
# Open the Arduino IDE Serial Monitor.
# Keep the vibration sensor stationary.
# Observe the system under normal conditions.
# Tap or shake the vibration sensor several times.
# Observe how the sensor responds.
# Select a suitable vibration threshold.
# Change the VIBRATION_THRESHOLD value if required.
# Upload the program again.
# Verify that normal vibration does not unnecessarily generate an alert.
# Verify that repeated vibration generates the alert.


'''The above values are examples only. Actual values depend on the LDR circuit and lighting conditions.'''
For a simple classroom demonstration, the threshold can be kept low so that students can easily trigger the alert by tapping or shaking the sensor.


== Procedure ==
== Procedure ==


# Connect the LDR and resistor as a voltage divider.
# Connect the vibration sensor to the ESP32.
# Connect the output of the voltage divider to GPIO 34.
# Connect VCC to 3.3V.
# Connect the circuit to 3.3V and GND.
# Connect GND to GND.
# Connect the digital output of the vibration sensor to GPIO 27.
# Connect the ESP32 to the computer.
# Connect the ESP32 to the computer.
# Open Arduino IDE.
# Open Arduino IDE.
Line 527: Line 581:
# Open the Serial Monitor.
# Open the Serial Monitor.
# Verify that the ESP32 Access Point has started.
# Verify that the ESP32 Access Point has started.
# Connect the smartphone to ESP32-Power-Monitor.
# Connect the smartphone to ESP32-Vibration-Monitor.
# Open the smartphone browser.
# Open the smartphone browser.
# Enter http://192.168.1.4.
# Enter http://192.168.1.4.
# Observe the NORMAL status.
# Observe the NORMAL status.
# Keep the LDR exposed to light.
# Keep the vibration sensor stationary.
# Cover the LDR using a finger.
# Tap or shake the sensor repeatedly.
# Observe the POWER CUT alert.
# Generate several vibration events within the monitoring period.
# Remove the finger.
# Observe the EXCESSIVE VIBRATION alert.
# Verify that the normal condition is restored.
# Wait for the next monitoring period and observe the status.
# Perform the data inspection demonstration.
# Verify that the web page refreshes automatically every 5 seconds.
# Perform the data minimization demonstration.


== Observations and Output ==
== Observations and Output ==
Line 542: Line 597:
=== Normal Condition ===
=== Normal Condition ===


When the LDR is exposed to sufficient light:
When the vibration sensor is stationary or experiences only minor vibration:


<pre>
<pre>
LDR Condition : Bright
Sensor Condition : Normal
System Status : NORMAL
System Status   : NORMAL
Alert         : None
Alert           : None
</pre>
</pre>


No power-cut alert is generated.
The system does not generate an alert.


=== Dark Condition ===
=== Excessive Vibration Condition ===


When the LDR is covered with a finger:
When repeated vibration events cross the predefined threshold:


<pre>
<pre>
LDR Condition : Dark
Sensor Condition : Excessive vibration
System Status : ALERT
System Status   : ALERT
Alert         : POWER CUT
Alert           : EXCESSIVE VIBRATION
</pre>
</pre>


The ESP32 detects the threshold crossing and generates the alert.
The ESP32 generates the alert locally.


=== Smartphone Output ===
=== Smartphone Output ===
Line 569: Line 624:


<pre>
<pre>
SMART POWER MONITOR
SMART VIBRATION MONITOR


NORMAL
NORMAL


No power cut detected.
Vibration level is within
the normal range.
 
Page refreshes every 5 seconds.
</pre>
</pre>


Dark condition:
Excessive vibration condition:


<pre>
<pre>
SMART POWER MONITOR
SMART VIBRATION MONITOR


POWER CUT
EXCESSIVE VIBRATION


Dark condition detected.
Threshold crossed.
Alert generated.
 
Page refreshes every 5 seconds.
</pre>
</pre>


== Demonstration of Data Minimization ==
== Demonstration of Data Minimization ==


The main purpose of this experiment is to demonstrate that unnecessary raw sensor data does not need to be transmitted.
The main purpose of this experiment is to demonstrate that unnecessary raw sensor information does not need to be continuously transmitted.


=== Conventional System ===
=== Conventional System ===


In a conventional IoT system, the server may receive raw LDR readings continuously.
In a conventional IoT system, every sensor event or sensor reading could be transmitted to a server.


For example:
For example:


<pre>
<pre>
LDR value: 3860
Vibration event detected
 
Vibration event detected
LDR value: 3715
Vibration event detected
 
Vibration event detected
LDR value: 3521
Vibration event detected
 
LDR value: 3480
</pre>
</pre>


The server therefore receives detailed sensor information.
The server would receive a continuous stream of sensor information.


=== Privacy-by-Design System ===
=== Privacy-by-Design System ===


In the proposed system, the ESP32 processes the LDR reading locally.
In the proposed system, the ESP32 processes the vibration activity locally.
 
During normal conditions:


<pre>
The ESP32 counts the vibration events and compares the count with the threshold.
LDR reading
    |
    v
Local threshold check
    |
    v
Normal condition
    |
    v
No alert
</pre>


When the threshold is crossed:
The process is:


<pre>
<pre>
LDR reading
Vibration activity
    |
      |
    v
      v
Local threshold check
Local processing
    |
      |
    v
      v
Dark condition
Count events
    |
      |
    v
      v
POWER CUT
Check threshold
      |
      +---------------------+
      |                    |
      v                    v
Below threshold        Threshold reached
      |                    |
      v                    v
  No alert          EXCESSIVE VIBRATION
</pre>
</pre>


The application only needs to expose the required event.
The raw vibration activity is not required outside the ESP32 for the basic application.


The raw LDR measurement does not need to be exposed.
Only the required alert needs to be exposed.


== Data Inspection Demonstration ==
== Data Inspection Demonstration ==
Line 654: Line 708:
=== Conventional Design ===
=== Conventional Design ===


A conventional system may expose information such as:
A conventional system may continuously expose individual vibration events:


<pre>
<pre>
LDR value: 3860
Vibration event
LDR value: 3715
Vibration event
LDR value: 3521
Vibration event
LDR value: 1200
Vibration event
Vibration event
</pre>
</pre>


An observer can therefore obtain detailed information about the sensor readings.
An observer can therefore obtain detailed information about the vibration activity.


=== Privacy-by-Design Design ===
=== Privacy-by-Design Design ===


The Privacy-by-Design system processes the raw value locally.
The Privacy-by-Design system processes the vibration activity locally.


When there is no threshold event:
When the vibration count is below the threshold:


<pre>
<pre>
Line 675: Line 730:
</pre>
</pre>


When darkness is detected:
When the threshold is reached:


<pre>
<pre>
POWER CUT
EXCESSIVE VIBRATION
</pre>
</pre>


The application therefore exposes only the information needed for the intended purpose.
The application therefore exposes only the information required for the intended purpose.
 
The raw LDR values are not required by the application.


=== Demonstration Steps ===
=== Demonstration Steps ===
Line 689: Line 742:
# Connect the smartphone to the ESP32 Access Point.
# Connect the smartphone to the ESP32 Access Point.
# Open the ESP32 web page.
# Open the ESP32 web page.
# Observe the normal condition.
# Observe the NORMAL condition.
# Cover the LDR with a finger.
# Tap or shake the vibration sensor repeatedly.
# Observe the POWER CUT alert.
# Generate enough vibration events to cross the threshold.
# Observe the EXCESSIVE VIBRATION alert.
# Inspect the application data using an appropriate network inspection or server logging method.
# Inspect the application data using an appropriate network inspection or server logging method.
# Observe that the useful application information is the alert rather than a continuous stream of raw LDR values.
# Observe that the application does not need to continuously expose every vibration event.
# Explain that the raw reading was processed locally before the alert was generated.
# Explain that the ESP32 processes the vibration activity locally before generating the alert.


'''Note:''' This demonstration is about data minimization. It does not claim that HTTP communication is encrypted or completely secure.
'''Note:''' This demonstration is about data minimization. It does not claim that HTTP communication is encrypted or completely secure.
Line 709: Line 763:
| Performed locally on ESP32
| Performed locally on ESP32
|-
|-
| Raw LDR readings
| Vibration events
| May be continuously transmitted
| May be continuously transmitted
| Processed locally
| Processed locally
|-
|-
| Normal readings
| Normal activity
| May be transmitted
| May be transmitted
| No unnecessary transmission
| No unnecessary transmission
Line 722: Line 776:
|-
|-
| Alert
| Alert
| May contain sensor information
| May contain detailed sensor information
| Only required alert is exposed
| Only required alert is exposed
|-
|-
Line 738: Line 792:
The experiment demonstrates Privacy-by-Design through the following design decisions:
The experiment demonstrates Privacy-by-Design through the following design decisions:


# '''Local Processing:''' Raw LDR readings are processed on the ESP32.
# '''Local Processing:''' Vibration activity is processed on the ESP32.
# '''Data Minimization:''' Continuous raw readings are not unnecessarily transmitted.
# '''Data Minimization:''' Individual vibration events do not need to be continuously transmitted.
# '''Purpose Limitation:''' The system only needs to detect a possible power-cut condition.
# '''Purpose Limitation:''' The system only needs to detect excessive vibration.
# '''Smart Thresholding:''' An alert is generated only when the threshold is crossed.
# '''Smart Thresholding:''' An alert is generated only when the vibration threshold is crossed.
# '''Reduced Data Exposure:''' Unnecessary sensor information is not exposed.
# '''Reduced Data Exposure:''' Unnecessary sensor information is not exposed.
# '''Privacy by Default:''' The system is designed to minimize data exposure from the beginning.
# '''Privacy by Default:''' The system is designed to minimize data exposure from the beginning.
Line 751: Line 805:
when the application does not require it.
when the application does not require it.
</pre>
</pre>
== Automatic Page Refresh ==
The web page automatically refreshes every 5 seconds.
This is implemented using the page refresh setting in the generated web page.
The refresh interval allows the student to observe the latest vibration status without manually refreshing the browser.
The refresh interval is:
<pre>
5 seconds
</pre>
Therefore, after generating vibration activity, the student can wait for the next page refresh to observe the updated alert status.


== Advantages ==
== Advantages ==


# Reduces unnecessary data transmission.
# Reduces unnecessary sensor data transmission.
# Processes vibration information locally.
# Reduces the amount of sensor information exposed outside the device.
# Reduces the amount of sensor information exposed outside the device.
# Reduces network traffic.
# Allows fast local decision making.
# Allows fast local decision making.
# Demonstrates data minimization clearly.
# Demonstrates data minimization clearly.
# Does not require an external cloud server.
# Does not require an external cloud server.
# Can be demonstrated easily using a smartphone.
# Can be demonstrated easily using a smartphone.
# Can be extended to other IoT alert applications.
# Vibration can be generated manually by tapping or shaking the sensor.
# The web page automatically refreshes every 5 seconds.
# Can be extended to industrial machine monitoring applications.


== Limitations ==
== Limitations ==


# The LDR provides an indirect indication of a power cut.
# The vibration sensor module provides a simple indication of vibration and may not provide precise vibration measurements.
# Changes in environmental lighting can also trigger the alert.
# The sensor may respond differently depending on the strength and duration of vibration.
# The threshold must be calibrated.
# The threshold must be calibrated for the actual sensor and application.
# Environmental vibration may cause unwanted detections.
# The HTTP communication used in this experiment is not encrypted.
# The HTTP communication used in this experiment is not encrypted.
# This experiment demonstrates data minimization and not complete IoT security.
# This experiment demonstrates data minimization and not complete IoT security.
# A real power monitoring system would use an appropriate electrical sensing method.
# A real industrial vibration monitoring system would normally use a more precise vibration sensor and appropriate signal processing.


== Result ==
== Result ==


The smart threshold alert system was successfully implemented using an LDR sensor and ESP32.
The smart threshold alert system was successfully implemented using a vibration sensor and ESP32.


The ESP32 locally processed the LDR readings and detected a dark condition using a predefined threshold.
The ESP32 locally monitored vibration activity and counted vibration events during a predefined monitoring period.


When the threshold was crossed, the smartphone displayed a POWER CUT alert through the ESP32 web server.
When the number of vibration events reached the selected threshold, the system generated an EXCESSIVE VIBRATION alert.


The ESP32 used the IP address:
The alert was displayed on a smartphone through the ESP32 web server using:


<pre>
<pre>
192.168.1.4
http://192.168.1.4
</pre>
</pre>


The experiment demonstrated that raw LDR readings do not need to be continuously exposed when the application only requires an event notification.
The web page automatically refreshed every 5 seconds.
 
The experiment demonstrated that raw vibration activity does not need to be continuously exposed when the application only requires an excessive-vibration alert.


Thus, the experiment demonstrated data minimization through local processing and smart threshold alerts as a practical Privacy-by-Design approach.
Thus, the experiment demonstrated data minimization through local processing and smart threshold alerts as a practical Privacy-by-Design approach.
Line 800: Line 875:
'''Ans:''' Data minimization means collecting, processing, transmitting, and storing only the data required for the intended purpose.
'''Ans:''' Data minimization means collecting, processing, transmitting, and storing only the data required for the intended purpose.


'''Q3. Why is an LDR used?'''
'''Q3. Why is a vibration sensor used in this experiment?'''


'''Ans:''' An LDR is used because its light-sensitive behavior makes it easy to manually generate a threshold event by covering it with a finger.
'''Ans:''' A vibration sensor is used because vibration can be generated manually by tapping or shaking the sensor, making the alert easy to demonstrate.


'''Q4. What does darkness represent in this experiment?'''
'''Q4. What does excessive vibration represent in this experiment?'''


'''Ans:''' Darkness is treated as an indication of a possible power cut.
'''Ans:''' Excessive vibration represents a condition in which the number of vibration events has crossed the predefined threshold.


'''Q5. Why is the raw LDR value not continuously transmitted?'''
'''Q5. Why is the raw vibration activity not continuously transmitted?'''


'''Ans:''' The application only needs to know whether the threshold has been crossed. Therefore, continuous transmission of the raw value is unnecessary.
'''Ans:''' The application only needs to know whether excessive vibration has occurred. Therefore, continuously transmitting every vibration event is unnecessary.


'''Q6. Where is the threshold checked?'''
'''Q6. Where is the vibration threshold checked?'''


'''Ans:''' The threshold is checked locally on the ESP32.
'''Ans:''' The threshold is checked locally on the ESP32.
Line 818: Line 893:
'''Q7. What happens when the threshold is not crossed?'''
'''Q7. What happens when the threshold is not crossed?'''


'''Ans:''' No power-cut alert is generated and unnecessary sensor data is not exposed.
'''Ans:''' No excessive-vibration alert is generated.


'''Q8. What happens when the threshold is crossed?'''
'''Q8. What happens when the threshold is crossed?'''


'''Ans:''' The ESP32 detects the dark condition and generates the POWER CUT alert.
'''Ans:''' The ESP32 detects excessive vibration and generates the EXCESSIVE VIBRATION alert.


'''Q9. What is the purpose of the data inspection demonstration?'''
'''Q9. What is the purpose of the data inspection demonstration?'''


'''Ans:''' It demonstrates how much sensor information is exposed and how data minimization reduces unnecessary information.
'''Ans:''' It demonstrates how data minimization reduces the amount of unnecessary sensor information exposed outside the device.


'''Q10. What information is required when the threshold is crossed?'''
'''Q10. What information is required when the threshold is crossed?'''


'''Ans:''' The required information is the POWER CUT alert.
'''Ans:''' The required information is the EXCESSIVE VIBRATION alert.
 
'''Q11. Why does the web page refresh every 5 seconds?'''
 
'''Ans:''' The page refreshes every 5 seconds so that the smartphone can display the latest system status automatically.


'''Q11. Is the system completely secure?'''
'''Q12. Is the system completely secure?'''


'''Ans:''' No. The main purpose is to demonstrate data minimization and Privacy-by-Design. HTTP communication is not encrypted.
'''Ans:''' No. The main purpose is to demonstrate data minimization and Privacy-by-Design. The HTTP communication used here is not encrypted.


'''Q12. Does data minimization mean that no data is transmitted?'''
'''Q13. Does data minimization mean that no data is transmitted?'''


'''Ans:''' No. It means that only the data necessary for the intended purpose should be transmitted or exposed.
'''Ans:''' No. It means that only the data necessary for the intended purpose should be transmitted or exposed.


'''Q13. Why is local processing useful?'''
'''Q14. Why is local processing useful?'''


'''Ans:''' Local processing allows the ESP32 to make decisions using raw sensor data without unnecessarily exposing that raw data.
'''Ans:''' Local processing allows the ESP32 to make decisions using sensor data without unnecessarily exposing the raw sensor activity.


'''Q14. What is a smart threshold alert?'''
'''Q15. What is a smart threshold alert?'''


'''Ans:''' A smart threshold alert is generated when a sensor reading crosses a predefined threshold representing a meaningful condition.
'''Ans:''' A smart threshold alert is generated when sensor activity crosses a predefined threshold representing a meaningful condition.


'''Q15. What is the main principle demonstrated by this experiment?'''
'''Q16. What is the main principle demonstrated by this experiment?'''


'''Ans:''' The main principle is data minimization. Raw sensor information is processed locally and only the required alert is exposed.
'''Ans:''' The main principle is data minimization. Sensor activity is processed locally and only the required alert is exposed.

Revision as of 03:32, 8 October 2026

Experiment: Smart Threshold Alerts for Data Minimization using Privacy-by-Design

Aim

To design and implement a Privacy-by-Design IoT system using a vibration sensor and ESP32 that detects excessive vibration using a predefined threshold and generates an alert only when the threshold condition is reached, thereby minimizing unnecessary sensor data transmission.

Objectives

  1. To understand Privacy-by-Design in an IoT system.
  2. To understand the concept of data minimization.
  3. To interface a vibration sensor with ESP32.
  4. To detect vibration activity using the sensor.
  5. To define a threshold for excessive vibration.
  6. To generate an EXCESSIVE VIBRATION alert when the threshold is crossed.
  7. To process vibration data locally on the ESP32.
  8. To avoid continuously transmitting raw vibration readings.
  9. To expose only the required alert information.
  10. To demonstrate data minimization through a simple web-based monitoring system.

Components Required

Sr. No. Component Quantity Purpose
1 ESP32 Development Board 1 Reads the vibration sensor and hosts the web server
2 Vibration Sensor Module 1 Detects vibration activity
3 Breadboard 1 Circuit connections
4 Jumper Wires As required Electrical connections
5 Smartphone 1 Accesses the ESP32 web page
6 USB Cable 1 Programming and powering ESP32
7 Computer with Arduino IDE 1 Programming the ESP32

Theory

Internet of Things

The Internet of Things, or IoT, is a system in which physical devices use sensors and communication technologies to collect and exchange information.

In a conventional IoT system, sensor readings may be continuously transmitted even when the application does not require all of the readings.

For example, a vibration monitoring system may continuously generate sensor readings.

If the purpose of the application is only to detect excessive vibration, the application does not necessarily need every individual sensor reading.

The ESP32 can instead process the vibration activity locally and generate an alert only when the required condition occurs.

Privacy-by-Design

Privacy-by-Design means that privacy considerations are incorporated into the design of a system from the beginning.

One important approach related to Privacy-by-Design is data minimization.

Data minimization means collecting, processing, transmitting, and storing only the information that is necessary for the intended purpose.

In this experiment, the purpose is to detect excessive vibration.

Therefore, the system does not need to continuously expose every raw vibration reading.

The ESP32 processes the vibration activity locally and generates an alert only when the predefined threshold condition is reached.

Smart Threshold Alert

A threshold is a predefined value used to determine when a particular condition has occurred.

The ESP32 monitors the vibration sensor and keeps track of vibration activity.

When the number of detected vibration events reaches the selected threshold within the monitoring period, the ESP32 considers the vibration level excessive.

The operation is:

Vibration Sensor
       |
       v
     ESP32
       |
       v
Monitor vibration activity
       |
       v
Check threshold
       |
       +----------------------+
       |                      |
       v                      v
Normal vibration       Excessive vibration
       |                      |
       v                      v
   No alert          EXCESSIVE VIBRATION

The threshold can be adjusted according to the sensor and the required application.

Data Minimization

In a conventional system, raw vibration readings may be continuously sent to another device or server.

In the proposed system:

Vibration Sensor
       |
       v
Local processing on ESP32
       |
       v
Count vibration activity
       |
       v
Check threshold
       |
       +----------------------+
       |                      |
       v                      v
Below threshold         Threshold reached
       |                      |
       v                      v
   No alert          EXCESSIVE VIBRATION

The raw vibration activity is processed locally for decision making.

Unnecessary continuous sensor data is therefore not exposed outside the device.

Sensor Connection

The vibration sensor module normally provides VCC, GND, and a digital output pin.

Vibration Sensor Pin ESP32 Description
VCC 3.3V Sensor power supply
DO or OUT GPIO 27 Digital vibration signal
GND GND Common ground

Note: The exact pin names may vary between vibration sensor modules. Verify the labels on the actual sensor before making the connections.

Connection Diagram

             Vibration Sensor
             +-------------+
             |             |
     3.3V ---| VCC         |
             |             |
 GPIO 27 <---| DO / OUT    |
             |             |
     GND ----| GND         |
             +-------------+
                    |
                    |
                  ESP32
                    |
                    |
             Wi-Fi Access Point
                    |
                    |
             Smartphone Browser
                    |
                    |
              192.168.1.4

Working Principle

The ESP32 works as a Wi-Fi Access Point and hosts a simple web server.

The smartphone connects directly to the Wi-Fi network created by the ESP32.

The student then opens:

http://192.168.1.4

The ESP32 monitors the vibration sensor.

Each detected vibration event increases the vibration count during the monitoring period.

When the vibration count reaches the predefined threshold, the ESP32 generates an EXCESSIVE VIBRATION alert.

The web page displays the current status.

The web page automatically refreshes every 5 seconds so that the latest status can be observed.

The raw vibration activity is processed locally on the ESP32.

Program

#include <WiFi.h>
#include <WebServer.h>

const int VIBRATION_PIN = 27;

const char* ap_ssid = "ESP32-Vibration-Monitor";
const char* ap_password = "12345678";

WebServer server(80);

/*
   Number of vibration events required
   to generate an alert.
*/
const int VIBRATION_THRESHOLD = 5;

/*
   Monitoring period in milliseconds.
*/
const unsigned long MONITOR_PERIOD = 10000;

int vibrationCount = 0;
bool excessiveVibration = false;

unsigned long periodStart = 0;

int lastSensorState = LOW;

void updateVibration()
{
  int sensorState = digitalRead(VIBRATION_PIN);

  /*
     Count a vibration when the sensor
     changes from LOW to HIGH.
  */
  if (sensorState == HIGH && lastSensorState == LOW)
  {
    vibrationCount++;
  }

  lastSensorState = sensorState;

  /*
     Check whether the monitoring period
     has ended.
  */
  if (millis() - periodStart >= MONITOR_PERIOD)
  {
    if (vibrationCount >= VIBRATION_THRESHOLD)
    {
      excessiveVibration = true;
    }
    else
    {
      excessiveVibration = false;
    }

    /*
       Start a new monitoring period.
    */
    vibrationCount = 0;
    periodStart = millis();
  }
}

void handleRoot()
{
  updateVibration();

  String page = "";

  char lt = 60;
  char gt = 62;

  page += lt;
  page += "html";
  page += gt;

  page += lt;
  page += "head";
  page += gt;

  page += lt;
  page += "meta name='viewport' content='width=device-width, initial-scale=1'";
  page += gt;

  page += lt;
  page += "meta http-equiv='refresh' content='5'";
  page += gt;

  page += lt;
  page += "title";
  page += gt;
  page += "Vibration Monitor";
  page += lt;
  page += "/title";
  page += gt;

  page += lt;
  page += "/head";
  page += gt;

  page += lt;
  page += "body";
  page += gt;

  page += lt;
  page += "h1";
  page += gt;
  page += "Smart Vibration Monitor";
  page += lt;
  page += "/h1";
  page += gt;

  if (excessiveVibration)
  {
    page += lt;
    page += "h2";
    page += gt;
    page += "EXCESSIVE VIBRATION";
    page += lt;
    page += "/h2";
    page += gt;

    page += lt;
    page += "p";
    page += gt;
    page += "Threshold crossed. Alert generated.";
    page += lt;
    page += "/p";
    page += gt;
  }
  else
  {
    page += lt;
    page += "h2";
    page += gt;
    page += "NORMAL";
    page += lt;
    page += "/h2";
    page += gt;

    page += lt;
    page += "p";
    page += gt;
    page += "Vibration level is within the normal range.";
    page += lt;
    page += "/p";
    page += gt;
  }

  page += lt;
  page += "p";
  page += gt;
  page += "Page refreshes every 5 seconds.";
  page += lt;
  page += "/p";
  page += gt;

  page += lt;
  page += "/body";
  page += gt;

  page += lt;
  page += "/html";
  page += gt;

  server.send(200, "text/html", page);
}

void setup()
{
  Serial.begin(115200);

  pinMode(VIBRATION_PIN, INPUT);

  periodStart = millis();

  WiFi.softAPConfig(
    IPAddress(192,168,1,4),
    IPAddress(192,168,1,1),
    IPAddress(255,255,255,0)
  );

  WiFi.softAP(ap_ssid, ap_password);

  Serial.println("ESP32 Access Point started");
  Serial.print("IP Address: ");
  Serial.println(WiFi.softAPIP());

  server.on("/", handleRoot);

  server.begin();

  Serial.println("Web server started");
}

void loop()
{
  updateVibration();

  server.handleClient();
}

Code Explanation

Code or Function Explanation
WiFi.h Provides ESP32 Wi-Fi functionality.
WebServer.h Provides web server functionality.
VIBRATION_PIN Defines GPIO 27 as the vibration sensor input.
WiFi.softAP Creates a Wi-Fi Access Point using the ESP32.
WiFi.softAPConfig Sets the Access Point IP address to 192.168.1.4.
WebServer server(80) Creates an HTTP web server on port 80.
VIBRATION_THRESHOLD Defines the number of vibration events required to generate an alert.
MONITOR_PERIOD Defines the time interval over which vibration events are counted.
vibrationCount Stores the number of detected vibration events.
excessiveVibration Stores whether the excessive-vibration condition has been detected.
digitalRead Reads the digital output of the vibration sensor.
updateVibration Detects vibration events and checks the threshold.
handleRoot Generates the web page displayed on the smartphone.
server.send Sends the web page to the browser.
server.handleClient Processes browser requests.

Access Point

The ESP32 creates its own Wi-Fi network.

The network name is:

ESP32-Vibration-Monitor

The IP address is:

192.168.1.4

The smartphone can therefore access the web page using:

http://192.168.1.4

Vibration Detection

The ESP32 reads the digital output of the vibration sensor:

int sensorState = digitalRead(VIBRATION_PIN);

When a vibration event causes the sensor output to change from LOW to HIGH, the vibration count is increased.

if (sensorState == HIGH && lastSensorState == LOW)
{
  vibrationCount++;
}

This allows the ESP32 to count vibration events locally.

Threshold Detection

The program uses a vibration threshold:

const int VIBRATION_THRESHOLD = 5;

The monitoring period is:

const unsigned long MONITOR_PERIOD = 10000;

This means that the ESP32 counts vibration events during a 10 second period.

If the number of detected events is 5 or more, the system generates the excessive vibration alert.

The threshold can be changed depending on the sensor and demonstration requirements.

Calibration of Vibration Threshold

The threshold should be tested before performing the main experiment.

  1. Upload the program to the ESP32.
  2. Open the Arduino IDE Serial Monitor.
  3. Keep the vibration sensor stationary.
  4. Observe the system under normal conditions.
  5. Tap or shake the vibration sensor several times.
  6. Observe how the sensor responds.
  7. Select a suitable vibration threshold.
  8. Change the VIBRATION_THRESHOLD value if required.
  9. Upload the program again.
  10. Verify that normal vibration does not unnecessarily generate an alert.
  11. Verify that repeated vibration generates the alert.

For a simple classroom demonstration, the threshold can be kept low so that students can easily trigger the alert by tapping or shaking the sensor.

Procedure

  1. Connect the vibration sensor to the ESP32.
  2. Connect VCC to 3.3V.
  3. Connect GND to GND.
  4. Connect the digital output of the vibration sensor to GPIO 27.
  5. Connect the ESP32 to the computer.
  6. Open Arduino IDE.
  7. Select the appropriate ESP32 board.
  8. Select the appropriate COM port.
  9. Upload the program.
  10. Open the Serial Monitor.
  11. Verify that the ESP32 Access Point has started.
  12. Connect the smartphone to ESP32-Vibration-Monitor.
  13. Open the smartphone browser.
  14. Enter http://192.168.1.4.
  15. Observe the NORMAL status.
  16. Keep the vibration sensor stationary.
  17. Tap or shake the sensor repeatedly.
  18. Generate several vibration events within the monitoring period.
  19. Observe the EXCESSIVE VIBRATION alert.
  20. Wait for the next monitoring period and observe the status.
  21. Verify that the web page refreshes automatically every 5 seconds.
  22. Perform the data minimization demonstration.

Observations and Output

Normal Condition

When the vibration sensor is stationary or experiences only minor vibration:

Sensor Condition : Normal
System Status    : NORMAL
Alert            : None

The system does not generate an alert.

Excessive Vibration Condition

When repeated vibration events cross the predefined threshold:

Sensor Condition : Excessive vibration
System Status    : ALERT
Alert            : EXCESSIVE VIBRATION

The ESP32 generates the alert locally.

Smartphone Output

Normal condition:

SMART VIBRATION MONITOR

NORMAL

Vibration level is within
the normal range.

Page refreshes every 5 seconds.

Excessive vibration condition:

SMART VIBRATION MONITOR

EXCESSIVE VIBRATION

Threshold crossed.
Alert generated.

Page refreshes every 5 seconds.

Demonstration of Data Minimization

The main purpose of this experiment is to demonstrate that unnecessary raw sensor information does not need to be continuously transmitted.

Conventional System

In a conventional IoT system, every sensor event or sensor reading could be transmitted to a server.

For example:

Vibration event detected
Vibration event detected
Vibration event detected
Vibration event detected
Vibration event detected

The server would receive a continuous stream of sensor information.

Privacy-by-Design System

In the proposed system, the ESP32 processes the vibration activity locally.

The ESP32 counts the vibration events and compares the count with the threshold.

The process is:

Vibration activity
       |
       v
Local processing
       |
       v
Count events
       |
       v
Check threshold
       |
       +---------------------+
       |                     |
       v                     v
Below threshold        Threshold reached
       |                     |
       v                     v
   No alert          EXCESSIVE VIBRATION

The raw vibration activity is not required outside the ESP32 for the basic application.

Only the required alert needs to be exposed.

Data Inspection Demonstration

The data inspection demonstration is used to compare the amount of information exposed by two system designs.

The demonstration is educational and is intended to show the effect of data minimization.

Conventional Design

A conventional system may continuously expose individual vibration events:

Vibration event
Vibration event
Vibration event
Vibration event
Vibration event

An observer can therefore obtain detailed information about the vibration activity.

Privacy-by-Design Design

The Privacy-by-Design system processes the vibration activity locally.

When the vibration count is below the threshold:

No alert

When the threshold is reached:

EXCESSIVE VIBRATION

The application therefore exposes only the information required for the intended purpose.

Demonstration Steps

  1. Connect the smartphone to the ESP32 Access Point.
  2. Open the ESP32 web page.
  3. Observe the NORMAL condition.
  4. Tap or shake the vibration sensor repeatedly.
  5. Generate enough vibration events to cross the threshold.
  6. Observe the EXCESSIVE VIBRATION alert.
  7. Inspect the application data using an appropriate network inspection or server logging method.
  8. Observe that the application does not need to continuously expose every vibration event.
  9. Explain that the ESP32 processes the vibration activity locally before generating the alert.

Note: This demonstration is about data minimization. It does not claim that HTTP communication is encrypted or completely secure.

Conventional System vs Privacy-by-Design System

Feature Conventional System Privacy-by-Design System
Sensor processing May be performed at server Performed locally on ESP32
Vibration events May be continuously transmitted Processed locally
Normal activity May be transmitted No unnecessary transmission
Threshold detection May be performed at server Performed on ESP32
Alert May contain detailed sensor information Only required alert is exposed
Data volume Higher Lower
Data exposure Higher Minimized

Why This is Privacy-by-Design

The experiment demonstrates Privacy-by-Design through the following design decisions:

  1. Local Processing: Vibration activity is processed on the ESP32.
  2. Data Minimization: Individual vibration events do not need to be continuously transmitted.
  3. Purpose Limitation: The system only needs to detect excessive vibration.
  4. Smart Thresholding: An alert is generated only when the vibration threshold is crossed.
  5. Reduced Data Exposure: Unnecessary sensor information is not exposed.
  6. Privacy by Default: The system is designed to minimize data exposure from the beginning.

The main principle demonstrated is:

Do not transmit unnecessary information
when the application does not require it.

Automatic Page Refresh

The web page automatically refreshes every 5 seconds.

This is implemented using the page refresh setting in the generated web page.

The refresh interval allows the student to observe the latest vibration status without manually refreshing the browser.

The refresh interval is:

5 seconds

Therefore, after generating vibration activity, the student can wait for the next page refresh to observe the updated alert status.

Advantages

  1. Reduces unnecessary sensor data transmission.
  2. Processes vibration information locally.
  3. Reduces the amount of sensor information exposed outside the device.
  4. Allows fast local decision making.
  5. Demonstrates data minimization clearly.
  6. Does not require an external cloud server.
  7. Can be demonstrated easily using a smartphone.
  8. Vibration can be generated manually by tapping or shaking the sensor.
  9. The web page automatically refreshes every 5 seconds.
  10. Can be extended to industrial machine monitoring applications.

Limitations

  1. The vibration sensor module provides a simple indication of vibration and may not provide precise vibration measurements.
  2. The sensor may respond differently depending on the strength and duration of vibration.
  3. The threshold must be calibrated for the actual sensor and application.
  4. Environmental vibration may cause unwanted detections.
  5. The HTTP communication used in this experiment is not encrypted.
  6. This experiment demonstrates data minimization and not complete IoT security.
  7. A real industrial vibration monitoring system would normally use a more precise vibration sensor and appropriate signal processing.

Result

The smart threshold alert system was successfully implemented using a vibration sensor and ESP32.

The ESP32 locally monitored vibration activity and counted vibration events during a predefined monitoring period.

When the number of vibration events reached the selected threshold, the system generated an EXCESSIVE VIBRATION alert.

The alert was displayed on a smartphone through the ESP32 web server using:

http://192.168.1.4

The web page automatically refreshed every 5 seconds.

The experiment demonstrated that raw vibration activity does not need to be continuously exposed when the application only requires an excessive-vibration alert.

Thus, the experiment demonstrated data minimization through local processing and smart threshold alerts as a practical Privacy-by-Design approach.

Viva Questions

Q1. What is Privacy-by-Design?

Ans: Privacy-by-Design means incorporating privacy considerations into the design of a system from the beginning.

Q2. What is data minimization?

Ans: Data minimization means collecting, processing, transmitting, and storing only the data required for the intended purpose.

Q3. Why is a vibration sensor used in this experiment?

Ans: A vibration sensor is used because vibration can be generated manually by tapping or shaking the sensor, making the alert easy to demonstrate.

Q4. What does excessive vibration represent in this experiment?

Ans: Excessive vibration represents a condition in which the number of vibration events has crossed the predefined threshold.

Q5. Why is the raw vibration activity not continuously transmitted?

Ans: The application only needs to know whether excessive vibration has occurred. Therefore, continuously transmitting every vibration event is unnecessary.

Q6. Where is the vibration threshold checked?

Ans: The threshold is checked locally on the ESP32.

Q7. What happens when the threshold is not crossed?

Ans: No excessive-vibration alert is generated.

Q8. What happens when the threshold is crossed?

Ans: The ESP32 detects excessive vibration and generates the EXCESSIVE VIBRATION alert.

Q9. What is the purpose of the data inspection demonstration?

Ans: It demonstrates how data minimization reduces the amount of unnecessary sensor information exposed outside the device.

Q10. What information is required when the threshold is crossed?

Ans: The required information is the EXCESSIVE VIBRATION alert.

Q11. Why does the web page refresh every 5 seconds?

Ans: The page refreshes every 5 seconds so that the smartphone can display the latest system status automatically.

Q12. Is the system completely secure?

Ans: No. The main purpose is to demonstrate data minimization and Privacy-by-Design. The HTTP communication used here is not encrypted.

Q13. Does data minimization mean that no data is transmitted?

Ans: No. It means that only the data necessary for the intended purpose should be transmitted or exposed.

Q14. Why is local processing useful?

Ans: Local processing allows the ESP32 to make decisions using sensor data without unnecessarily exposing the raw sensor activity.

Q15. What is a smart threshold alert?

Ans: A smart threshold alert is generated when sensor activity crosses a predefined threshold representing a meaningful condition.

Q16. What is the main principle demonstrated by this experiment?

Ans: The main principle is data minimization. Sensor activity is processed locally and only the required alert is exposed.