UV sensor ML8511


Closed Thread
Results 1 to 8 of 8
  1. #1
    Join Date
    Oct 2013
    Posts
    41

    Default UV sensor ML8511

    Hi to all and Happy New year.
    Today I receive a UV sensor ML 8511.
    Watching his datasheet the output voltage is linear to intensity of the UV light.
    How to measured voltage convert into a UV index.
    Supply voltage PIC and the sensor is 5.0V
    AD conversion is 10 bit and I use 18F4520 chip




    Code example to measure voltage:

    ' ** Setup the ADCIN Defines **

    Define ADC_BITS 10 ' Set resolution of conversion
    Define ADC_CLOCK 2 ' Set clock source (x/FOSC or FRC)
    Define ADC_SAMPLEUS 50 ' Set sampling time (in uS)




    ' ** Declare the Variables **

    AD_Raw Var Word ' 10-bit result of A/D conversion
    AD_Result Var Word ' Quantasized ADC result
    Average Var Word ' Variable for building up the average result
    Samples Var Byte ' Amount of samples taken
    Volts Var Byte ' Holds the Volts part of the result (only for display purposes)
    Millivolts Var Word ' Holds the Millivolts part of the result (only for display purposes)



    ' quanta level = (5/1024) * 256 == 1250
    Quanta Con 1250
    ' ** Define the bits within the ADCON1 register **

    ADFM Var ADCON1.7 ' ADC result fotmat select bit
    PCFG3 Var ADCON1.3 ' ADC port configuration bit
    PCFG2 Var ADCON1.2 ' ADC port configuration bit
    PCFG1 Var ADCON1.1 ' ADC port configuration bit
    PCFG0 Var ADCON1.0 ' ADC port configuration bit




    PCFG0=0
    PCFG1=1
    PCFG2=0
    PCFG3=0 ' Configure for AN0-AN4 as analogue input
    ADFM=1 ' Right justified result in ADRESL and ADRESH

    ' ** THE MAIN PROGRAM STARTS HERE **
    main:

    Average=0 ' Clear the Average variable befor use
    For Samples=0 to 9 ' We will take 10 samples of the ADC
    ADCIN 1,AD_Raw ' Place the conversion of channel0 into AD_RAW
    Average=Average+AD_Raw ' Build up the Average result
    Next ' Close the loop
    Average=Average/10 ' Calculate the average by dividing by the number of samples taken
    AD_Result=(Average) */ Quanta ' Quantasize the result

    Volts= AD_Result/100 ' Calculate the Volts part of the result
    Millivolts=AD_Result//100 ' Calculate the Millivolts part of the result


    Lcdout $fe, 2 '
    Lcdout "Napon = ", DEC volts, ".",dec Millivolts, "V" '

    pause 100

    goto main

  2. #2
    Join Date
    Dec 2007
    Location
    Finland
    Posts
    191


    Did you find this post helpful? Yes | No

    Default Re: UV sensor ML8511

    Quote Originally Posted by visnja30 View Post
    How to measured voltage convert into a UV index.
    Supply voltage PIC and the sensor is 5.0V
    UV Index is defined W/m2 --> 1 mW/cm2 = 10 W/m2 (10x)
    From datasheet:
    UV Index: 0 = 1.0V (typ), 100 = 2.2V (typ)
    Make sure that supply voltage is very stable, 1mV = 0.833 UV index

    Check operating voltage from datasheet!!
    Last edited by Gusse; - 5th January 2016 at 17:30.

  3. #3
    Join Date
    Oct 2013
    Posts
    41


    Did you find this post helpful? Yes | No

    Default Re: UV sensor ML8511

    On board is 3V3 voltage regulator so I think it must work with 5V input voltage.

  4. #4
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: UV sensor ML8511

    can you provide a link to the actual module you have. Most of the hits from Google suggest the unit is 3.3v, with a pull up resistor between EN and +3.3v and show no regulator... It would also suggest that the voltage out will be from 0 to +3.3v and not 5v that you might expect.


  5. #5
    Join Date
    Oct 2013
    Posts
    41


    Did you find this post helpful? Yes | No

    Default Re: UV sensor ML8511

    http://www.ebay.com/itm/351494135550...%3AMEBIDX%3AIT

    I know that the maximum voltage from the module is 3.3volts and my PIC AD module can measure 5 volt maximum.Is that problem?

  6. #6
    Join Date
    Dec 2007
    Location
    Finland
    Posts
    191


    Did you find this post helpful? Yes | No

    Default Re: UV sensor ML8511

    It seems that it is challenging to calculate accurate UV-Index (0-11+), as you would like to do.
    Index is weighted using 3 different wavelengths and this broadband UV sensor covers all of them.
    Problem is that there is just one output value for all of them.

    Wavelenghts and weighting:
    295 nm -> 1x , 305 nm -> 0.22x , and 325 nm -> 0.003x
    How is the UV-Index Calculated?

    Basically you could generate your own multiplier, based on above values and hands-on testing.

    About operating voltages, even there is 3.3v LDO for chips itself, EN (enable pin) still need to be in spec. Put voltage divider between PIC and sensor.
    ADC is not a problem, measure & scale result (1v -> 0, 3v -> 1023, 10-bit ADC)
    Last edited by Gusse; - 6th January 2016 at 13:03.

  7. #7
    Join Date
    Oct 2013
    Posts
    41


    Did you find this post helpful? Yes | No

    Default Re: UV sensor ML8511

    ADC is not a problem, measure & scale result (1v -> 0, 3v -> 1023, 10-bit ADC) ...... Yes it is problem

    This is my problem I can measure voltage from sensor but how to scale it to UV intensity from datasheet.

    I change the power supply to 3.3V and EN pin is connected to VCC pin.

  8. #8
    Join Date
    Dec 2007
    Location
    Finland
    Posts
    191


    Did you find this post helpful? Yes | No

    Default Re: UV sensor ML8511

    Quote Originally Posted by visnja30 View Post
    ADC is not a problem, measure & scale result (1v -> 0, 3v -> 1023, 10-bit ADC) ...... Yes it is problem
    This is my problem I can measure voltage from sensor but how to scale it to UV intensity from datasheet.
    In Lapis website, they have graph including UV-index.
    1V = 0 UV-Index
    3V = 15 UV-Index

    Don't know how they have calculated that, but lets take it as it is.

    Scaling ADRaw: 310 (1V) - 925 (3V) to UVIndex: 0 -15
    Code:
    If AD_Raw < 310 THEN AD_Raw = 310
    UVIndex = (((AD_Raw * 4)/17)-71)/10
    Name:  Clipboard02.jpg
Views: 1222
Size:  42.8 KB

    Above is approximation for accurate calculation formula. It should be close enough, but if it is not then alternate parameters...
    Remember that intermediate results (step by ste) must remain as an integer value
    Last edited by Gusse; - 8th January 2016 at 12:44.

Similar Threads

  1. Oxygen Sensor
    By sammy in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 16th January 2009, 16:25
  2. Replies: 6
    Last Post: - 18th January 2008, 08:17
  3. Touch Sensor
    By Pesticida in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 26th September 2007, 16:44
  4. ultrasonic sensor
    By PoTeToJB in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 9th May 2006, 20:26
  5. distance sensor
    By ngeronikolos in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 27th January 2006, 10:37

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts