BỘ GIÁO DỤC VÀ ĐÀO TẠO TRƯỜNG ĐẠI HỌC BÀ RỊA-VŨNG TÀU -------- ĐỀ TÀI NGHIÊN CỨU KHOA HỌC HỢP TÁC Co-operative research project between BVU and UBO TÊN ĐỀ TÀI: Thiết kế và phát
Trang 1BỘ GIÁO DỤC VÀ ĐÀO TẠO TRƯỜNG ĐẠI HỌC BÀ RỊA-VŨNG TÀU
ĐỀ TÀI NGHIÊN CỨU KHOA HỌC HỢP TÁC
Co-operative research project between BVU and UBO
TÊN ĐỀ TÀI:
Thiết kế và phát triển module truyền thông GSM/GPRS gửi dữ
liệu từ hệ thống WAVE đến webserver và database
(Design and Development of GSM/GPRS data transmission from
WAVE system to webserver and database)
Trình độ đào tạo: Chương trình trao đổi sinh viên với trường
UBO -Université de Bretagne Occidentale (Pháp)
Ngành đào tạo : Cơ khí
Chuyên ngành : Cơ điện tử
Giảng viên hướng dẫn: Ts LÊ NGỌC TRÂN
Sinh viên thực hiện : Florian Lohezic Lớp : Digital System
Bà Rịa-Vũng Tàu, năm 2018
Trang 2~ 2 ~
Internship report From the 20/05/2018 to the 20/08/2018
Florian Lohézic Bachelor’s degree in electronics and embarked systems
Trang 3~ 3 ~
Summary
2) The project page 4
1 Introduction
1) Introduction of WAVE project 2) Introduction of WAVE system
1) System’s hardware 2) Introduction of GPRS module
3) Conclusion page 9
Trang 4~ 4 ~
Thanks Before beginning the project presentation, I want to thank some people without who, this project never can be possible
First, I want to thank my teacher Mr Claude Vo, because I am here thank to him, not only in Vietnam for my internship but also in the bachelor’s degree in UBO When in November I had to quit the ISEN engineering school because I couldn’t find a company, Mr Vo said me “come in the bachelor’s degree SEME”, the first thing I answered him but if I couldn’t find a company for engineering school how could I find one for the bachelor’s degree, and he answered me that’s not a problem I can find you an internship in Vietnam, and he did it So, Mr Vo, I thank you for the year I spend with you
Then, I want to thank my teammates, first because they were enthusiasts when I join them this year to continue the work on our project of technical degree The guy without the project was not possible to make it was our work team leader Émilien Abgrall, I want to thank him to have convinced Mr Vo to let us make WAVE, I thank him also for all the great moment we had as a team and as friend, and for all the help he gave to me during this project, thank you Émilien I want also to thank, Guénolé Picard who was our account and stock manager during the project and when we were in Vietnam to install the project, Raphặl Bergot with who I work on mechanical part of the project he was our reporter in Vietnam, and Quang Dung Truong with whom I work all this year and during the internship he helped us a lot when we were in Vietnam, thank you guys
Moreover, I want to thank Mr Lê Ngoc Tran who was my internship tutor, I want
to thank him to have accepted my internship request in Baria Vung Tau University, to have helped me when I needed help, and to have rented his house
to give me a place to live in Vung Tau, for all of this thank you Mr Tran
Trang 5~ 5 ~ Finally, I want to thank all BVU’s staff and former student to have helped us here and welcomed us in their university
Trang 6~ 6 ~
Chapter 1 NECESSITY FOR DEVEOPING A WAVE PROJECT SYSTEM
(Sự cần thiết để phát triển dự án WAVE)
1.1 Introduction of WAVE Project
Fig 1 Team members of the WAVE Project for Baria –Vung Tau Viet Nam
This project began after a request of Ba Ria Vung Tau Aquaculture department Indeed, the province located in south Viet Nam have for main industry fish and seafood breeding This breeding took place in enclosure near the sea
However, significant issues of human’s pollution bring the death of breeding product The department look for a way to preserve farms and increase production
Fig.2 Aquaculture of Baria-VungTau depend on natural
Trang 7~ 7 ~
Aquaculture’s department don’t have water analyze direct method So, it’s only possible to know why the products die with laboratory analyses but only after when the pollution’s effects are irreversible
It’s been asked at Baria Vung Tau University and the BTS SN of La Croix Rouge
to realize a self-sufficient water monitoring system We have been studying the project’s feasibility in BTS (two-year technical degree in higher education) and
we want to continue and finish it during our LP SEME (bachelor’s degree)
We have make a complete and automated electronic system allowing to analyze continuously physical water parameter and to transmit measured data in real time
We called our system « WAVE » for Water Analysis for Vietnamese Ecosystem
1.2 Introduction of WAVE system
The WAVE system is shown in figure 3
Figure 3 WAVE system is implement in Baria-Vungtau province
WAVE system operation: Beginning of measurement cycle, Pump No 1 take salt
water from river into the tank 1 to clean the pipe in the same time Pump No 2 empty the tank, then Pump No 1 fill the tank to execute a measurement process The measurement begins by the measurement of the temperature, then the pH, after that the salinity, next the chlorine, the pressure and the oxygen concentration
Trang 8~ 8 ~
and saturation After the completion of measurement, the electronic box will send the measurement result to the raspberry pi3 by radio and alert you by sending a SMS through GSM wave Here, the measure information will be updated to the system's database and can be access through the web server and server interface Next, the tank cleaning process takes place: the Pump No 2 draws water out of the tank, and Pump No 3 the fresh water can be pumped from the clean water tank into the measurement tank and the spray nozzle clean the sensor After the cleaning, the Pump No 2 draws water out from the tank again, the new measurement can start Seawater measurement is automated by setting the system frequency
The system use solar power system, Electronic box with LCD display and rotary button to choose easily the menu and function, sensor calibration, frequency measurement as well as data transmission modes (GSM / radio waves)
We have already install the system in a fish farm near Vung Tau, and now my internship project was to improve the software by developing a new subroutine in the software to allow WAVE’s electronic board to send all the data on a website, created by Mr Quang Dung Truong, he also make a database to record the data
Figure 4 Implementation of the WAVE system in Cha Va river
Trang 9~ 9 ~
Chapter II DESIGN OF GPRS MODULE FOR WAVE SYSTEM
(Thiết kế mô – đun truyền thông GPRS cho hệ thống WAVE)
2.1 System’s hardware
The WAVE system is handled by the electronic board, the schematic of electronic board is shown in attachment
In this Project, my research target designs and make the communication between the WAVE system and webserver, the WAVE system can send or receive data to webserver or versa vise through GPRS module
2.2 Introduction of GPRS module
Sim800L is a GSM/GPRS module, it has many functions such as, send SMS, make a call or transmit data through GPRS This module utilities for IoT applications in tiny custommer design Moreover, it can integrate the function of Bluetooth, FM and Embedded AT The connection diagram is showned in Fig 5
Figure 5 Block diagram of GPRS communication
Trang 10~ 10 ~
To send the data on the website I use GPRS communication, made possible thanks
to the SIM800L device, which send also SMS when the measure reaches the minimum and maximum level configured, by the owner of the fish farm
Figure 7 Connection between Microprocessor with GPRS module SIM800L The SIM800L module is connect on the pin TX/RX of the PIC18F67J11
To make my subroutine I must use “AT” commands to configure the SIM800L, I also ask for a Vietnamese sim card to put in the SIM800L to allow communications, GSM and GPRS “AT” commands are declared like character’s string, inside this string I write text for different “AT” commands
I had to use:
1) AT+CGREG = 0,5; -> Enable network registration
2) AT+CPIN = [PIN code]; -> connection with the sim card
3) AT+CGATT = 1; -> Attach GPRS Service
4) AT+CIPSHUT; -> detachment of packet data control for configuration 5) AT+CIPMUX=0; ->simple IP connection
6) AT+CIPSRIP=0; ->configuration of the simple IP answer
Trang 11
~ 11 ~
7) AT+CSTT=<<APN>>,<<user>>; -> define the access point name of the sim card
8) AT+CIICR; -> 3G connection
9) AT+CIFSR; -> ask for an IP address
10) AT+SAPBR=3,1,””Contype””,””GPRS””; -> Setup GPRS, connection type
11) AT+SAPBR=3,1,””APN””,””m3-world””; -> set the APN (Access Point Name),Vinaphone APN
12) AT+SAPBR=3,1,””USER””,””mms’’; -> Vinaphone APN username 13) AT+SAPBR=3,1,””PWD””,””mms””; -> Vinaphone APN password
14) AT+SAPBR=1,1; -> tries to connect GPRS
15) AT+SAPBR=2,1; -> to query GPRS context
16) AT+HTTPINIT; -> initialize http service
17) AT+HTTPPARA=””CID””,1; -> set parameters for http session
18) AT+HTTPPARA=””URL””,””http:0x2F0x2Fantrtech/wave/scripts/api.ph p?create_data=true””; -> set the url of website you want to reach
19) AT+HTTPACTION=0; -> start the session
20) AT+HTTPTERM; -> close the session
21) AT+SAPBR=0,1; -> close GPRS context
I tried to send the data by diverse ways, first I write the URL line, and, in this line,
I put the variable of measurement directly as text, but when I try this I saw it can’t work because nothing changes it was just text
After that I tried to put the variable of measurement not as text in the line, but this way can’t work too because you can’t stop the text of a string and start over in the same line
Then I tried to use %f to call the variable, so I can put all the variables at the end
of the line and don’t stop the string, but this way doesn’t work either, because you can’t put variable at the end of a text line
Trang 12~ 12 ~
So, after all this try which doesn’t work I think it in another way, and this way work, so like for the other way I define the “AT” command of the URL like a string but I don’t put all the URL, I stop just before the first variable Then I create
a subroutine in which one I create another string, stringA, which contain all the variable name needed by the website, like &TempEau, next I create another string, stringB, which will take stringA value and add all the variable value
Trang 13
~ 13 ~
When this subroutine is done I have to call all the “AT” commands and verify if
is it ok, that’s the main program of my subroutine
In this program I must call the subroutine I made before to have the URL with the data, before use the command “AT+HTTPPARA”
Then I just have to call my subroutine GPRS_WEB.c in the main program to send the data on the website at each measurement made by WAVE’s station
An other possibility was to use the command, “AT+HTTPDATA=(number of bytes needed),(delay to send data);”, but the website take the data in the URL so
I chose to don’t use this method
Trang 14~ 14 ~
When my work is done I just have to build the software and to put it on the electronic board, to do that I use mikroProg Suite for PIC and a compiler from MikroElektronika
After some tests in campus 3, I go install the software in WAVE’s electronic board
in the fish farm
Trang 15~ 15 ~
Conclusion
My work here on GPRS communication, and Mr Quang Dung Truong work on the website and the database, conclude WAVE project, which is already working for few months I’m glad to take part at this project with WAVE team
My internship here in BVU, allows me to increase my skills, first, in programming and in electronics, because I learn a lot in the way to discover how to send data with GPRS, and then in English essentially by talking with people, some students
of BVU, and all the people I have met here
When I arrived first in Vietnam, I was surprised by the way who people are driving here, how to cross the streets, but now I am used to it I was also surprised by the way of Vietnamese people welcome foreigners, by invited us in their house, offer
a meal or invited us at the restaurant, sometimes just to have a tea with them or to make us discover Vung Tau city and area So that will be what I retain from Vietnamese, they are very generous and very kind
So, this internship made me learn a lot, first, about Viet Nam culture and way to live, and about myself, I am going back to France a bit change, more openminded, maybe more confident about living in another country, and about myself
Trang 16~ 16 ~
ATTACHMENT
1 Control Drawing
Trang 17~ 17 ~
2 Power Drawing
Trang 18~ 18 ~
3 Sensors part
Trang 19~ 19 ~
4 Display/ Radio/ GSM part