A small generator is sometimes fitted to a bicycle to provide electricity for the lights at night.The generator is called a bicycle dynamo. Inside the dynamo, a permanent magnet is rotated in the middle of some coils of wire. Rotating the magnet instead of the coils has the advantage that slip rings are not needed.The rotating magnet produces a changing magnetic field and this generates electricity in the coils of wire.The top of the dynamo is touched against the rim of the tire which rotates when the bicycle is moving.