Welcome to Laser Pointer Forums - discuss green laser pointers, blue laser pointers, and all types of lasers

LPF Donation via Stripe | LPF Donation - Other Methods

Links below open in new window

ArcticMyst Security by Avery

[WIP] Laser Safety Calculation App / Webpage

Joined
Apr 6, 2010
Messages
81
Points
0
Still very much a work in progress, but will be updating this post as I go.
I'm writing both a webpage and an Android app for doing quick laser safety calculations (very simplistic for now - continuous wave only)
I am posting the incomplete product right now because I would like validation from the community (i.e. are the calculations accurate? Is the information given accurate?) If you find something wrong, please reply or PM me and let me know, so I can correct it. Yes, the code is sloppy right now, because I'm just banging out the calculations. I'll organize the code once all is complete, most likely putting it all into a js file that can be reused.
Right now, only the webpage is up, and even then, has a very very simple UI.
URL: http://www.tryptrecords.com/safety.html
Here's an example of the output of the webpage:
laser.png


Once I get everything I want into the webpage, I'll port it over to Android.

[UPDATE] The webpage UI has been updated:
laserform.png
 
Last edited:





Joined
Apr 6, 2010
Messages
81
Points
0
Can't seem to get the webpage to load... :(

What browser please? I have tested in Chrome, FireFox, and IE. Also, do you get an error? 404, 500?

Also.... this might seem like an odd question:
IP subnet? (###.###.###.0)
Reason I ask, our webserver blocks some IP ranges due to many hack attempts from the Asia region.
 
Last edited:
Joined
Feb 23, 2012
Messages
1,282
Points
0
I'm using Chrome, probably the latest version.

The website just times out, pings resulting in 100% loss.

Perhaps my ISP is blocking the site? I've known couple other sites that just won't load for some reason.

Edit: So the problem should be on my part. Wish I could try the calculator out though. :)
 
Last edited:
Joined
Apr 6, 2010
Messages
81
Points
0
I have another webserver, I'll try uploading to that later (site blocked by my company's web filter, due to gaming content)

If you want to test it though, feel free (I am a firm believer in open source)
HTML:
<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
<form name='calculations'>
    Wavelength:<br>
    <input type="radio" name="wavelength" value="0.03050"><font color='blue'>445</font><br>
    <input type="radio" name="wavelength" value="0.88016"><font color='green'>532</font><br>
    <input type="radio" name="wavelength" value="0.23825"><font color='RED'>633</font><br>
    Milliradians: <input type="number" name="milrad" value='1'> <br>
    Power (mW): <input type="number" name="power"> <br>
    <button type='button' onClick="calculate(document.forms['calculations'])">Calculate</button>

    <script>

        function log10(val) {
            return Math.log(val) / Math.LN10;
        }
        function calculate(form)
        {
            var wave = 0;
            var x = form.wavelength;
            for (var i = 0;i< x.length;i++)
            {
                if (x[i].checked)
                    wave = x[i].value;
            }
            var millirad = form.milrad.value;
            var power = form.power.value;
            var msg = "";
            var NOHD = (32.8/millirad)*Math.sqrt(0.5*power);


            var ED50 = NOHD / 3.16;
            var SZED = (32.8/millirad)*Math.sqrt(12.7*power*wave);
            var CZED = SZED*4.47;
            var LFZED = CZED*10;
            var OD1 = -log10(0.001/(power/1000));
            var OD5 = -log10(0.005/(power/1000));
            var OD100 = -log10(0.1/(power/1000));
            //Convert feet to miles if needed
            {
            var ED50miles = false;
                if (ED50 > 5280)
                {
                    ED50 = ED50 / 5280;
                    ED50miles = true;
                }
            var SZEDmiles = false;
                if (SZED > 5280)
                {
                    SZED = SZED / 5280;
                    SZEDmiles = true;
                }
            var CZEDmiles = false;
                if (CZED > 5280)
                {
                    CZED = CZED / 5280;
                    CZEDmiles = true;
                }
            var LFZEDmiles = false;
                if (LFZED > 5280)
                {
                    LFZED = LFZED / 5280;
                    LFZEDmiles = true;
                }
            var nmiles = false;
            if (NOHD > 5280)
            {
                NOHD = NOHD / 5280;
                nmiles = true;
            }
            }
            SZED = SZED.toFixed(2);
            NOHD = NOHD.toFixed(2);
            ED50 = ED50.toFixed(2);
            CZED = CZED.toFixed(2);
            LFZED = LFZED.toFixed(2);
            var msg = "";
            msg += "Safe* Distance to view direct laser: " + NOHD + (nmiles?" mi.":" ft.");
            msg += "\n";
            msg += "50/50 chance of retinal damage at: " + ED50 + (ED50miles?" mi.":" ft.");
            msg += "\n";
            msg += "Flashblind distance: " + SZED + (SZEDmiles?" mi.":" ft.");
            msg += "\nGlare distance: " + CZED + (CZEDmiles?" mi.":" ft.");
            msg += "\nDistraction distance: " + LFZED + (LFZEDmiles?" mi.":" ft.");
            msg += "\n";
            msg += "\n";
            msg += "----- Optical Density Recommendations -----\n";
            msg += "OD Rating are listed as such:  for the given power of laser, the OD rating will give the laser the appearance of x amount of power.  Example: A 1W laser through OD3 will give the appearance of a 1mW laser.\n";
            msg += "For safety reasons, it's best to always round up, and ALWAYS check that your safety glasses are for the given wavelength.\n";
            msg += "1mW: " + OD1.toFixed(2);
            msg += "\n5mW: " + OD5.toFixed(2);
            msg += "\n100mW: " + OD100.toFixed(2);
            msg += "\n\nIt is always best to go for the 1mW rating, to avoid damage to your eye.\n\n";
            msg += "*Safe is a relative term.  Never point a laser at a person, animal, vehicle, or anything you wouldn't point a gun at.";
            alert(msg);
        }
    </script>
</form>
</body>
</html>
 
Last edited:




Top