Real-time uv monitoring System New York Institute of Technology eeng491-W02 Senior Design Project Advisor: Tao Zhang Team member Chenyang Yu, Changsheng Liu, Zhong Mao May 11, 2013 Table of Contents



Download 82.12 Kb.
Date30.06.2017
Size82.12 Kb.
#22077




Real-time UV Monitoring System

New York Institute of Technology
EENG491-W02

Senior Design Project
Advisor: Tao Zhang
Team member

Chenyang Yu, Changsheng Liu, Zhong Mao
May 11, 2013


Table of Contents

1 Introduction…………………………………………………………….3

2 Block Diagram and Design……………………………………………..3

3 Hardware Part…………………………………………………………..4

3.1 UV Module…………………………………………………………...4

3.2 Arduino Part Pin Connections………………………………………..5

3.3 MSP430F149 Part Pin Connections………………………………….5

3.4 Components List……………………………………………………...6

4 Software Part…………………………………………………………...6

4.1 Exposure Time Function……………………………………………...6

4.2 Amarino Module……………………………………………………...7

4.3 Arduino Module………………………………………………………9

4.4 MSP430F149 Module………………………………………………10

5 Testing…………………………………………………………………11

6 Discussions and Future Plan…………………………………………..12

6.1 Difficulties…………………………………………………………..12

6.2 Applications…………………………………………………………14

7 References…………………………………………………………….16



  1. Introduction

Sunshine is a great treasure that everyone can reach for free. More and more people are pleased to bask in the sun and enjoy the benefits that the sunlight brings to us. The sunshine provides much more than heat itself but promotion of blood circulation and metabolism. UV light in the sunshine produces chemical reactions that can trigger the body to produce vitamin D. Research shows that people get more vitamin D during the summer. c:\users\maooam\appdata\roaming\tencent\users\394325905\qq\wintemp\richole\vlefyq4huq_7z~(d60iuxi0.jpg

However, silent damages always accompany with the enjoyment. Over-exposure to UV rays can damage DNA and cause pain to the skin imperceptibly or even skin cancer. What’s more, cataract and blindness caused by UV are not rare now. In a way, the demand of manipulation of sunshine time facilitates birth of our design: real-time UV monitoring system. c:\users\maooam\desktop\uv detector\资料\cataract.jpg




Figure 2. Cataract Eyeball


  1. Block Diagram and Design


UV Sensor



Arduino UNO

MSP430F149



Bluetooth



Android Phone with Amarino



Diagram 1. Flow Chart of Hardware System




Choose Skin Type


Start




Input




Data from Amarino

Draw Curve




Message

Alert


Diagram 2. Flow Chart of Software System

The app received data from Amarino every 1500ms or 500ms (determined in Arduino program, delay (1500) and in MSP430F149, delay (500)), then we calculate the accumulative UV index and determine when to send an alert.




  1. Hardware Part

3.1 UV Module

The UV module we choose is UVM-30, which is very small and with high accuracy. The output of the UV sensor is analog voltage signal following the relationships with UV index in Figure 3 and Figure 4.



c:\users\maooam\appdata\roaming\tencent\users\394325905\qq\wintemp\richole\0hstovnku}by%v_ln0.jpg


Figure 3. Typical response curve


c:\users\maooam\appdata\roaming\tencent\users\394325905\qq\wintemp\richole\qr4s}ap~sw]9n9}iy9ss]8s.jpg

Figure 4. Standard output value

3.2 Arduino Part Pin Connectionsc:\users\maooam\desktop\uv detector\资料\20130515_130325.jpg



UVM-30:

VCC – 3.3V

GND – GND

ONT – A5
BlueSmirf Silver:

VCC — 5V

GND — GND




Figure 5. Arduino Part Connection
TX — RX (digital pin 0 of Arduino)

RX — TX (digital pin 1 of Arduino)

Note: The BlueSMiRF bluetooth module should work at 115200bps. If it does not work with 9600bps, you can change the baud rate and try again. Here’s a tutorial for checking and altering the actual baud rate of your module.
3.3 MSP430F149 Part Pin Connectionsc:\users\maooam\desktop\uv detector\资料\20130515_125751.jpg

UVM – 30:

VCC – AVCC (Pin 64)

OUT – P6.0/A0 (Pin 59)

GND – AVSS (Pin 62)
Capacitor: one 100nF normal capacitor and one 10nF electrolytic capacitor (AVCC->+) connect AVCC and AVSS in parallel


Figure 6. MSP Part Connection


Bluetooth Module:

VCC – DVCC (Pin 1)

GND – DVSS (Pin 63)

TXD – URXD0 (Pin 33)



RXD – UTXD0 (Pin 32)
3.4 Components List

Component

Quantity

Price(Dollars)

UVM-30

2

16

Arduino UNO

1

22

MSP430F149

1

21

BlueSMiRF

1

40

Bluetooth Linvor

1

15

Battery Case

1

5

UVP Light

1

34

Battery

6

6

Capacitor

2

0.5

Wires

Several

0.5

Total




170


Table 1. Components List


  1. Software Part

4.1 Exposure Time Function

The UV rays have the wavelength from 200 to 400 nanometers and are divided into 3 ranges with UV-A from 315 to 400 nm, UV-B from 280 to 315 nm and UV-C from 200 to 280 nm. As UV-C rays are absorbed by the ozonosphere, the UV light we get from nature is UV-A takes about 98 percent and UV-B for about 1 percent. The damage of UV rays is directly determined by ultraviolet exposure which equals product of UV intensity and time. UV intensity, with unit milliwatt per square meter, can be derived by adding all UV rays of different wavelengths multiplied by corresponding weighed value in Erythema Spectrum Curve. The UV index is the product of UV intensity and 0.04. The real-time UV monitoring system will record the curve of real-time UV intensity on android phones, calculate the appropriate time of sunshine exposure and send an alert in case of oversleeping under sunshine.

Sunburn risk is a primarily a function of total exposure (UV index times time) and skin type. The following Table 1 categorizes skin types by an individual’s tendency to tan and/or burn and estimates the minimum UV Index that will cause perceptible reddening 24 hours following one hour of exposure.


Skin type

Description

Typical Features

One Hour Exposure

I

Always burns, never tans

White skin, blue/hazel eyes, blond/red hair

1-3

II

Always burns, tans minimally

Fair skin, blue eyes

2-4

III

Burns minimally, tans slowly

Darker Caucasian skin

3-5

IV

Burns minimally, tans well

Light brown skin, Mediterranean

4-6

V

Rarely burns, tans profusely/darkly

Brown skin, Middle Eastern, Latin American

6-10

VI

Never burns, always tans, deeply pigmented

Dark brown or black skin

10-16


Table 2. Skin type and exposure description


4.2 Amarino Module

This part contains the signal processing of Arduino, sending of Bluetooth and receiving of Amarino.



Step 1 Install Amarino

Go to http://www.amarino-toolkit.net/ and download the following applications on your mobile phone.

a. Amarino – Android Application- to be installed on phone.

b. Amarino Plug-in Bundle- to be installed on phone.

c. Amarino Library- To be kept in computer- needed to install the application
Step 2 Download Meet Arduino Library

Download the MeetAndroid Library and place it into the libraries Folder Arduino.

After placing the folder into the libraries folder, you should be able to access all the Amarino files through the Arduino programming environment.

You can see the picture below:



c:\users\maooam\desktop\uv detector\资料\20130515_142112.jpg

Figure 7. Download meet Arduino library



Step 3 Set up Bluetooth adapter

For this experiment, you can either use BlueSMiRF Bluetooth module (from sparkfun) or a general Bluetooth module from BuildCircuit.net.

Amarino is perfectly compatible with both of these modules. BlueSMiRF adapter is expensive than the general one, so, I recommend to buy the general one.

Connect the Bluetooth adapter in the following way:

VCC — 5V

GND — GND

TX — RX (digital pin 0 of Arduino)

RX — TX (digital pin 1 of Arduino)

NOTE: The BlueSMiRF bluetooth module should work at 115200bps. If it does not work with 9600bps, you can change the baud rate and try again. Here’s a tutorial for checking and altering the actual baud rate of your module.

HOW TO CHANGE BAUD RATE OF BLUE SMIRF BLUETOOTH MODULE

Please remember that the given procedure does not work for general Bluetooth adapter. Its default baud rate is 9600bps and it works with that.



Step 4 Test the communication between Bluetooth adapter and Arduino

 http://www.amarino-toolkit.net/index.php/getting-started.html

We have successfully connected the Arduino to the smartphone via Bluetooth and the smartphone can receive data from our UV sensor.
Step 5 Set up Eclipse

It is the most complicated part of this experiment.

You can get a detailed tutorial from http://developer.android.com/sdk/eclipse-adt.html#installing

The basic idea is to install the Eclipse first (follow the system requirements), then install the android SDK, and then install ADT plugin for Eclipse IDE. I strongly recommend you to follow the instructions seriously.

We have downloaded an example from http://www.amarino-toolkit.net/index.php/download.html and try to test the android app.

We have also used other phones: Sony Lt26ii (Android 4.0.4), Samsung galaxy S3 (Android 4.1.2), Motorola xt800 (Android2.1) and all of them work well.


4.3 Arduino Module
The jobs done by Arduino broad:

  1. Analogread() and ADC

Reads the value from the specified analog pin. The Arduino board contains a 6 channel (8 channels on the Mini and Nano, 16 on the Mega), 10-bit analog to digital converter. This means that it will map input voltages between 0 and 5 volts into integer values between 0 and 1023. This yields a resolution between readings of: 5 volts / 1024 units or, .0049 volts (4.9 mV) per unit. The input range and resolution can be changed using analogReference().

It takes about 100 microseconds (0.0001 s) to read an analog input, so the maximum reading rate is about 10,000 times a second. It returns int (0 to 1023).


Note:

If the analog input pin is not connected to anything, the value returned by analogRead() will fluctuate based on a number of factors (e.g. the values of the other analog inputs, how close your hand is to the board, etc.). The default reference for arduino board is 5V.




  1. Sample Rate

We achieve this goal by setting a delay() function in the while loop. Once the loop is executed, the analogRead() function will sample the data from sensor and by delay(500) function, delay 500ms, then next sample data come in. This parameter is quite important when we calculate the accumulative UV exposure which equals to the sum of delay time multiplied with UV index.



  1. Bluetooth Module

The bard rate is quite important to be set in Arduino code part. If the bard rate is not set correctly here, you will find that your connection with smartphone is OK, however, no data is received on smart phone. The code Serial.begin(115200) set the bard rate of Bluetooth and it dependents on different Bluetooth module.

The default bard rate of BlueSMiRF silver is 115200, it can also be changed when necessary.


4.4 MSP430F149 Module

As MSP430F149 has a smaller size compares with Arduino, it is also chosen as the MCU. Considering dozens of advantages included in the MSP430 system, especially low power usage and extreme broad scale usage in healthcare field, we make another system based on the MSP430 from TI.

The whole developing process contains the following steps:


  1. Developing tools preparation

Software: IAR installation: you have to install the newest edition of IAR. For now, we use IAR Embedded Workbench Evaluation for MSP430 5.5

Hardware: UIF firmware update. It should do automatically to specific edition of IAR. It can just do one way to update higher edition.



Operation System: Microsoft and Windows 7


  1. MSP430 developing board

We use MSP430-H149 developing board from Olimex™, which use 32768Hz crystal and JTAG port as programming and debugging port. This board can get charge from UIF debugger or a separate board, and we switch the jumper to the mode to charge the board from UIF debugger.


  1. Example testing for board and developing circumstance

We use the example included in the software of IAR. It will blink an LED light with connection to P1.0 port.


  1. Project design

The system need to contain two parts to finish it job: one is to input signal from the UV sensor and convert it into digital signal within the ADC12 module; two is to output the UV index result. We firstly show the index number with the quantity of LED lights, and then try to use the UART module to communicate with cellphone through Bluetooth.


  1. UV detection and ADC conversion

The output of the sensor depends on the reference voltage. Based on the datasheet of the UV sensor and reference book, we need one 100nF normal capacitor and one 10nF electrolytic capacitor to connect to reference voltage pin in parallel. The register setting should be 1.5V inside of reference power, and the conversion clock inside is signal channel conversion mode. The physical connection of sensor is VR+ is 1.5V, VR- is VSS.


  1. UART and Bluetooth setting.

We pick up UART0 as out transmission port. Depending on the crystal of on the board, the highest baud rate is 9600bps; because we do not have device to set the baud rate on BlueSMiRF, we choose another Bluetooth module which set 9600dps as factory setting. Following the standard protocol of RS-232C, we use 8MHz clock source to transfer 8 data bits, 1 stop bit and no parity bits. Another important issue is how to establish the connection with Android smart phone and Bluetooth. The App on Android phone called Amarino, which is an open source project to receive and process data on Android phone which send by Arduino, need a separate protocol to communicate with Bluetooth device. All data should convert into string to send, and it needs a beginning flag DC2 (22 in OCT, 18 in DEC, 12 in HEX and ^R in control-key) in ASCII control character and an ending flag DC3 (23 in OCT, 19 in DEC, 13 in HEX and ^S in control-key).


  1. Testing

Both Arduino and MSP parts work well and we can see clear real-time UV curve on the cell phone. When the alarm is detonated, the cell phone will give an alert sound and a remind message is send to the emergency contact.

c:\users\maooam\desktop\uv detector\资料\screenshot_2013-05-08-16-36-18.png



Figure 9. Cell Phone Alert

Figure 8. Cell Phone Curving
c:\users\maooam\desktop\uv detector\资料\screenshot_2013-05-08-16-35-35.png



  1. Discussions and Future Plan

6.1 Difficulties

1. Even though the Amarino 2.0 works well and it can receive data from our sensor. The data can’t be shown in the app. (The app doesn’t work). From now on, we have tried several ways.


First:   Get the “AmarinoLibrary_v0_55.jar file included. We download it from 



http://www.amarino-toolkit.net/index.php/download.html
Second: Confirm the mac address of the Bluetooth module.
Third:  Change AndroidManifest.xml file. Go to Application and set Debuggable as ‘True’.

c:\users\maooam\desktop\uv detector\资料\捕获1.png


Figure 10. Set Debuggable as true

Fourth: We have also checked the android SDK version.

In the AndroidManifest.xml:



"3" android:targetSdkVersion="7"/>

So we think it’s not the problem. I have also tried Android 2.1 (API level 7) but it still doesn’t work.

We have also changed our phone: Sony Lt26ii (Android 4.0.4), Samsung galaxy S3 (Android 4.1.2), Motorola xt800 (Android2.1) but any of them doesn’t work. We are still trying to figure out what’s wrong (perhaps the example itself has some problems).

Even though we downloaded the AmarinoLibrary_v0_55.jar file from Amarino website, in fact, something is wrong in this jar file because when we import it to the SensorGragh project, even though there is no error shown, when built, the DDMS shows“NoClassDefFoundError” as below.


c:\users\maooam\desktop\uv detector\资料\12.png


Figure 11. NoClassDefFoundError

So we extract the two .java files Amarino.java and AmarinoIntent.java and import them to the SensorGragh project, and then the problem is solved.



Figure 12. File structure



  1. When sending message, don’t forget to add "android.permission.SEND_SMS" /> into AndroidManifest.xml

  2. When add new activity into the project, don’t forget to add the .java file into AndroidManifest.xml, and also change launch order.

android:name="edu.mit.media.hlt.sensorgraph.MainActivity"

android:label="@string/title_activity_main" >



"android.intent.action.MAIN" />

"android.intent.category.LAUNCHER" />






  1. When downloading program into Arduino, remove the Bluetooth module, otherwise, it fails.

c:\users\maooam\desktop\uv detector\资料\arduino.png

Figure 13. Download Fail

6.2 Applications

The design has a broad application fields and promising market.



Beach

Beaches are the most popular places in hot days and those in hot area are crowded all the year round such as Miami and Hawaii. Sunburn is common here. That’s why every tourist should be aware of the UV intensity around. The system will be placed outdoors and maintain stationary. The sun lovers can connect to system by Bluetooth, and then they can monitor the UV index on their phones and are free to enjoy sunlight.



c:\users\maooam\desktop\uv detector\资料\7.jpgc:\users\maooam\desktop\uv detector\资料\5.jpg



Figure 15. Gerocomium

Figure 14. Beach



Gerocomium

The old in gerocomium are always pleased to bask the warm sunshine. They are mostly unconvenient to move, and one paramedic is in need to monitor the UV intensity on phone screen and call the old back when time up.


Baby roomc:\users\maooam\desktop\uv detector\资料\6.jpg

The infants are usually flimsy and need special attention when being taking care of. Their tender skin is sensitive to UV rays and the paramedic can stay outside the room to monitor the UV intensity inside. That is to say, the nurse is able deal with other things without staying close doing nothing but staring at the screen.




Figure 16. Baby room




  1. References

  1. UVM-30 UV module datasheet: http://wenku.baidu.com/view/a53ab423af45b307e8719750.html

  2. UV Index: http://www.lakesawyerweather.com/UV_Index.htm

  3. UV Radiation: http://baike.baidu.com/view/259496.htm

  4. UV Index introduction: http://baike.baidu.com/view/113252.htm

  5. Amarino: http://www.amarino-toolkit.net/

  6. connect my phone to Arduino : http://www.amarino-toolkit.net/index.php/getting-started.html

  7. Set up Eclipse: http://developer.android.com/tools/sdk/eclipse-adt.html#installing

  8. Android SDK: http://developer.android.com/sdk/index.html

  9. Arduino reference: http://arduino.cc/en/Reference/HomePage

  10. MSP430x1xx Family User’s Guide, TI’s Corp: www. ti.com

  11. MSP430F149 datasheet: www. ti.com



Download 82.12 Kb.

Share with your friends:




The database is protected by copyright ©ininet.org 2022
send message

    Main page