Documentation Goup6
Documentation Goup6
Bachelor’s Assignment
Degree Programme in Electrical and Automation Engineering
Spring 2025
Pavithra Ekanayake
Van Quyen
Tuan Vo
Table of Contents
1 Theory............................................................................................................................................. 1
1.1 What IIOT means? ................................................................................................................. 1
1.2 Description of used devices and services............................................................................... 1
1.2.1Laser Distance Sensor (CJMCU530) ............................................................................. 1
1.2.2The Arduino Uno ............................................................................................................ 2
1.2.3LoRaWAN (Long Range Wide Area Network) ................................................................ 2
1.2.4ThingSpeak .................................................................................................................... 3
2 An explanation of the use case ....................................................................................................... 3
3 Local system implementation description ........................................................................................ 4
3.1 Connections between different sensors and boards ............................................................... 4
3.1.1Laser Distance Sensor (CJMCU530) ............................................................................. 4
3.1.2Arduino UNO .................................................................................................................. 4
3.1.3LoRaWAN ...................................................................................................................... 4
3.2 System planning, used functions ............................................................................................ 5
3.2.1Planning ......................................................................................................................... 5
3.2.2Functions ....................................................................................................................... 6
3.3 Testing ................................................................................................................................... 6
4 Cloud service description ................................................................................................................ 7
4.1 Sent and collected data.......................................................................................................... 7
4.1.1Sent Data ....................................................................................................................... 7
4.1.2Collected Data................................................................................................................ 7
4.2 The visualization for the use case and why elements were selected ...................................... 7
4.2.1Height of Vehicle ............................................................................................................ 7
4.2.2Number of Safe Vehicles................................................................................................ 9
4.2.3Number of Warning Vehicles .......................................................................................... 9
4.2.4Number of Over height Vehicles ................................................................................... 10
4.2.5Warning Status............................................................................................................. 11
4.2.6Text Warning ................................................................................................................ 11
4.2.7Channel location .......................................................................................................... 12
5 A list of participants and contribution description ........................................................................... 13
6 What learned during the implementation ....................................................................................... 13
7 Expected improvements for the solution: ....................................................................................... 14
References .......................................................................................................................................... 15
Figures
Tables
Appendices
1 Theory
The Industrial Internet of Things (IIoT) refers to the integration of industrial equipment with
internet-connected sensors, devices, and advanced analytics platforms. It is a part of the
larger Internet of Things (IoT) that is specially used in industries like factories, transport,
energy, and construction.
In an IIoT system, devices collect and transmit data to a centralized platform (often cloud-
based), where the data is monitored, analysed, and used to drive automated decisions,
increase efficiency, ensure safety, and reduce operational costs.
The CJMCU-530 is a compact laser distance sensor module based on the VL53L0X time-
of-flight (ToF) sensor developed by STMicroelectronics. It is commonly used for precise
distance measurement applications and is often integrated into Arduino and other
microcontroller projects (STMicroelectronics, n.d.).
• Accuracy: High precision within short distances (better than ultrasonic sensors for
close-range).
• Interface: I2C (used for communication with microcontrollers like Arduino,
Raspberry Pi).
• Resolution: ~1 mm.
• Operating Voltage: 2.6V to 3.5V (CJMCU board often includes onboard regulator
allowing 3.3V or 5V use).
• Laser Class: Class 1 (eye-safe).
The Arduino Uno Wifi Rev2 is one of the most popular and beginner-friendly microcontroller
boards in the Arduino family. It is widely used for learning electronics, prototyping, and
building embedded systems (Docs.Arduino, n.d.).
Key Points:
1.2.4 ThingSpeak
ThingSpeak is an open-source Internet of Things (IoT) platform that allows you to collect,
store, analyse, and visualize sensor data from devices like Arduino and Raspberry Pi over
the internet (IPCB, n.d.).
Key Features:
The purpose of this system is to monitor and measure the height of vehicles before
entering tunnels or underpasses, such as bridges, to ensure safety.
Vehicles with excessive height could pose a risk by damaging these structures, potentially
causing traffic accidents or infrastructure damage. The system uses a laser distance
sensor integrated with an Arduino UNO microcontroller and LoRaWAN communication to
perform real-time monitoring.
By measuring the height at three different stages (safe height, warning height, and over
height), the system can compare the measured height against a predefined clearance
height. If the vehicle exceeds safe height, the system triggers appropriate warning
indicators (e.g., lights), giving drivers a chance to stop or take alternate routes, thereby
preventing accidents or damage to the infrastructure.
4 (15)
GND GND
The laser distance sensor is used to measure the vehicle height as it approaches the entry
point of the tunnel or structure. This sensor is typically connected to the Arduino UNO via
its digital output pins.
The Arduino acts as the central processing unit that receives data from the laser sensor
and processes them. It compares the measured vehicle height against predefined
thresholds: safe height, warning height, and over height. Based on this comparison, it
triggers outputs such as warning indicator lights (Red, Blue and Green).
3.1.3 LoRaWAN
LoRaWAN is used to transmit the data to a remote cloud server for logging, analysis, and
further action. This module connected to the Arduino UNO to enable wireless
5 (15)
communication. It allows data (height measurements, warning status and vehicle count) to
be transmitted over long distances, ideal for remote monitoring.
3.2.1 Planning
• Arduino reads the height data from the laser sensor using digital input.
• A comparison function checks if the height is below the safe threshold, within the
warning threshold, or over the clearance.
• Based on the comparison results, the system triggers a corresponding action, such
as illuminating different warning lights for each stage.
• The Arduino continuously loops through detection logic. When a vehicle enters the
sensor range:
1. The height is measured.
2. Height is compared to thresholds.
3. Appropriate counter (safe/warning/over height) is incremented.
4. The total vehicle count is updated.
5. All values are sent to the cloud.
3.2.2 Functions
• If the vehicle height is under the safe height, a green light is triggered.
• If the vehicle is in the warning height stage, a yellow light is triggered.
• If the vehicle exceeds the clearance height (over height), a red light is activated.
3.3 Testing
• Sensor Calibration: Ensuring that the laser distance sensor provides accurate
readings and calibration against known heights.
• Threshold Adjustment: Verifying that the system correctly triggers warnings at the
appropriate height thresholds (safe, warning, and over height).
• Counter Verification: Testing simulated vehicles to ensure accurate counting and
classification.
• Wireless Communication: Ensuring reliable data transmission via LoRaWAN,
checking for signal integrity and potential interference in the system.
• Real-World Scenarios: Testing with vehicles of varying heights to simulate real-
world conditions, ensuring the system’s robustness and accuracy in live conditions.
• System Response: Monitoring the response time of the system and ensuring that
indicator lights are triggered promptly based on vehicle height.
7 (15)
The data is sent through the LoRaWAN network to the cloud for centralized monitoring.
The system sends key data, including:
The cloud service collects and stores data over time, such as the number of vehicles
detected, the frequency of over height occurrences, and the overall system performance.
These data can be visualized and analysed for trends, such as times when over height
vehicles are more common or patterns related to tunnels/structures.
4.2 The visualization for the use case and why elements were selected
This visualization element displays the real-time height measurements of the over height
vehicles compared to the tunnel clearance. It helps operators immediately see how much
clearance is available and whether the vehicle's height is within acceptable limits.
This visualization allows operators to monitor the exact heights of entering vehicles. If the
measurement is above the threshold for "safe" height, immediate corrective actions can be
taken, such as turning on RED light indicator and showing warning text ‘Do not enter!’.
It is particularly useful in showing how close the vehicle is to the clearance level.
8 (15)
We also tried to create a chart with the same content using MATLAB code. This chart is
customized, but still low in display. So, we had to refresh the ThingSpeak page once to see
any updates
9 (15)
This element shows the total count of vehicles that have passed through the monitoring
point and have a height within the "safe" range, meaning their height is below the clearance
limit.
This allows operators to keep track of the number of vehicles that are safely entering the
tunnel or under the overhead structure without risk of damage. It can also provide an
indication of the normal flow of traffic.
This element tracks the total number of vehicles that have heights within the warning
range, indicating they are approaching or slightly exceeding the safe clearance height.
This serves as an early warning for potential issues. If a significant number of warning
vehicles are detected, it may indicate a recurring problem or a need for further inspection of
the tunnel clearance.
10 (15)
This element displays the total number of vehicles that exceed the clearance height limit
and fall into the "over height" category, posing a risk to the tunnel or overhead structure.
Tracking over height vehicles is critical for safety and helps operators determine when
immediate action is required. If over height vehicles are detected, the system can trigger
alarms or stop vehicles from entering the restricted area. This also helps identify patterns,
such as specific times or conditions when over height vehicles are more likely to occur.
It shows a color-coded (green/red) indicator showing the current state of the system in real
time. It enables quick visual recognition of whether the current vehicle or situation is safe or
dangerous.
A real-time text message (e.g., “Welcome vehicle height = 13m”, “Warning – Do not enter
vehicle too high”) based on the vehicle's classification. This text provides clear, readable
feedback to operators or drivers. It is Ideal for display boards, alerts, or automated signage.
12 (15)
The physical location where the detection occurred. This display is useful for systems with
multiple monitoring points, which helps identify where specific events (especially over
height detections) took place.
13 (15)
Figure 11. Providing the sensor's location where all measurements conducted
Pavithra Ekanayake:
Tuan Vo:
We want to add the function of measuring the velocity of objects (vehicles). However, it
seems impossible because of the change in length of the objects. To solve this problem,
we need at least two laser sensors to measure the time interval between 2 object
detections of 2 sensors and from there we can calculate the velocity of the object.
The second expectation is to measure the height data of vehicles having multiple heights to
identify the highest one. We had an idea to store all measured readings into an array and
make the comparison between them.
The third point is that we want to transmit the locations of all sensors using add-on sensor
boards that can send real-time longitude and altitude data to ThingSpeak. Currently, we
have only entered fixed sample values for altitude and longitude in the channel settings on
the ThingSpeak website.
15 (15)
References
IPCB. (n.d.). Retrieved from Pull Data From ThingSpeak And Custom Dashboard Look Better:
https://epcb.vn/blogs/news-1/esp8266-http-client-pull-data-from-thingspeak-and-custom-
dashboard-look-better?view=en
void setup() {
Wire.begin(); // Start I2C communication
sensor.init(); // Initialize the VL53L0X sensor
sensor.setTimeout(100); // Set timeout for reading
sensor.setMeasurementTimingBudget(20000); // Sensor timing budget
void loop() {
currentMillis = millis(); //get the current time
d = sensor.readRangeSingleMillimeters(); // Measure distance
// Upadated to counter with delay to avoid misleading reading
if (currentMillis-startSensorMillis >= MeasureInterval){
if (d < Min_Distance) {
setColor(255, 0, 0); // Turn on Red light
if (!bRed)// to Ensure the message is sent only one time and the counter in-
crease one unit once if the object does not move away of sensor {
Serial.print("Don't enter - Height (mm): "); Serial.println(Tunnel-
Height-d);
OH++; // Counter variable increase only 1 unit
// Form and send a message
String message = "api_key:IY2PCVASDDXNEJJ6,channel_id:2901925";
String field1 = ",H:"+ String(TunnelHeight-d);
message.concat(field1);
String field2 = ",OH:"+ String(OH);
message.concat( field2);
String field3 = ",WH:"+ String(WH);
message.concat(field3);
String field4 = ",SH:"+ String(SH);
message.concat(field4);
LoRaWAN.sendMsg(message);
Serial.println(message);
// Reset status of 'flag' variables
bRed = true;
bBlue = false;
bGreen = false;
}
} else if (d >= Min_Distance && d < Max_Distance) {
setColor(0, 0, 255); // Turn on Blue Light
if (!bBlue) {
Serial.print("Be careful - Height (mm): "); Serial.println(TunnelHeight-
d);
WH++;
bBlue = true;
bRed = false;
bGreen = false;
}
} else if (d >= Max_Distance && d < TunnelHeight) {
setColor(0, 255, 0); // Turn on Green Light
if (!bGreen) {
Serial.print("Safety to enter - Height (mm): "); Serial.println(Tunnel-
Height-d);
SH++;
bGreen = true;
bRed = false;
bBlue = false;
}
} else {
setColor(0, 0, 0); // No light is turned
//Serial.println("No car detected! ");// No car enters
bRed = false;
bBlue = false;
bGreen = false;
}
startSensorMillis = currentMillis;}
Appendix 3
}
Appendix 4
}
Appendix 5