The bike is a convenient and eco-friendly vehicle for going around. To promote its use and
ease transportation, public bikes have been widely implemented by metropolitan governments, universities, and companies. The behind technique for these shared bike systems differs from one another. This study aims to propose a method for operating and monitoring public bikes within a predefined area. At the beginning, user locates and unlocks the bike via mobile application. Each bike is
equipped with an electronic lock which supports GPS service and GPRS connection. When being
used, the vehicle’s GPS data is regularly sent to the server. At the server-side, the Ray Casting algorithm is used to check whether the current location is inside the allowed area or not. If the current location is out-of-range, the server will notify the manager via email and trigger the bike’s buzzer. To
return, user parks and manually locks the bike anywhere inside the allowed area. Besides, a website is
built for administrator’s management. After testing, the electronic lock, mobile, and web application
work properly for all functions.
9 trang |
Chia sẻ: Thục Anh | Ngày: 11/05/2022 | Lượt xem: 291 | Lượt tải: 0
Nội dung tài liệu An approach for public bike sharing system within a predefined area, để tải tài liệu về máy bạn click vào nút DOWNLOAD ở trên
My N. Nguyen, Bang Anh Nguyen, Linh D. Phung, Thao Banh Ngoc Thuy, Tam Minh Bui, Hao Anh Vo and Thanh Hai Nguyen
An Approach for Public Bike Sharing System
within a Predefined Area
My N. Nguyen1,2, Bang Anh Nguyen1, Linh D. Phung1,
Thao Banh Ngoc Thuy1, Tam Minh Bui1, Hao Anh Vo1, and Hai Thanh Nguyen1
1Can Tho University, Vietnam
nnmy@cit.ctu.edu.vn, bang98.2016@gmail.com, linhphung15999@gmail.com,
bntthao1912@gmail.com, buiminhtamweb@gmail.com,
haob1605331@student.ctu.edu.vn, nthai@cit.ctu.edu.vn
2 Kyoto Institute of Technology, Japan
d9821501@edu.kit.ac.jp
Abstract. The bike is a convenient and eco-friendly vehicle for going around. To promote its use and
ease transportation, public bikes have been widely implemented by metropolitan governments, uni-
versities, and companies. The behind technique for these shared bike systems differs from one anoth-
er. This study aims to propose a method for operating and monitoring public bikes within a prede-
fined area. At the beginning, user locates and unlocks the bike via mobile application. Each bike is
equipped with an electronic lock which supports GPS service and GPRS connection. When being
used, the vehicle’s GPS data is regularly sent to the server. At the server-side, the Ray Casting algo-
rithm is used to check whether the current location is inside the allowed area or not. If the current lo-
cation is out-of-range, the server will notify the manager via email and trigger the bike’s buzzer. To
return, user parks and manually locks the bike anywhere inside the allowed area. Besides, a website is
built for administrator’s management. After testing, the electronic lock, mobile, and web application
work properly for all functions.
Keywords: bike-sharing system · electronic lock · ray casting
1 Introduction
The need of a vehicle for going around an area is truly essential in many scenarios, such as the visit of
some scholars to a university, the discovery of tourists in a city, or the business trip to a large company.
The public vehicle is an option, but it takes time to wait and the guest needs to know about the route.
Another good option is the bike, which is convenient for one person use, flexible route and friendly to the
environment. Systems for renting bikes have been deployed in many countries, but the technology behind
them varies from company to company. In this research, we propose an approach for a public bike system
within a predefined area. Its objective is to enable the reservation and return of a bike, as well as to ensure
the bike used inside a designated area.
The outcome of this study includes: Proposal system architecture; Hardware prototype of the electronic
lock; Workflows for mobile and web applications.
The remaining of this paper is organized as follows. Section 2 is the literature review on the bike-
sharing system. Next, our approach is described in Section 3. After that, the experiment result is presented
in Section 4. Finally, Section 5 concludes and delivers some remarks for this study.
2 Related work
Some relevant work and research in Vietnam and foreign countries have been investigated for this topic.
In Ho Chi Minh City, the ”Easy Move” project was proposed at Vietnam National University of Ho Chi
Minh City [1]. This system used solar energy as the power source, QR code scanning technique for un-
locking and returning the bike, and GPS for managing locations. In US, the LimeBike system allows
users to rent nearby bikes via a mobile application and scan QR code at the saddle to unlock the bike.
107
KỶ YẾU HỘI THẢO KHOA HỌC QUỐC GIA CITA 2020 “CNTT VÀ ỨNG DỤNG TRONG CÁC LĨNH VỰC”
When finishing the trip, users manually lock the bike and leave it anywhere. Each bike has a built-in GPS
chip and 4G network module to locate and communicate with the server. Meanwhile, Punpun bike system
in Thailand and UBike system in Taiwan deploy designated stations for borrowing and returning bikes.
GPS is integrated to track the position of the bike. In 2015, Thibaut Harang et al. proposed a model for
predicting the behavior of bike-sharing systems of the city [2]. This model suggested optimal station loca-
tions and sizes as well as the intensity of bike redistribution based on the demand estimations. To do this,
a set of assumptions that enable to tailor the demand modeling was described first. Then, a two-step mod-
eling framework was presented to estimate bike sharing demand from city features and then translated to
station behavior patterns. Lastly, a methodology was proposed to iteratively develop and test a model
based on the previous modeling framework. Peter Midgley made a study of The Role of Smart Bike-
sharing Systems in Urban Mobility [3]. This research reviewed the state-of-the-art of bike-sharing sys-
tems, drawing on experiences in selected European cities. This study proved that bike-sharing programs
have expanded rapidly throughout Europe as cities search for ways to increase the use of bike, hence
satisfied increasing mobility demands, and reduced adverse environmental impacts. Rebalancing Bike
Sharing Systems: A Multi-source Data Smart Optimization [4] is a study that “developed a multi-source
data smart optimization approach for addressing the station rebalancing problem in bike-sharing sys-
tems”. They proposed a Meteorology Similarity Weighted KNN (MSWK) regressor for predicting station
pick-up demand. And they provided an Inter Station Bike Transition (ISBT) model to predict the drop-off
demand. Then, the station inventory target levels were determined based on the predicted traffic flows
and were used for the following rebalancing task.
3 Approach
3.1 System architecture
The system is organized into three functional layers (Fig. 1), which include:
· Presentation layer: provides the interaction between the physical subjects (user, bike) and the system.
This layer consists of three components:
Fig. 1. Overview of the system
─ The electronic lock: sends the current status of the bike to the server, receives and performs the un-
lock command from the server. For the prototype of this lock, Ai-Thinker A9G GPRS and GPS
board is used for location acquisition and server communication. In addition, NodeMCU board is in
charge of controlling servo-based latch and the buzzer.
─ Mobile application for user: sends requests for bike borrowing and damage report; retrieves logs of
borrowing, returning, and violation.
108
My N. Nguyen, Bang Anh Nguyen, Linh D. Phung, Thao Banh Ngoc Thuy, Tam Minh Bui, Hao Anh Vo and Thanh Hai Nguyen
─ Web application for administrator: manages bikes, accounts, borrowing, returning, violations, dam-
ages, campus coordinates and grants administration privilege.
· Logic layer (server): is responsible for receiving requests, accessing the data layer, processing, and
returning the result to the presentation layer. RESTful API and NodeJS are adopted for encapsulating
tasks of this layer.
· Data layer (PostgreSQL database): organizes and stores the data.
3.2 The electronic lock
Circuit diagram When designing the electronic lock, some aspects need to be considered carefully.
These are the power supply, connection with the server, acquisition of bike location, manner of
lock/unlock movement, and the lock dimension. In our prototype, the GPRS board with built-in GPS
sensor is selected instead of using two different boards. By inserting a SIM card, this board can com-
municate with the server. Because the exchange data is small in size and not necessarily in a rush, the
data rate is not so serious when selecting communication boards. Table 1 is the list of hardware compo-
nents we use for the lock. And the physical connection of these components are shown in Fig. 2.
Table 1. Hardware components of the electronic lock
No. Component Functionality
1 ESP8266 NodeMCU Control other components
2 AI-Thinker GPRS & GPS A9G board Locate the bike and connect to the server
3 Servo Close and open the latch
4 Buzzer Make alert
5 Endstop switch Recognize the lock status (lock/unlock)
6 Solar battery Supply power to the lock
Fig. 2. Circuit diagram of the electronic lock
Lock case design To pack hardware components into one unit, the lock case is necessary. It should be
compact and durable enough to hold boards and fit the bicycle. Our case model is drawn after other phys-
ical components were made. Then, it is rendered into a real-world object by a 3D printer. Fig. 3 shows
the lock case that contains our circuit board inside. The lock is automatically unlocked when receiving a
signal from the server and is manually locked by the user. When the bike is being borrowed, the lock
regularly sends GPS data to the server. If the bike moves outside legal area, the buzzer will make alert
until there is no violation.
109
KỶ YẾU HỘI THẢO KHOA HỌC QUỐC GIA CITA 2020 “CNTT VÀ ỨNG DỤNG TRONG CÁC LĨNH VỰC”
Fig. 3. The appearance of the electronic lock
Interaction between A9G module and nodeMCU The coordinates of the bike are obtained by A9G
module and sent to the server by GPRS. NodeMCU communicates with this module via UART interface.
At first, nodeMCU sends commands to the RX pin of module A9G. Then, A9G pushes the result to the
TX pin for nodeMCU. The functions of A9G is performed via AT instruction set (aka. Hayes command
set). These instructions are native for manipulating with the cellular connections such as dialing, hanging
up, and parameter updating.
Lock principle After sending coordinates to the server, nodeMCU will receive a bicycle status value (0:
available, 1: unavailable, 2: being repaired, or 3: being outside) from the server. If bicycle status value is
1, the servo will be activated to pull the latch to unlock the bike. If the bicycle status value is 3, the buzzer
will be activated. The locking principle is depicted in Fig. 4.
3.3 Mobile and web application
Because of the ubiquity of smartphones with built-in GPS sensors, mobile application is selected to pro-
vide basic functions for users. It is used for finding available bikes, sending borrowing requests and view
usage history.
For administrators, a web application is suitable to deal with management tasks, from defining the val-
id region on the map to monitoring current transactions. NodeJS environment is used for constructing
web logic. Its highlight characteristic is asynchronous, so all requests are processed immediately. Overall,
the web application provides the administrator all the necessary functions to search, view and edit infor-
mation of the whole system.
In our applications, Google Maps API is utilized for working with the map. This API provides services
such as direction, location display of objects, polygon drawing, etc. By these services, we can load the
map, show bikes’ location, draw valid regions, and show the shortest path between users and available
bikes.
110
My N. Nguyen, Bang Anh Nguyen, Linh D. Phung, Thao Banh Ngoc Thuy, Tam Minh Bui, Hao Anh Vo and Thanh Hai Nguyen
Fig. 4. Lock principle
3.4 Server
RESTful API To enable the scalability and interoperability, every operation of our system is encapsulat-
ed into the RESTful web service. In this architecture style, the communication is based on HTTP mes-
sages. HTTP messages are functionally classified into methods including GET, POST, PUT, and
DELETE. Table 2 summarizes the RESTful methods of our system.
Table 2. RESTful methods
No. Route prefix Description
1 /taikhoan Get, add, update, delete the information of the user and expiration status
2 /xe Get, add, update, delete a bike
3 /loi Select, insert, update, delete a name of violation
4 /khuonvien Get location and update a campus on map
5 /muontra Statistics of users’ borrowing and returning of bicycles in the system
6 /vipham Statistics of user violations when using bicycles on campus allow
7 /huhong Receive reports of bicycle damage from users
Ray Casting algorithm for bike location validation This algorithm is used to determine whether the
current bike location is within the valid region or not. Its core idea is to count the number of intersections
between the polygon (the valid region) and the ray originated from a point (a bike) [5]. The count value
reflects the relative position of the point to the polygon (Fig. 5):
111
KỶ YẾU HỘI THẢO KHOA HỌC QUỐC GIA CITA 2020 “CNTT VÀ ỨNG DỤNG TRONG CÁC LĨNH VỰC”
Fig. 5. Ray Casting algorithm
· If the count is odd, that point is inside the polygon, or the bike is within the valid region.
· If the count is even, that point is outside the polygon, or the bike is not in the valid region.
The pseudocode for Ray Casting algorithm is as follows:
count ← 0
foreach side in polygon :
if ray_intersects_segment(P, side) then count ← count + 1
if is_odd (count) then return inside
else return outside
The algorithm is run every time the server gets GPS coordinates from an in-use bike. If the location is
illegal, the server will update the bike status to ’being outside’, trigger the buzzer sound, and log this vio-
lation (Fig. 6).
Borrowing and returning process After logging in the mobile application, users can see available bikes
on the map (Error! Reference source not found.) and click one of them to send a borrowing request.
Then, the server will update the bike status from ’available’ to ’unavailable’. At the same time, the new
status is sent back to the bike to proceed with the unlock. To return, users need to manually lock the bike.
After this action, the lock will send new bike status to the server. The server will update the status of the
bike from ’unavailable’ to ’available’, as well as time and location of the returned bike. Finally, a notifi-
cation will be triggered to inform the user that the transaction is successful.
Fig. 6. The diagram on how to check the bikes’s position
112
My N. Nguyen, Bang Anh Nguyen, Linh D. Phung, Thao Banh Ngoc Thuy, Tam Minh Bui, Hao Anh Vo and Thanh Hai Nguyen
Fig. 7. Available bikes are shown in the mobile application
For management, every borrowing and returning action needs to be logged. In this way, users can
check their history of transactions easily. On the other hand, the administrators can know how many
times and how long the bike is used, this information is useful for planning bike maintenance.
3.5 Database
In this research, we use PostgreSQL for storing data of the system. PostgreSQL is an open-source rela-
tional database that supports both SQL (relational) and JSON (non-relational) querying. The database
includes 7 tables as follows.
· BIKES: Information of each bike (ID, status, current location, IMEI of SIM module, year of manufac-
ture, note).
· CAMPUS: ID and status of the campus, and its boundary.
· ACCOUNTS: Information about user accounts (ID, password, name, role, unit, type, validity).
· BORROWING AND RETURNING: ID, time and location when a user borrows and returns a bike.
· VIOLATIONS: ID, status, time and location of a violation case.
· VIOLATION DETAILS: Types of violation.
· DAMAGES: Detailed information about the damage users did to the bike (ID, time, location, status,
damage description).
The Entity-Relationship diagram is shown in Fig. 8.
Fig. 8. The conceptual data model of the bike-sharing system
113
KỶ YẾU HỘI THẢO KHOA HỌC QUỐC GIA CITA 2020 “CNTT VÀ ỨNG DỤNG TRONG CÁC LĨNH VỰC”
4 Result
Based on our proposed system architecture, we have constructed components to support administrators
and users. These components are:
· Electronic lock prototype: is covered by plastic with the dimension 66mm x 189mm x 15mm. This
lock is to exchange status data with server.
· Management website: can be used for monitoring the bike status (Fig. 9), defining the valid zone and
dealing with other data.
Fig. 9. Web function for viewing real-time bike status
· Mobile application: is for locating, borrowing a vacant bike, reporting bike issues, and reading the
logs.
The system was tested at Can Tho University with the server hosted on Heroku platform. During the
test, the time for bike borrowing was at least 3 seconds. Meanwhile, that time for returning (manually
locking and status update) was around 1 second. For GPS data, its accuracy was between 2.5m and 3.5m.
Some external factors can affect the system performance. For example, weak Internet signals slow
down the communication time. Besides, bad weather may block sunlight to the solar battery or worsen
GPS signals. In addition, high buildings, walls and trees degrade GPS accuracy.
5 Conclusion
For the project scope, we successfully built a public bike system consisting of an electronic lock proto-
type, a management web for administrators, and a mobile application for normal users. The combination
of the lock model and 4G SIM card makes it possible to use the system anywhere without relying on Wi-
Fi. In addition, the energy of the lock model is maintained by solar energy. We also applied the ray-
casting algorithm for setting the legal area of the bike.
Regarding further improvement, optimization of the lock is important. The current approach uses
spring, bars, and switches to control the movement. These structures will cause friction when working
and degrade the lock hardware over time. So a non-friction or less friction solution is highly expected.
References
1. T. Dat, “Xe dap thong minh bat dau chinh phuc sinh vien DHQG TP.HCM”, Tuoi Tre Online, April 7, 2018. Ac-
cessed on: April 2019. [Online]. Available: https://tuoitre.vn/xe-dap-thong-minh-bat-dau-chinh-phuc-sinh-vien-
dhqg-tphcm-2018040714262972.htm.
114
My N. Nguyen, Bang Anh Nguyen, Linh D. Phung, Thao Banh Ngoc Thuy, Tam Minh Bui, Hao Anh Vo and Thanh Hai Nguyen
2. Thibaut Harang, M.Sc. Montserrat Miramonte, “Towards optimized design of bike sharing systems: building a
demand model at the station level”, 2015 IEEE International Conference on Data Mining, page 25-60, 102-103,
DOI: 10.1109/ICDM.2015.99.
3. Midgley. ”The Role of Smart Bike-sharing Systems”. Urban Mobility. Journeys. May. 23-31, 2009.
4. Junming Liu, Leilei Sun, Weiwei Chen, Hui Xiong, “Rebalancing Bike Sharing Systems: A Multi-source Data
Smart Optimization” (2016), the 22nd ACM SIGKDD International Conference, DOI:
10.1145/2939672.2939776.
5. Bourke, ”Determining if a point lies on the interior of a polygon”, 1997. Accessed on: May 3, 2019. [Online].
Available:
115
Các file đính kèm theo tài liệu này:
- an_approach_for_public_bike_sharing_system_within_a_predefin.pdf