Real-Time UV Monitoring System

Total Page:16

File Type:pdf, Size:1020Kb

Real-Time UV Monitoring System

Real-time UV Monitoring System

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 Real-time UV Monitoring System

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. 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.

2. Block Diagram and Design

2 Real-time UV Monitoring 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.

3. 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.

3 Real-time UV Monitoring System

3.2 Arduino Part Pin Connections UVM-30: VCC – 3.3V GND – GND ONT – A5

BlueSmirf Silver: 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.

3.3 MSP430F149 Part Pin Connections 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

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

4 Real-time UV Monitoring System

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

4. 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 Always burns, never White skin, blue/hazel I 1-3 tans eyes, blond/red hair Always burns, tans II Fair skin, blue eyes 2-4 minimally Burns minimally, tans III Darker Caucasian skin 3-5 slowly Burns minimally, tans Light brown skin, IV 4-6 well Mediterranean Rarely burns, tans Brown skin, Middle V 6-10 profusely/darkly Eastern, Latin American Never burns, always VI Dark brown or black skin 10-16 tans, deeply pigmented

4.2 Amarino Module This part contains the signal processing of Arduino, sending of Bluetooth and receiving of Amarino. Step 1 Install Amarino

5 Real-time UV Monitoring System

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:

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.

6 Real-time UV Monitoring System

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.

2. 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.

3. 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,

7 Real-time UV Monitoring System 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

2. 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.

3. 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.

4. 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.

5. 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.

6. 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

8 Real-time UV Monitoring System

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).

5. 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.

6. 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’.

9 Real-time UV Monitoring System

Fourth: We have also checked the android SDK version. In the AndroidManifest.xml: 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.

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.

10 Real-time UV Monitoring System

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

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

11 Real-time UV Monitoring System

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.

12 Real-time UV Monitoring System

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 room 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.

7. 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

13

Recommended publications