I saw the sparks flying at the bottom of SSME just before the launch in below video. Are they used for igniting the excess propellant gas? [9 min 24 sec]
The sparks are emitted by pyrotechnic devices called technically Radial Outward Firing Igniters (ROFIs) and colloquially "sparklers".
The startup sequence of the Space Shuttle Main Engines (SSMEs) causes them to emit gaseous hydrogen immediately prior to ignition. The purpose of the sparklers is to prevent the accumulation of explosive amounts of the vapors by burning them off.
To serve this purpose the igniters are fired shortly before the SSME ignition sequence begins.
At T minus 10 seconds, the "go for main engine start" command is issued by the GLS. (The GLS retains the capability to command main engine stop until just before the SRBs are ignited.) At this time flares are ignited under the main engines to burn away any residual gaseous hydrogen that may have collected in the vicinity of the main engine nozzles. A half second later, the flight computers order the opening of valves which allow the liquid hydrogen and oxygen to flow into the engine's turbopumps.
At T minus 6.6 seconds, the three main engines are ignited at intervals of 120 milliseconds. The engines throttle up to 90 percent thrust in 3 seconds. At T minus 3 seconds, if the engines are at the required 90 percent, SRB ignition sequence starts. All of these split-second events are monitored by the Shuttle's four primary flight computers.
- GLS - Ground Launch Sequencer
- SRB - Solid Rocket Booster
- T - Launch Countdown Time (T=0 is the time of launch)
Here's a picture I took of a ROFI at the pad on May 8 2008. The orbiter is Discovery, stacked for STS-124.