0% found this document useful (0 votes)
12 views

Projectsynopsis

Uploaded by

error 504
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Projectsynopsis

Uploaded by

error 504
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

Project Synopsis

on
IoT BASED Smart Vehicle Operation Monitoring
and Toll Tax Collection System
Submitted in partial fulfillment of the requirements for the degree of B.Tech. in
Electronics and Communication Engineering
by:

Harsh Patel (2000270310071)


Harshit Tripathi (2000270310074)
Jahnavi Tiwari (2000270310079)
Priya Kumari Srivastava (2000270310119)

Under the supervision of

Mr. Naresh Kumar


Assistant Prof., ECE Department, AKGEC

Ajay Kumar Garg Engineering College, Ghaziabad


th
27 Km Stone, Delhi - Hapur Bypass Road, Adhyatmik Nagar, Ghaziabad-201009
Dr. A.P.J. Abdul Kalam Technical University, Lucknow
November, 2023
DECLARATION

We hereby declare that this submission is our own work and that, to the best of our
knowledge and belief, it contains no material previously published or written by another
person, nor material which to a substantial extent has been accepted for the award of
any other degree or diploma by the university or other institute of higher learning,
except where due acknowledgment has been made in the text.

Signature: Signature:
Student Name - Harsh Patel Student Name - Harshit Tripathi
Roll No: 2000270310071 Roll No: 2000270310074

Signature: Signature:
Student Name - Jahnavi Tiwari Student Name - Priya Kumari Srivastava
Roll No: 2000270310079 Roll No: 2000270310119

[2]
CERTIFICATE

This is to certify that the Project report entitled “IOT-based smart Vehicle Operation
Monitoring and Toll Tax Collection System ” which is submitted by Jahnavi Tiwari, Harsh
Patel, Harshit Tripathi and Priya Kumari Srivastava in the partial fulfillment of requirement for
the award of degree of Bachelor of Technology (Electronics and Communication Engineering)
submitted to Dr. A.P.J. Abdul Kalam Technical University, Lucknow is a record of students’
own work carriedout under my supervision. The matter in this report has not been submitted to
any University or Institution for award of any degree.

Supervisor:

Mr. Naresh Kumar


Assistant Professor
ECE Department
Ajay Kumar Garg Engineering College, Ghaziabad

HOD ECE

Dr. Neelesh Kumar Gupta


Professor
ECE Department
Ajay Kumar Garg Engineering College, Ghaziabad

[3]
ACKNOWLEDGEMENT

We take this opportunity to express our deep sense of gratitude and regard to Mr. Naresh
Kumar Asst. Prof. (ECE Dept.), Ajay Kumar Garg Engineering College, Ghaziabad for
her continuous encouragement and guidance, we needed to complete this project.

We would pay our sincere gratitude to Prof. & Dr. Neelesh Kumar Gupta for his precious
and enlightening words of wisdom which motivated us throughout our project work.

[4]
ABSTRACT

Transportation has become an indispensable part of our lives. Toll plazas play a crucial role
in maintaining road transportation. With a significant number of vehicles at the toll plazas,
it becomes necessary that services are offered with ease. Also, it is judicious that one pays
toll tax according to the distance traveled on the road. To do so, we propose an ‘IoT-based
smart vehicle operation monitoring and toll tax payment system’ through our project. In this
project, we plan to incorporate several modules to facilitate vehicle operation monitoring
and toll tax collection. Modules include vehicle operation monitoring, drink and drive
detection, and GPS technology-based toll tax collection. This project has been designed for
automation in toll tax collection systems using GPS technology. Toll tax will be calculated
based on the distance on the road. For the drink and drive module, we plan to use an alcohol
sensor, we are incorporating GPS for distance estimation and vehicle monitoring, LiFi
technology-based data transmission and Bolt IoT cloud to incorporate all modules together
and display user’s information.

[5]
TABLE OF CONTENTS Page
No.
Declaration ii
Certificate iii
Acknowledgment iv
Abstract v
Chapter 1. Introduction
1.2
1.1 Introduction
Chapter 2. Literature Survey
2.5
Chapter 3. Problem Statement
2
3.1 Electronic payment issue
3
3.2 Privacy Concerns 4
3.3 Environment
5.12
Chapter 4. Proposed Methodology
4.1 Requirement analysis 5
4.2 Hardware implementation 6
4.3 Software Development
8
4.4 Data integration
4.5 Data processing and calculation 9
4.6 Testing Training and Development
11
4.7 User Training and Development
12.15
Chapter 5. Hardware and Software Required
5.1 Hardware required 12
5.1.1 Arduino UNO
5.1.2 Photodiode
13
5.1.3 LED
5.1.4 GPS neo 6m
14
5.2 Software required
5.2.1 Arduino IDE
5.2.2 Bolt cloud
Chapter 6. Work Done 15.16
15
6.1 Hardware implemented
6.2 Software implemented
Chapter 7. Conclusion 16
References 17
18
Appendix

[6]
CHAPTER 1

INTRODUCTION

The project, " IOT-based smart Vehicle Operation Monitoring and Toll Tax Collection
System ", endeavors to revolutionize toll tax collection and enhance road safety through
the synergistic integration of LiFi technology, GPS tracking, and alcohol detection
sensors.

Traditional toll tax collection systems have long relied on manual processes or RFID-
based solutions, often leading to congestion and delays. In contrast, our project leverages
LiFi technology, a wireless communication system that uses light to transmit data. This
technology not only eliminates the need for physical toll booths but also enhances the
efficiency of tax collection by accurately calculating tolls based on the distance traveled
by vehicles. LiFi's high-speed data transmission capability ensures real-time
communication between vehicles and toll collection centers, minimizing delays and
improving the overall experience for road users.

Furthermore, GPS technology is integrated into the system to provide comprehensive


vehicle monitoring. This ensures that authorities can track the location and speed of
vehicles in real-time, enhancing traffic management and security. Additionally, our
system incorporates alcohol detection sensors, promoting road safety by monitoring the
sobriety of drivers. In cases where alcohol levels exceed the legal limit, the system can
trigger alerts, helping prevent accidents and ensuring the safety of all road users.

This project represents a leap forward in the realm of toll tax collection, vehicle
monitoring, and road safety. By harnessing the power of LiFi technology and GPS
tracking, we aim to create a more efficient, secure, and intelligent transportation system
that benefits both authorities and commuters. With this innovative system, we are poised
to address the evolving needs of our modern world, offering a safer, more efficient, and
technologically advanced solution to the challenges of toll tax collection and road safety.
The "IoT-based Smart Vehicle Operation Monitoring and Toll Tax Collection System"
is a cutting-edge solution that leverages Internet of Things (IoT) technologies to
revolutionize the monitoring and toll tax collection processes for vehicles. This
[7]
innovative system integrates hardware devices, communication modules, and
sophisticated software applications to create a seamless and efficient framework for
managing vehicular operations on roadways.
In the contemporary landscape of transportation, the need for intelligent and automated
systems has become increasingly evident. The traditional methods of toll tax collection
and vehicle monitoring are often plagued by inefficiencies, manual errors, and delays.
The IoT-based Smart Vehicle Operation Monitoring and Toll Tax Collection System
addresses these challenges by harnessing the power of IoT, real-time data analytics, and
secure communication protocols.
The IoT-based Smart Vehicle Operation Monitoring and Toll Tax Collection System
represents a paradigm shift in the way vehicular operations are managed and toll taxes
are collected. By harnessing the capabilities of IoT, this system promises increased
efficiency, accuracy, and convenience, contributing to the evolution of intelligent
transportation systems.

[8]
CHAPTER 2

LITERATURE REVIEW

In the landscape of modern transportation systems, toll tax collection, vehicle monitoring,
and road safety have emerged as critical areas for improvement. Traditional toll collection
systems, often hampered by congestion and inefficiency, have spurred research efforts [1]
to seek modernization. The integration of advanced LiFi technology, utilizing visible light
or infrared signals for high-speed data transmission [2], promises to revolutionize toll
collection by eliminating physical booths, enabling accurate toll calculation based on
distance traveled, and facilitating real-time vehicle-to-center communication, thereby
minimizing delays. Simultaneously, GPS-based vehicle monitoring [3] has enhanced
traffic management and security, while alcohol detection systems [4] are addressing the
pressing issue of alcohol-impaired driving. This literature review underscores the potential
of integrated solutions [5] and highlights the necessity of addressing challenges related to
system reliability, security, scalability, and privacy as future research directions. The
proposed project's integration of LiFi and GPS technologies for toll tax collection, vehicle
monitoring, and alcohol detection aligns with this literature, offering a comprehensive
approach to address the demands of modern road management, thus contributing to safer
and more efficient transportation system

[9]
CHAPTER 3

PROBLEM STATEMENT

Toll tax collection in India has evolved over the years, but there are still several issues and
challenges associated with the current technologies used for toll tax collection. Some of the
prominent issues include:

1. Electronic Payment Issues:

While electronic toll collection (ETC) systems like RFID offer convenience, they can
also face technical glitches, such as incorrect toll charges, non-functioning transponders, and
difficulties with account management.

2. Privacy Concerns:

Electronic toll collection systems require the collection of personal data and vehicle information.
This raises privacy concerns, especially if this data is not handled securely.

3. Environmental Impact:

Idling vehicles at toll booths can contribute to air pollution and greenhouse gas emissions. This is
not only harmful to the environment but also to the health of people in the vicinity.

4. Traffic Congestion:

Toll plazas often lead to traffic congestion, especially during peak hours. This can result in long
queues and delays for commuters, leading to fuel wastage and increased travel time.

5. Lack of Interoperability:

There are often multiple toll operators on a single highway, each with its own toll collection
system. Lack of interoperability between these systems can result in confusion and inefficiencyfor
users.
6. Inefficient Toll Collection:
Traditional toll collection methods are predominantly manual, leading to delays, long queues
[10
]
at toll booths, and increased wait times for commuters. This inefficiency not only impacts the
overall user experience but also hinders the smooth flow of traffic.

7. Lack of Real-Time Monitoring:

The absence of real-time monitoring and tracking mechanisms for vehicles on roadways limits
the ability to promptly respond to incidents, optimize traffic flow, and provide accurate
information to commuters.

8. Regulatory Compliance Challenges:

Adherence to evolving regulations and standards in the transportation sector poses a challenge for existing
toll collection systems. Ensuring compliance with legal requirements is crucial for the system's integrity and
legality.

[11
]
CHAPTER 4

METHODOLOGY

Certainly, here's a proposed methodology for your project, based on the previous inputs:
Methodology for LiFi and GPS-Based Toll Tax Collection System with Vehicle Monitoring and
Alcohol Detection

Requirements Analysis:
Define the specific requirements for the project, including hardware and software components, data
collection, processing, and user interface features.
Identify the performance metrics for accurate toll tax calculation, real-time GPS tracking, and alcohol
detection thresholds.

Hardware Implementation:
Install GPS modules and alcohol detection sensors in the user's vehicles.
Develop and integrate a dedicated server within each vehicle to collect and process data from GPS and
alcohol modules.
Ensure secure data transmission from the vehicle's server to the central server using IoT technology.

Software Development:
Develop a user application for seamless user interaction, enabling users to access toll information,
monitor their vehicle's status, and receive real-time alcohol detection alerts.
Build a backend system using the Bolt IoT platform to receive and process data from LiFi, GPS, and
alcohol detection systems.
Implement data visualization and representation features for users.

Data Integration:
Establish data pipelines to combine information from GPS, LiFi, and alcohol detection modules.
Ensure data consistency, accuracy, and real-time transmission to the central server.

Data Processing and Calculation:


Develop algorithms for toll tax calculation based on distance traveled and other relevant factors.

[12]
Implement real-time analysis of alcohol detection data to trigger alerts when necessary.

Testing and Validation:


Conduct extensive testing of the hardware and software components to validate their functionality and
performance.
Simulate various scenarios to assess the system's effectiveness in toll tax collection, vehicle monitoring,
and alcohol detection.

User Training and Deployment:


Prepare user manuals and conduct training sessions for users to ensure they can effectively use the
application and understand the system's features.
Deploy the system in a controlled environment, such as a pilot project, to evaluate its performance in a
real-world setting.

Literature Review:
Review existing literature to understand the state-of-the-art technologies, protocols, and methodologies
related to IoT-based transportation systems, toll collection, and real-time monitoring. Incorporate insights
from relevant research to inform the design and implementation.

Development of IoT Devices:


Develop or procure the necessary IoT devices to be installed in vehicles. This involves programming
microcontrollers or single-board computers, integrating sensors, and ensuring compatibility with the
chosen communication protocols.

Integration of Communication Modules:


Integrate communication modules in vehicles to enable seamless communication with the centralized
server. Implement secure wireless communication protocols to transmit real-time data and ensure data
integrity.

Toll Tax Calculation Algorithm:


Develop an algorithm for toll tax calculation based on predetermined criteria such as distance traveled,

[13]
vehicle type, and applicable toll rates. Ensure accuracy and efficiency in toll tax calculations.

Security Implementation:
Implement robust security measures, including encryption of data during transmission, secure
authentication mechanisms, and access controls. Address privacy concerns and ensure compliance with
relevant data protection regulations.

Maintenance and Updates:


Establish a maintenance plan for ongoing system support and updates. Regularly monitor system
performance, address user feedback, and implement software updates to enhance features or address
security concerns.

Compliance and Documentation:


Ensure that the system complies with relevant regulations and standards in the transportation sector.
Document the system architecture, configurations, and user manuals for future reference and audits.

[14]
CHAPTER 5

Hardware Required

In the user's vehicle, we will install a GPS module to accurately track the vehicle's position, speed, and
route. Additionally, an alcohol detection module will be integrated to monitor the sobriety of the
driver, enhancing road safety. These modules will communicate with a centralized server within the
vehicle, which will process and transmit the data.

Fig 5.1 Arduino Uno


Arduino Uno:

The Arduino Uno is a popular microcontroller board that's commonly used for various DIY electronics
projects.

Fig 5.2 Photodiode


Photodiode:

A photodiode is a semiconductor device that converts light into an electrical current. It is a type of
photodetector and is commonly used in various applications, such as light sensing, light measurement,
and optical communication systems.

Fig 5.3 LED

LED:

A Light-Emitting Diode (LED) is a semiconductor device that emits light when an electric current
[15]
passes through it. LEDs are a type of diode, which means they allow current to flow in only one
direction.

Fig 5.4 Bolt Module

Bolt Module

Bolt is a company that specializes in IoT (Internet of Things) solutions and provides hardware and
software tools to enable the development of IoT projects.

Software Required

To receive and process the data from the user's vehicle, we will establish an Internet of Things (IoT)
module and a centralized control system.

Arduino IDE: The Arduino Integrated Development Environment (IDE) is a software application
used for writing, compiling, and uploading code to Arduino microcontroller boards.
The Arduino IDE is a software application that provides a platform for writing, compiling, and
uploading code to Arduino microcontroller boards. It's a user-friendly environment designed for
beginners and experienced developers alike, making it easy to create projects with Arduino boards.

Bolt Cloud: The Bolt Cloud is a cloud-based platform provided by Bolt IoT. It allows you to connect
and manage your IoT devices over the internet. You can control and monitor your devices remotely
using the Bolt Cloud.

Bolt Cloud is a versatile cloud-based platform offered by Bolt IoT, empowering developers and
businesses to create Internet of Things (IoT) applications seamlessly. It provides a comprehensive
ecosystem for connecting and managing IoT devices, facilitating real-time data monitoring and control.
Bolt Cloud supports a range of features, including secure device communication, user-friendly
dashboards, mobile app integration, and compatibility with popular IoT protocols. With Bolt Cloud, users
can efficiently develop, deploy, and monitor IoT solutions, making it a valuable resource for those
seeking to harness the power of connected devices and data in their projects and applications.

[16]
CHAPTER 6
WORK CARRIED OUT
This project has been designed for automation in toll tax collection systems using GPS technology. For
the drink and drive module, we plan to use an alcohol sensor and for the pollution check module, we
plan to use gas sensors, an Arduino integrated development kit.

Fig 6.1 Software implementation of LiFi and Alcohol Sensor module

HARDWARE IMPLEMENTATION

For the hardware implementation of our project, we propose a multifaceted approach that involves
integrating various components into the user's vehicle and creating a corresponding infrastructure for
data reception and processing. In the user's vehicle, we will install a GPS module to accurately track the
vehicle's position, speed, and route. Additionally, an alcohol detection module will be integrated to
monitor the sobriety of the driver, enhancing road safety. These modules will communicate with a
centralized server within the vehicle, which will process and transmit the data.

[17]
To receive and process the data from the user's vehicle, we will establish an Internet of Things (IoT)
module and a centralized control system. The IoT module will act as a bridge between the vehicle and
the central server, securely transmitting the GPS and alcohol detection data in real-time. The central
server will be responsible for collecting, analyzing, and storing this data, allowing authorities to access
it for toll tax calculations and vehicle monitoring.

By implementing this hardware system, we ensure seamless data collection from the user's vehicle,
enabling efficient toll tax calculations based on distance traveled and enhancing road safety by detecting
alcohol-impaired driving. The integration of IoT technology and centralized processing guarantees real-
time, accurate, and secure data transmission, addressing the shortcomings of traditional toll collection
systems and enabling improved traffic management and user safety.
IoT Devices in Vehicles:
Components: Microcontroller or Single Board Computer (e.g., Arduino, Raspberry Pi), GPS module,
RFID/NFC module.
Functionality: The IoT device is installed in each vehicle to collect and process data. The GPS module
provides real-time location information, while the RFID/NFC module facilitates toll transactions.
Communication Modules:
Components: GSM or GPRS module, Wi-Fi module.
Functionality: Enables wireless communication between the IoT devices in vehicles and the
centralized server. GSM/GPRS modules are suitable for cellular communication, while Wi-Fi modules
may be used for vehicles within Wi-Fi range.
Enclosures and Mounts:
Components: Enclosures for IoT devices, mounts for sensors.
Functionality: Protects the hardware components from environmental factors and physical damage.
Enclosures ensure the durability and longevity of the IoT devices installed in vehicles.
Vehicle OBD-II Interface:
Components: OBD-II interface module.
Functionality: For advanced systems, an OBD-II interface module can be used to collect additional
vehicle data such as engine diagnostics, fuel consumption, and speed.

[18]
SOFTWARE IMPLEMENTATION

To implement the software aspect of our project, we will utilize Bolt IoT's platform, which offers a
versatile framework for data representation and integration. Bolt IoT will serve as the central software
system to collect, process, and represent data from LiFi and GPS technologies. It will offer real-time
data visualization, enabling users to access toll information, vehicle status, and location data. The Bolt
IoT platform's flexibility and scalability will ensure the seamless integration of LiFi and GPS data,
enhancing the overall efficiency and effectiveness of our toll collection and vehicle monitoring system.
Centralized Server Software:
Functionality: Develop server-side software to manage incoming data from IoT devices,
process toll transactions, and interact with the database.
Components: Server application, Database management system (e.g., MySQL, MongoDB).
Database Management System (DBMS):
Functionality: Store and manage data related to user accounts, vehicle information, toll
transactions, and system logs.
Components: Database tables for users, vehicles, transactions, and other relevant data.
Communication Protocols:
Functionality: Implement secure communication protocols between IoT devices and the
centralized server. This ensures reliable and encrypted data transmission.
Components: MQTT, HTTPS, or other secure IoT communication protocols.

[19]
CHAPTER 7

CONCLUSION

In conclusion, our project, which combines LiFi and GPS technologies for toll tax collection, vehicle
monitoring, and alcohol detection, represents a significant advancement in modern transportation
systems. By modernizing toll collection with LiFi and implementing comprehensive vehicle monitoring
and alcohol detection, we address critical issues of efficiency, security, and road safety. The hardware
integration in vehicles ensures accurate data collection, while the software, built on the Bolt IoT
platform, provides real-time data representation and accessibility. This multifaceted approach promises
a more streamlined, secure, and intelligent transportation system, enhancing the commuting experience
for road users and promoting road safety. As we continue to refine and implement this innovative
solution, we anticipate a positive impact on both the efficiency of toll collection and the safety of our
roads, contributing to a smarter and more secure future for transportation.

By leveraging IoT devices in vehicles and a centralized server, the system enables seamless
communication, providing real-time insights into vehicle movements. The implementation of secure
communication protocols and robust security measures ensures the integrity and confidentiality of data,
addressing privacy concerns. The user-friendly interface and notification system contribute to an
improved user experience, allowing users to access transaction information and monitor account balances
effortlessly.
Moreover, the system's automation of toll tax collection reduces manual errors, minimizes wait times at
toll booths, and optimizes traffic flow. The integration with payment gateways facilitates secure online
transactions, aligning with modern payment preferences. Compliance with regulatory standards ensures
the legality and ethical operation of the system.
In essence, the IoT-based Smart Vehicle Operation Monitoring and Toll Tax Collection System is poised
to revolutionize transportation management, offering a comprehensive and efficient solution for both
authorities and commuters. As technology continues to advance, this system sets the stage for smarter,
more connected, and user-centric transportation ecosystems.
The system's ability to provide accurate, real-time information about vehicle movements not only
streamlines toll collection but also opens avenues for dynamic traffic management, incident response, and
infrastructure optimization. This holistic approach contributes to the creation of smarter, data-driven cities
that prioritize efficiency, reduce environmental impact, and enhance the overall quality of life for
[20]
residents.
Furthermore, the successful implementation of this system relies on a collaborative effort involving
technology providers, transportation authorities, and regulatory bodies. The positive impact extends
beyond toll collection, influencing future advancements in transportation policies, infrastructure planning,
and the integration of IoT solutions into urban planning frameworks.
As the IoT ecosystem continues to evolve, this system serves as a testament to the transformative power
of technology in shaping the future of transportation. It underscores the potential for innovation to create
seamless, connected, and sustainable urban environments, paving the way for a more efficient and
responsive global transportation network.

[21]
REFERENCES

[1] Huang, C., & Wei, C. (2017). An RFID-based electronic toll collection system with a secure
communication protocol. IEEE Transactions on Industrial Electronics, 64(9), 7286-7294.

[2] Haas, H. (2016). LiFi: Conceptions, misconceptions, and opportunities. Journal of Optical
Communications and Networking, 8(9), 702-714.

[3] Pang, J. M., Chou, C. K., & Ger, L. P. (2013). A review of alcohol detection systems for vehicles.
IEEE Transactions on Vehicular Technology, 62(1), 276-284.

[4] Mohan, P., Padmanaban, R., & Kumar, P. R. (2013). Vehicle tracking system using GPS and GSM.
International Journal of Scientific and Research Publications, 3(3), 1-5.

[5] Ong, H. C., Chen, W. S., & Abdullah, A. A. (2016). A review on electronic toll collection (ETC)
system. ARPN Journal of Engineering and Applied Sciences, 11(5), 2973-2977.

[6] Tsonev, D., O'Brien, D., Watts, P., Haas, H., & Elgala, H. (2016). VLC+: exploiting excess
bandwidth for faster and more reliable VLC. In Proceedings of the 22nd Annual International
Conference on Mobile Computing and Networking (MobiCom) (pp. 54-58).

[7] Zhang, Q., Wang, D., & Cai, L. (2018). Vehicle monitoring and tracking system using GPS and
GSM. In Proceedings of the IEEE International Conference on Robotics and Automation (ICRA) (pp.
4087-4092).

[8] Xue, Z., Wu, X., & Huang, S. (2019). A comprehensive framework for smart transportation using
Internet of Things technology. IEEE Transactions on Industrial Informatics, 15(10), 5713-5720.

[9] Arshad, R., Willson, M., & Anpalagan, A. (2018). Internet of Things (IoT) in 5G wireless
communication. IEEE Communications Magazine, 56(1), 40-46.

[10] Zheng, Y., Zhang, J., & Shafiq, M. (2016). A comprehensive review of alcohol-impaired driving
detection systems. IEEE Transactions on Intelligent Transportation Systems, 17(8), 2307-2333.

[22]
APPENDIX

9.1 Code for ARDUINO


int ledPin = 13; // Pin connected to the LED
int analogPin = A0; // Pin connected to the photodetector
int dataPin = 7; // Digital pin to control data transmission
int bitDuration = 1000; // Duration of each bit in microseconds (adjust as needed)
char dataToSend[] = "Hello, Li-Fi!"; // Data to send

void setup() {
pinMode(ledPin, OUTPUT);
pinMode(dataPin, OUTPUT);
Serial.begin(9600);
}

void loop() {
for (int i = 0; i < strlen(dataToSend); i++) {
char currentChar = dataToSend[i];

// Transmit the start bit


digitalWrite(dataPin, HIGH);
delayMicroseconds(bitDuration);

// Send the data bits (LSB first)


for (int j = 0; j < 8; j++) {
bool bitToSend = (currentChar >> j) & 1;
digitalWrite(ledPin, bitToSend);
delayMicroseconds(bitDuration);
}

// Transmit the stop bit


digitalWrite(dataPin, LOW);
delayMicroseconds(bitDuration);

// Wait for a short duration before sending the next character


delay(1000);
}
}

lifi code of sending the data

int ledPin = 13; // Pin connected to the LED


int analogPin = A0; // Pin connected to the photodetector
int dataPin = 7; // Digital pin to control data transmission
int bitDuration = 1000; // Duration of each bit in microseconds (adjust as needed)
char dataToSend[] = "Hello, Li-Fi!"; // Data to send

void setup() {
pinMode(ledPin, OUTPUT);

[23]
pinMode(dataPin, OUTPUT);
Serial.begin(9600);
}

void loop() {
for (int i = 0; i < strlen(dataToSend); i++) {
char currentChar = dataToSend[i];

// Transmit the start bit


digitalWrite(dataPin, HIGH);
delayMicroseconds(bitDuration);

// Send the data bits (LSB first)


for (int j = 0; j < 8; j++) {
bool bitToSend = (currentChar >> j) & 1;
digitalWrite(ledPin, bitToSend);
delayMicroseconds(bitDuration);
}

// Transmit the stop bit


digitalWrite(dataPin, LOW);
delayMicroseconds(bitDuration);

// Wait for a short duration before sending the next character


delay(1000);
}
}

lifi code of receiving the data

int photodetectorPin = A0; // Pin connected to the photodetector


int bitDuration = 1000; // Duration of each bit in microseconds (adjust as needed)
char receivedData[64]; // Buffer to store received data
int dataIndex = 0; // Index for the received data buffer

void setup() {
pinMode(photodetectorPin, INPUT);
Serial.begin(9600);
Serial.println("Li-Fi Receiver is ready.");
}

void loop() {
while (digitalRead(photodetectorPin) == HIGH) {
// Wait for the start of a transmission (falling edge)
}

// Wait half a bit duration to sample in the middle of the bit


delayMicroseconds(bitDuration / 2);

dataIndex = 0; // Reset the data index

while (true) {
[24]
// Read the analog value from the photodetector
int sensorValue = analogRead(photodetectorPin);

// Detect the end of the transmission (rising edge)


if (sensorValue > 800) {
break;
}

// Sample the incoming bit in the middle


int bitValue = (sensorValue > 500) ? 1 : 0;

// Append the bit to the received data buffer


receivedData[dataIndex] = bitValue;
dataIndex++;

// Wait for the next bit


delayMicroseconds(bitDuration);
}

// Convert the received bits back to characters


char receivedChar = 0;
for (int i = 0; i < 8; i++) {
receivedChar |= (receivedData[i] << i);
}

// Print the received character


Serial.print("Received: ");
Serial.println(receivedChar);

// Clear the received data buffer


memset(receivedData, 0, sizeof(receivedData));
}

[25]

You might also like