Fireworks haven’t changed much since 1,000 years ago, when a Chinese monk named Li Tian stuffed a piece of bamboo with gunpowder and chucked it into a fire to scare away ghosts (don’t try that at home!).
All a firework really needs for the bang is an explosive (gunpowder), a shell (bamboo), and, of course, fire. But for most fireworks, that final, colourful explosion needs to happen in the air, so before the bang, there has to be a launch.
A fairly simple firework is contained within a cylindrical shell, usually made of paper, and known as a ‘mortar’. This is essentially the cannon that contains the firework.
At the bottom of the tube are two compartments, with a fuse running from the bottom one to the top one. At first, the fuse is fast-burning, and when it reaches the first compartment, it hits enough packed gunpowder to send it shooting up into the sky.
(Just a note here: it’s the fact that the gunpowder is compressed that causes the explosion. Loose gunpowder burns, but it needs to be packed together before you really get a bang or a launch.)
Once the firework is in the air, the fuse burns more slowly as it heads up to the second compartment, so that the explosion happens at a very carefully-calculated altitude.
Within that second compartment is where the magic happens. At the centre is another pack of gunpowder, ready to send anything around it flying in all directions when it’s lit. A standard coloured-star firework also contains explosive spheres, called, unsurprisingly, ‘stars’. When these are lit, they burn, producing each point of light we see. So when that fuse hits the central gunpowder, it sends these burning spheres shooting out in all directions, producing those beautiful patterns of light.
To create the colours, the stars can be covered with layers of metals, which absorb the energy from the stars and use it to emit the tell-tale colours. For example, steel makes yellow, barium makes green, and copper makes blue. They can even be covered with multiple layers to change colour as they burn.
To make the more complicated fireworks, it’s possible to string fuses together, or have multiple compartments with specific time-delay fuses so that a firework can contain more than one explosion. ‘Cake’ fireworks, for example, are a load of compartments that set off a range of sparks and bangs, set off by a set of fuses strung together in a calculated sequence.
[Also posted over on Ask a Scientist]