Skip to content

Project

Electromagnetic Spectrum Explorer

Interactive learning tool for understanding the electromagnetic spectrum

An interactive web application for exploring the electromagnetic spectrum from radio waves to gamma rays. This educational tool provides real-time visualization, unit conversion, and comprehensive information.

React JavaScript Vite D3.js
Screenshot of Electromagnetic Spectrum Explorer

The Problem

Physics education often relies on static diagrams that fail to convey the vast scale of the electromagnetic spectrum. Students struggle to understand the relationships between wavelength, frequency, and energy across 20+ orders of magnitude.

The Solution

Built an interactive visualization that uses logarithmic scaling to represent the entire electromagnetic spectrum. Real-time unit conversion and region-specific educational content help users explore the physics of light and radiation.

The Results

  • Interactive exploration from gamma rays to radio waves
  • Real-time conversion between wavelength, frequency, and energy
  • NIST-certified physical constants for scientific accuracy
  • Educational content for each spectrum region
20+
Orders of Magnitude
7
Spectrum Regions

Electromagnetic wavelengths run from femtometers to kilometers — more than twenty orders of magnitude. The core design problem in this explorer was making that entire range navigable on a single screen, which is why everything in the interface, from the spectrum bar to the position marker, is built on logarithmic scaling.

Spectrum Explorer

Visible Light
556 nm
Gamma Radio

Frequency: 430-750 THz

Energy: 1.7-3.1 eV

The only portion of the spectrum visible to human eyes.

Key Features

  • Full Spectrum Coverage: From radio waves to gamma rays
  • Real-Time Visualization: Interactive spectrum display with logarithmic scaling
  • Unit Conversion: Convert between wavelength, frequency, and energy
  • Educational Content: Comprehensive information for each band
  • Scientific Accuracy: NIST-certified physical constants

Technical Implementation

The application implements robust physics calculations:

export const PHYSICS_CONSTANTS = {
  SPEED_OF_LIGHT: 299792458, // m/s (exact)
  PLANCK_CONSTANT: 6.62607015e-34, // J*s (exact)
  PLANCK_CONSTANT_EV: 4.135667696e-15, // eV*s
};

export function wavelengthToFrequency(wavelength) {
  return SPEED_OF_LIGHT / wavelength;
}

The logarithmic visualization enables smooth interaction across scales spanning from femtometers to kilometers.

What was hard

Scientific tools punish sloppy numerics. Values near the edges of the spectrum push against JavaScript’s floating-point limits, so every calculation validates its inputs and returns NaN early rather than letting a bad value propagate through a chain of conversions into a plausible-looking wrong answer. The conversion panel was the other challenge: wavelength, frequency, and energy are three views of one quantity, so editing any field has to update the other two without triggering an infinite update loop. Input parsing also has to meet users where they are, accepting 550 nm, 5.45e14, or bare meters and normalizing the units before any math runs.

Was this helpful?

Want to learn more?

Ask can answer questions about this project's implementation, technologies, and more.