An interactive browser-based simulation that demonstrates how laser diffraction can be used to estimate the thickness of a human hair.
The project combines physics, mathematical modeling, and JavaScript visualization into an interactive experiment that runs entirely in the browser.
GitHub Pages:
https://abhardwaj28.github.io/Hair-Diffraction-Simulation/
A strand of hair can act as a thin obstacle when illuminated by a laser. According to Babinet's principle, the diffraction pattern produced by a thin obstacle is related to the diffraction pattern of a slit of the same width.
By measuring the distance between the central maximum and the first diffraction minimum, the diameter of the hair can be estimated.
The simulation models this diffraction pattern and allows the user to change experimental parameters interactively.
For a thin obstacle, the first diffraction minimum can be approximated using:
For small angles:
Therefore:
Where:
| Symbol | Meaning |
|---|---|
d |
Hair diameter |
λ |
Laser wavelength |
D |
Hair-to-screen distance |
β |
Distance from the central maximum to the first minimum |
The simulation calculates the expected diffraction intensity across the screen using the single-slit diffraction intensity relationship:
where
- Interactive diffraction-pattern simulation
- Adjustable laser wavelength
- Adjustable hair-to-screen distance
- Adjustable hair diameter
- Adjustable screen width
- Automatic calculation of the first diffraction minimum
- Automatic hair-thickness estimation
- Real-time graph updates
- Central diffraction maximum visualization
- Runs directly in a web browser
- No backend or server required
- HTML
- CSS
- JavaScript
- HTML Canvas
- Mathematical modeling
- Diffraction physics
Hair-Diffraction-Simulation/
│
├── index.html
└── README.md
The entire simulation is contained inside index.html, making it simple to deploy using GitHub Pages.
Clone the repository:
git clone https://github.com/ABhardwaj28/Hair-Diffraction-Simulation.gitEnter the project directory:
cd Hair-Diffraction-SimulationThen open:
index.html
in any modern web browser.
No Python installation or backend server is required.
The project is deployed using GitHub Pages.
To deploy your own copy:
-
Create a public GitHub repository.
-
Upload
index.html. -
Open Settings → Pages.
-
Select:
- Source:
Deploy from a branch - Branch:
main - Folder:
/ (root)
- Source:
-
Save the settings.
GitHub Pages will automatically publish the website.
Using approximately:
Laser wavelength = 650 nm
Hair-to-screen distance = 2 m
Hair diameter = 70 µm
the simulation predicts the position of the first diffraction minimum and uses it to calculate the hair diameter.
The values can be changed to explore how wavelength, distance, and hair thickness affe